Jump to content

How to set start/stop hotkeys


khray
 Share

Recommended Posts

  • Developers

Can anyone help me out?

Sure ... the question is what ?

start stop hotkey ?

what did the Helpfile tell you ?

;)

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

  • Developers

Would you mind dumbing it down for me?

You mean you are to lazy to look it up yourself ?

The Helpfile contains this very example .

Edited by JdeB

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

  • Developers

No, i havent had enough experience with any type of programming to even understand the helpfile

Learn to walk first before running....

Take the exampe for HotKeySet from the helpfile and try to understand line by line...

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

; Press Esc to terminate script, Pause/Break to "pause"

Global $Paused

HotKeySet("{PAUSE}", "TogglePause")

HotKeySet("{ESC}", "Terminate")

$WindowTitle = "2006-09-18a kRO Sakexe v1.0"

; Double click at 0,500

MouseClick("left", 767, 542, 9999999990)

Func TogglePause()

$Paused = NOT $Paused

While $Paused

ToolTip('Script is "Paused"',0,0)

WEnd

ToolTip("")

EndFunc

Func Terminate()

Exit 0

EndFunc

Link to comment
Share on other sites

; Press Esc to terminate script, Pause/Break to "pause"

Global $Paused

HotKeySet("{PAUSE}", "TogglePause")

HotKeySet("{ESC}", "Terminate")

$WindowTitle = "2006-09-18a kRO Sakexe v1.0"

; Double click at 0,500

MouseClick("left", 767, 542, 9999999990)

Func TogglePause()

$Paused = NOT $Paused

While $Paused

ToolTip('Script is "Paused"',0,0)

WEnd

ToolTip("")

EndFunc

Func Terminate()

Exit 0

EndFunc

I can understand where you are coming from but (and I can't speak for everyone) not many people on these boards are going to have/want to take the time to teach some of the very basics.

It looks like you changed the help file script around a little bit.

What else do you need help with on this or what are you trying to do?

Be open minded but not gullible.A hammer sees everything as a nail ... so don't be A tool ... be many tools.

Link to comment
Share on other sites

Global $Paused
HotKeySet("{PAUSE}", "TogglePause")

Func TogglePause()
    $Paused = NOT $Paused
    While $Paused
        sleep(100)
        ToolTip('Script is "Paused"',0,0)
    WEnd
    ToolTip("")
EndFunc

Straight out of the helpfile, always check there first, as has been pointed out already...

IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font]
Link to comment
Share on other sites

; Press Esc to terminate script, Pause/Break to "pause"

Global $Paused

HotKeySet("{PAUSE}", "TogglePause")

HotKeySet("{ESC}", "Terminate")

$WindowTitle = "2006-09-18a kRO Sakexe v1.0"

; Double click at 0,500

MouseClick("left", 767, 542, 9999999990)

Func TogglePause()

$Paused = NOT $Paused

While $Paused

ToolTip('Script is "Paused"',0,0)

WEnd

ToolTip("")

EndFunc

Func Terminate()

Exit 0

EndFunc

This script will most likely end after the 9999999990 mouse clicks have been done.

Since the number of clicks is so large, the program cannot move to the next line in the script (it is still keeping busy executing the 9999999990 mouseclicks).

Once those mouseclicks are done, this script would exit since Functions are not executed unless called so they are ignored and MouseClick is considered the last line in the script.

If you want it to pause, change the number of clicks to 1 and put a while wend section in there like it shows in the Help file script.

While 1

MouseClick("left", 767, 542, 1)

Wend

Be open minded but not gullible.A hammer sees everything as a nail ... so don't be A tool ... be many tools.

Link to comment
Share on other sites

Lets explain this line by line

; Press Esc to terminate script, Pause/Break to "pause"

Global $Paused ; Declares a variable to be "Global"
HotKeySet("{PAUSE}", "TogglePause"); Sets the Pause/Break key to the "TogglePause" Function
HotKeySet("{ESC}", "Terminate") ; Binds the ESC key to the "Terminate" function

$WindowTitle = "2006-09-18a kRO Sakexe v1.0" ; Declares a variable to contain a string (Pshhht Ragnarök online)

; Double click at 0,500
MouseClick("left", 767, 542, 9999999990); the ridiculous mouseclick

Func TogglePause() ; Declares the function called "TogglePause" which would be called every time the Pause/Break key is pushed
$Paused = NOT $Paused ; Switches the paused variable between "true" and "false" each time it is called (allows for toggling)
While $Paused ; Initiates a loop that will only work if Pause variable is "true"
ToolTip('Script is "Paused"',0,0); Displays a tooltip so the user knows what going on
WEnd; Ends that last loop
ToolTip(""); Clears the tooltip
EndFunc; Finishes declaring the "TogglePause" Function

Func Terminate() ;Declares the function called "Terminate" which would be called every time the ESC key is pushed
Exit 0 ; Exits the program when called (Thus "terminates")
EndFunc; Finishes the "Terminate" function

Hope that helps

Edited by Paulie
Link to comment
Share on other sites

****EDIT****

Sorry didn't read .. he wanted to pause the script

Hi,

i think its ment like this

When the program is visibible the hotkeys are active

when the program is minimized the hotkeys are deactivated

small example

#include <GUIConstants.au3>
#include <Constants.au3>

HotKeySet ("!x", "TerminateProgram") ; alt X call the function TerminateProgram

$Parent = GuiCreate("TEST GUI", 100,100)
GUICtrlCreateLabel ("ALT-X will exit", 20, 80) 
GuiSetState ()


Func HotKeyEnable ()
 HotKeySet ("!x", "TerminateProgram") 
EndFunc



Func HotKeyDisable ()
 HotKeySet("!x", "AssignNoFunctionToHotKey")  
EndFunc

Func AssignNoFunctionToHotKey ()
EndFunc

Func TerminateProgram ()
  Exit
EndFunc

While 1
 $msg = GUIGetMsg ()
  If $msg = $GUI_EVENT_CLOSE then TerminateProgram()
  if $msg = $GUI_EVENT_MINIMIZE then 
     HotKeyDisable ()
   EndIF
  if $msg = $GUI_EVENT_RESTORE then 
     HotKeyEnable ()
  EndIf
Wend

Greetinx,

Emiel

Edited by Emiel Wieldraaijer

Best regards,Emiel Wieldraaijer

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