Jump to content

help me with this script


Splitz
 Share

Recommended Posts

ok when ever i run this script and something changes at the cordinates (137,269,137,269) and (137,269,137,259) it sends "5" at the same speed as 1.

what i want to do is when ever a change to the pixel color is made at (137,269,137,269), i dont want it to send 5 as fast as it sends 1, i want there to be like a 5 second dely or so if any changes are at (137,269,137,269), but if any changes are at (137,269,137,259) i still want it to send 1 instantly.

Global $Paused
HotKeySet("{Del}", "Terminate")
HotKeySet("{End}", "TogglePause")


If WinActivate("New Text document.txt") Then
    sleep(5000)
    $checksum = PixelChecksum(137,259,137,259)
    $checksum = PixelChecksum(137,269,137,269)
    EndIf

Func TogglePause()
    $Paused = NOT $Paused
    While $Paused
    WEnd
EndFunc

While 1
While $checksum = PixelChecksum(137,259,137,259)
Sleep(100)
    WEnd

Send("1")

While $checksum = PixelChecksum(137,269,137,269)
Sleep(1000)
    WEnd

Send("5")
WEnd

Func Terminate()
    Exit 0
EndFunc

when i run the script and changes are at both area's it looks kinda like this

1515151515151515151515151515151515151515151515151515151515151

if changes are at BOTH areas i want it to look something like this

111111111111111111111111115111111111111111111111111111111111111111115111111111111111111

and if a change is only at the top, (137,269,137,259)

11111111111111111111111111111111111111111111111

and if a change is only at the bottom, (137,269,137,269)

5 (few seconds pass) 5 (few seconds pass) 5

Edited by Fenix`
Link to comment
Share on other sites

  • Moderators

Might start with giving each checksum area their own variable name, because the way you have it, $checksum = PixelChecksum(137, 269, 137, 269) and never PixelChecksum(137, 259, 137, 259).

Global $Paused, $checksum1, $checksum2
HotKeySet("{Del}", "Terminate")
HotKeySet("{End}", "TogglePause")
If WinActivate("New Text document.txt") Then
    Sleep(5000)
    $checksum1 = PixelChecksum(137, 259, 137, 259)
    $checksum2 = PixelChecksum(137, 269, 137, 269)
EndIf
While 1
    If PixelChecksum(137, 259, 137, 259) <> $checksum1 Then
        Sleep(100)
        Send('1')
    ElseIf PixelChecksum(137, 269, 137, 269) <> $checksum2 Then
        Sleep(1000)
        Send('5')
    EndIf
    Sleep(10)
WEnd
Func TogglePause()
    $Paused = Not $Paused
    While $Paused
    WEnd
EndFunc
Func Terminate()
    Exit 0
EndFunc

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

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