Sign in to follow this  
Followers 0
khray

How to set start/stop hotkeys

19 posts in this topic

Can anyone help me out?

Share this post


Link to post
Share on other sites



Once again, Helpfile. Theres an example of starting/pausing.


# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites

Would you mind dumbing it down for me?

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

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

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

MouseClick("left", 767, 542, 9999999990)oÝ÷ ÙhZ¶Ø^Z­Ë©Â+a¶­2¬x)br@+{*.¶¼¢h~·Í쨺·(­zº+rX«tçM*.ç¶h¹¹^rX«tçM.±ëaÆ®¶­sdÖ÷W6T6Æ6²gV÷C¶ÆVgBgV÷C²ÂÂSÂ

Edited by dandymcgee

- Dan [Website]

Share this post


Link to post
Share on other sites

no I pasted it to get help sir... I dident post it for anyone to use ;)

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

just be able to pause the script

Share this post


Link to post
Share on other sites

what do I put after

While $Paused

to get it to pause?

Share this post


Link to post
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]

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

#18 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

#19 ·  Posted (edited)

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

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  
Followers 0