Jump to content

Recommended Posts

Posted

 

Hi, I'm new to programming and autoit. I have a problem. How to make loops in a loop, or how to bite it in a different way?

Namely, in the "while true" loop I want to create a second loop that will repeat the operation until two conditions are met (which will be met along with the time). I paste the code and the problem is that time from sleep flies  all the time and if something lasts more than the time set in "sleep" it skips the next point (the points start with "if" and end with "endif") and go on.

I want to make a loop so that regardless of the time that has passed on fulfilling the second condition with pixelcolor, he followed in turn the given points in the code. I apologize for the weak English, thank you for your help!

#include <ImageSearch.au3>
Global $Paused6
HotKeySet("{Pgup}", "TogglePause6")

global $y = 0, $x = 0
global $y1 = 0, $x1 = 0
global $y2 = 0, $x2 = 0
global $y3 = 0, $x3 = 0



While True
global $search = _ImageSearch('cord1.png', 0, $x, $y, 0)
If $search = 1 And (PixelGetColor(1754,296) = 0x2b3d4d) Then
MouseMove($x, $y, 1)
MouseClick("left")
Sleep(8000)
EndIf
global $search1 = _ImageSearch('cord2m.png', 0, $x1, $y1, 0)
If $search1 = 1 And (PixelGetColor(1754,296) = 0x2b3d4d) Then
MouseMove($x1, $y1, 1)
MouseClick("left")
Sleep(8000)
EndIf
global $search2 = _ImageSearch('cord3.png', 0, $x2, $y2, 0)
If $search2 = 1 And (PixelGetColor(1754,296) = 0x2b3d4d) Then
MouseMove($x2, $y2, 1)
MouseClick("left")
Sleep(8000)
EndIf
global $search3 = _ImageSearch('cord4.png', 0, $x3, $y3, 0)
If $search3 = 1 And (PixelGetColor(1754,296) = 0x2b3d4d) Then
MouseMove($x3, $y3, 1)
MouseClick("left")
Sleep(8000)
EndIf
WEnd



Func TogglePause6()
    $Paused6 = NOT $Paused6
    While $Paused6
        sleep(100)
        ToolTip('Stop',100,130)
    WEnd
    ToolTip('Work',100,130)
 EndFunc

 

Posted

Almost where? Having a hard time understanding the whole thing.

Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Posted

 

I want mousemove and mouseclick to be executed always in turn -

MouseMove ($ x, $ y, 1) later MouseMove ($ x1, $ y1, 1) later MouseMove ($ x2, $ y2, 1) later MouseMove ($ x3, $ y3, 1) and the loop, returns to MouseMove ($ x, $ y, 1).

To use mousemove you need to meet the two conditions "$ search = 1" and "(PixelGetColor (1754,296) = 0x2b3d4d)".

While the first condition is always met, the second condition is fulfilled only after some time (different). "sleep" is set to 8000 (8 seconds). For example - the mouse is on ($ x1, $ y1, 1) it is "cord2m .png" called "cord" because using imagesearch searches for an image saved in png on the screen. Suppose that it is still on this "cord2m" which corresponds to the place on the screen $ search = 1 is met immediately, but "(PixelGetColor (1754,296) = 0x2b3d4d)" to meet this condition takes time which ALWAYS is random and if for 8 seconds (sleep is set to 8000) it does not meet this condition then instead of going to the next cord (in this case ($ x2, $ y2, 1)) it switches to ($ x3, $ y3, 1). I

want the program regardless of the time after which it fulfills the pixelsearch condition.

I can not set a long time because the program will be completely useless, because the second condition will not be met by X time anymore.

It always looks for the right image ($ x, $ y, 1)> ($ x1, $ y1, 1)> ($ x2, $ y2, 1)> ($ x3, $ y3, 1) the order ALWAYS must be the same. I do not know how to present it, I have never programmed, and I'm not technically skilled, my mind is a humanist mind, that's why my translation can be difficult to understand, for which I am sorry, because only one day I use autopoint.

  • Moderators
Posted

@Whiskach you obviously didn't read those forum rules you were pointed to, as this thread is the exact same as the first. Don't open another thread on this subject or your time on this forum will be short-lived.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...