Nickolai Posted January 10, 2020 Share Posted January 10, 2020 expandcollapse popup#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <ImageSearch2015.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 253, 138, 192, 124) GUISetBkColor(0x99B4D1) Global $Start = GUICtrlCreateButton("Start Program", 8, 8, 75, 25) Global $End = GUICtrlCreateButton("Exit", 8, 33, 73, 23) Global $Checkbox1 = GUICtrlCreateCheckbox("Spart", 88, 8, 97, 17) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") Global $Checkbox2 = GUICtrlCreateCheckbox("Checkbox2", 88, 40, 97, 17) Global $Checkbox3 = GUICtrlCreateCheckbox("Checkbox3", 88, 72, 97, 17) Global $Checkbox4 = GUICtrlCreateCheckbox("Boxes", 88, 24, 97, 17) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") Global $Checkbox5 = GUICtrlCreateCheckbox("Checkbox5", 88, 88, 97, 17) Global $Checkbox6 = GUICtrlCreateCheckbox("Checkbox6", 88, 56, 97, 17) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Start CheckStart() Case $End Exit EndSwitch WEnd Func CheckStart() $x = 0 $y = 0 If GUICtrlRead($Checkbox1) = 1 Then $Search = _ImageSearch('kick.png', 0, $x, $y, 0) If $Search = 1 Then MouseMove($x, $y, 50) MouseClick("left") EndIf EndIf EndFunc Trying to figure out how to loop the func CheckStart() i've tried, the issue is i'm trying to get this code to check multiple checkboxes at once when you press "Start program" as well so i only want to loop one area then once that loop is complete i want it to move on to check another checkbox. Func CheckStart() $x = 0 $y = 0 Do until $Search = 0 ; Loop If GUICtrlRead($Checkbox1) = 1 Then $Search = _ImageSearch('kick.png', 0, $x, $y, 0) If $Search = 1 Then MouseMove($x, $y, 50) MouseClick("left") EndIf EndIf EndFunc Link to comment Share on other sites More sharing options...
Nine Posted January 10, 2020 Share Posted January 10, 2020 (edited) What is the application you are trying to automate ("kick.png") ? Have you read the forum rules, especially the part about game automation ? Edited January 10, 2020 by Nine “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
Nickolai Posted January 10, 2020 Author Share Posted January 10, 2020 Just now, Nine said: What is the application you are trying to automate ("kick.png") ? Have read the forum rules, especially the part about game automation ? it's not for a game that's simply the image name. Link to comment Share on other sites More sharing options...
Nickolai Posted January 10, 2020 Author Share Posted January 10, 2020 3 minutes ago, Nine said: What is the application you are trying to automate ("kick.png") ? Have you read the forum rules, especially the part about game automation ? Link to comment Share on other sites More sharing options...
markyrocks Posted January 10, 2020 Share Posted January 10, 2020 (edited) 7 minutes ago, Nickolai said: it's not for a game that's simply the image name. Then what is it for? I only ask to stay within the rules b4 further commenting. Obviously it wouldnt take much to change the image and post a screenshot, not that we can really tell what it says anyways. Edited January 10, 2020 by markyrocks Spoiler "I Believe array math to be potentially fatal, I may be dying from array math poisoning" Link to comment Share on other sites More sharing options...
Nickolai Posted January 10, 2020 Author Share Posted January 10, 2020 Just now, markyrocks said: Then what is it for? I only ask to stay within the rules b4 further commenting. discord Link to comment Share on other sites More sharing options...
Nine Posted January 10, 2020 Share Posted January 10, 2020 Well the image looks like a Notepad empty page...I do not believe you. Reported. “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
Nickolai Posted January 10, 2020 Author Share Posted January 10, 2020 (edited) 2 minutes ago, Nine said: Well the image looks like a Notepad empty page...I do not believe you. Reported. i renamed the empty notepad file to kick because my file is test.au3, if you download the file imagesearch2015.au3 it comes with all the dll files along with the empty notepad after you run it Edited January 10, 2020 by Nickolai Link to comment Share on other sites More sharing options...
Nickolai Posted January 10, 2020 Author Share Posted January 10, 2020 expandcollapse popup#AutoIt3Wrapper_UseX64=y ; Set to Y or N depending on your situation/preference!! #include-once #include <WinAPIFiles.au3> ; for _WinAPI_Wow64EnableWow64FsRedirection #include <ScreenCapture.au3> ;_ScreenCapture_CaptureWnd etc. ;using this in the example to create a test image, otherwise not neccessary here #Region When running compiled script, Install needed DLLs if they don't exist yet If Not FileExists("ImageSearchDLLx32.dll") Then FileInstall("ImageSearchDLLx32.dll", "ImageSearchDLLx32.dll", 1);FileInstall ( "source", "dest" [, flag = 0] ) If Not FileExists("ImageSearchDLLx64.dll") Then FileInstall("ImageSearchDLLx64.dll", "ImageSearchDLLx64.dll", 1) If Not FileExists("msvcr110d.dll") Then FileInstall("msvcr110d.dll", "msvcr110d.dll", 1);Microsoft Visual C++ Redistributable dll x64 If Not FileExists("msvcr110.dll") Then FileInstall("msvcr110.dll", "msvcr110.dll", 1);Microsoft Visual C++ Redistributable dll x32 #EndRegion Local $h_ImageSearchDLL = -1; Will become Handle returned by DllOpen() that will be referenced in the _ImageSearchRegion() function #Region TESTING/Example Local $bTesting = false; Change to TRUE to turn on testing/example If $bTesting Then cr(">" & "_ImageSearchStartup()=" & _ImageSearchStartup(), 2) OnAutoItExitRegister(_ImageSearchShutdown) cr("!Testing...") ;using Notepad as a simple example #Region Notepad Snapshot Creation $hWin = WinGetHandle("[CLASS:Notepad]") If Not IsHWnd($hWin) Then If Run("notepad.exe") = 0 Then cr("Couldn't run notepad.exe") Local $hWin = WinWait("[CLASS:Notepad]", "", 10) If $hWin = 0 Then cr("Notepad WinWait Timeout!") EndIf WinSetState($hWin, "", @SW_RESTORE) WinSetState($hWin, "", @SW_SHOW) WinActivate($hWin) Local $testimage = "24bit.bmp" _ScreenCapture_CaptureWnd($testimage, $hWin, 0, 0, -1, -1, False);_ScreenCapture_CaptureWnd ( $sFileName, $hWnd [, $iLeft = 0 [, $iTop = 0 [, $iRight = -1 [, $iBottom = -1 [, $bCursor = True]]]]] ) cr("made Notepad Window screenshot") #EndRegion Notepad Snapshot Creation #Region Test if application appeared Local $y = 0, $x = 0, $result $result = _ImageSearch($testimage, 1, $x, $y, 0, 0);_ImageSearch($findImage, $resultPosition, ByRef $x, ByRef $y, $tolerance, $transparency = 0) If $result = 1 Then cr("! $result=" & $result, 1) MouseMove($x, $y, 0) cr("+" & "recognised notepad! moved mouse to center of notepad!") Else cr("! $result=" & $result, 1) Exit EndIf #EndRegion Test if application appeared part of the imagesearch2015.au3 script that creates the notepad. Link to comment Share on other sites More sharing options...
Developers Jos Posted January 10, 2020 Developers Share Posted January 10, 2020 All, Please STOP this "wannabee mod" stuff! You have 2 options with multiple choices when reading threads/posts like this: Ignore the thread in case you don't trust it and: Report the first (offending) post when it really looks wrong. Just simply ignore. Answer when you want to assist the OP but refrains from coming across as the Spanish Inquisition. Thread remains open for now. Jos ps: the reason for this lengthy post is that I had to work through 3 reports for this thread about people reporting several posts and multiple members! SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
markyrocks Posted January 10, 2020 Share Posted January 10, 2020 (edited) Case $start While 1 Checkstart() Wend Obviously youd want to add some kinda return from the check start function like if it fails return 0 if it succeeds or whenever you want to move on and have it return 1 more like this Case $start While $check<>1 $check=checkstart() Wend Probably not even necessary to have the additional variable and just put the function call and conditions next to the while but then the loop would be empty in this situation I don't like doing that bc it makes it harder to read later. If anyone wonders why I don't put code snipets in the code tool is bc I don't think its even possible when responding from a phone. I figured it out sry Also your do until statement should look like Do ;Something that has potential to change ;value Until ;value is changed to what I want ;to move on. But with my previous suggestion the function will be called over and over. Making the do loop unnecessary Edited January 10, 2020 by markyrocks Spoiler "I Believe array math to be potentially fatal, I may be dying from array math poisoning" Link to comment Share on other sites More sharing options...
Developers Jos Posted January 10, 2020 Developers Share Posted January 10, 2020 (edited) 9 minutes ago, markyrocks said: If anyone wonders why I don't put code snipets in the code tool is bc I don't think its even possible when responding from a phone. yes you can as this post, posted from my phone, shows. , but you need to type the bbcode: [ code ] ....... [ /code ] (without the spaces) Jos Edited January 10, 2020 by Jos markyrocks 1 SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
markyrocks Posted January 10, 2020 Share Posted January 10, 2020 18 minutes ago, Jos said: yes you can as this post, posted from my phone, shows. , but you need to type the bbcode: [ code ] ....... [ /code ] (without the spaces) Jos I like to play dumb but I actually figured it out b4 I read this. I'm like duh I know some html what am I thinking. Lol but thanks Spoiler "I Believe array math to be potentially fatal, I may be dying from array math poisoning" Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now