Jump to content
Sign in to follow this  
Licht

Script went wrong

Recommended Posts

Licht

First time using Autoit, so please bear with me 

Global $Paused, $Runner
HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("{ESC}", "Terminate")
HotKeySet("{F9}", "ShowMe")


While 1
    Sleep(100)
WEnd
;;;;;;;;

Func TogglePause()
    $Paused = Not $Paused
    While $Paused
        Sleep(100)
        ToolTip('Script is "Paused"', 0, 0)
    WEnd
    ToolTip("")
EndFunc   ;==>TogglePause

Func Terminate()
    Exit 0
EndFunc   ;==>Terminate

Func ShowMe()
    $Runner = Not $Runner
    While $Runner
      Send("{LCTRL down}")
      Send("{LEFT down}")
      Sleep(16000)
      Send("{LCTRL up}")
      Send("{LEFT up}")
      Send("{PGUP 4}")
      Send("{LCTRL down}")
      Send("{RIGHT down}")
      Sleep(16000)
      Send("{PGUP 4}")
   WEnd
EndFunc

Basically it's supposed to make me go from one end to the other while pressing on a button and also loop it, but the thing is that when I start the script it goes into Pause mode and I can't unpause it...
Also I'm not very sure if the script works because I haven't been able to test it.

Cant anyone tell me what went wrong with the script or is there anything im doing wrong?

Edited by Licht

Share this post


Link to post
Share on other sites
Shane0000
Global $Paused = False, $Runner
HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("{ESC}", "Terminate")
HotKeySet("{F9}", "ShowMe")


While 1
    Sleep(100)
    Select
        Case $Runner And Not($Paused)
            ConsoleWrite("Running" & @CRLF & "$Runner: " &  $Runner & @CRLF & _
                                 "$Paused: " &  $Paused & @CRLF)
        Case Not($Runner) Or $Paused
            ConsoleWrite("Paused" & @CRLF & "$Runner: " &  $Runner & @CRLF & _
                                 "$Paused: " &  $Paused & @CRLF)
   EndSelect
WEnd
;;;;;;;;

Func TogglePause()
    $Paused = Not $Paused
    ToolTip("$Paused: " &  $Paused)
EndFunc   ;==>TogglePause

Func Terminate()
    Exit 0
EndFunc   ;==>Terminate

Func ShowMe()
    $Runner = Not $Runner
EndFunc

Is this the goal?

Share this post


Link to post
Share on other sites
Exit

Welcome to the forum :) 

I think it's running well. I just changed it to audiable alarm.

 

Global $Paused, $Runner
HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("{ESC}", "Terminate")
HotKeySet("{F9}", "ShowMe")

While 1
    Sleep(100)
WEnd



Func TogglePause()
    Beep(1000, 100)

    $Paused = Not $Paused

    While $Paused

        Beep(1000, 100)

        Sleep(100)
        ToolTip('Script is "Paused"', 0, 0)
    WEnd

    ToolTip("")
EndFunc   ;==>TogglePause



Func Terminate()
    Beep(1000, 500)

    Exit 0
EndFunc   ;==>Terminate



Func ShowMe()
    Beep(3000, 100)
    $Runner = Not $Runner
    While $Runner
        Beep(3000, 100)

;~      Send("{LCTRL down}")
;~      Send("{LEFT down}")
;~      Sleep(16000)
;~      Send("{LCTRL up}")
;~      Send("{LEFT up}")
;~      Send("{PGUP 4}")
;~      Send("{LCTRL down}")
;~      Send("{RIGHT down}")
;~      Sleep(16000)
;~      Send("{PGUP 4}")
    WEnd

EndFunc   ;==>ShowMe

 


My UDFs, Abbrevs and Snippets
If you like my post, just click the like button :) 

Share this post


Link to post
Share on other sites
Licht

I can hear the beeping from the script running (not paused) yet nothing is happening. i tried changing it to 

Send("{a down}")

Opened notepad and nothing's coming out.

Aside from that it has to be holding down LCTRL and LEFT for 16 secs which it isnt. Instead it's sending it at a 16secs interval.

Edited by Licht

Share this post


Link to post
Share on other sites
JLogan3o13
Basically it's supposed to make me go from one end to the other while pressing on a button and also loop it

Can you please explain more about what you're actually trying to do? There has to be a better way than all those Sends.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
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
Sign in to follow this  

×