Jump to content

Script went wrong


Recommended Posts

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
Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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

 

App: Au3toCmd              UDF: _SingleScript()                             

Link to comment
Share on other sites

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
Link to comment
Share on other sites

  • Moderators
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.

"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!

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...