Jump to content

Recommended Posts

Posted

Hi guys! I have another question, and as you probably guessed, it's on multiple hotkeys.

Let's get straight to the problem:

I have no idea on how to make more than one hotkey with different functions.

Example Script:

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

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

;;;; Body of program would go here ;;;;
While 1
    Sleep(100)
WEnd
;;;;;;;;

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

Func Terminate()
    Exit 0
EndFunc

And then I have another code that is the exact same but with different stuff in the ;;;; Body of program would go here ;;;; part. So how would I join them together? Remember they have the pause in them. I tried putting the other hotkey at the top but it said something about using the variable twice...

Thanks for any help~

Rabbitman
Posted

And then I have another code that is the exact same but with different stuff in the ;;;; Body of program would go here ;;;; part. So how would I join them together? Remember they have the pause in them. I tried putting the other hotkey at the top but it said something about using the variable twice...

Under what condition(s) does the body change?

Remember you can assign a different button like :

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

to the same function.

Posted (edited)

I'm sorry I didn't say what I meant to say there. I meant that they have to be able to pause, and they are all DIFFERENT functions with the pause in it. And they are all different hotkeys.

Edited by Rabbitman
Posted

Rabbitman,

I have a feeling that your not providing the actual code. Because to me it sounds as if you attempting to place 2 different functions that use a technique to pause your script, correct? .....And both functions contain the variable $Pause, correct?.....And your attempting to declare the same variable twice at the top of your script, correct?

If I am correct on all questions, then the solution would be to change the name of the declared variable in one of the functions. In example $Pause_2. Or incorporate the two functions into one with a switch to determine which way to go inside the function.

Realm

My Contributions: Unix Timestamp: Calculate Unix time, or seconds since Epoch, accounting for your local timezone and daylight savings time. RegEdit Jumper: A Small & Simple interface based on Yashied's Reg Jumper Function, for searching Hives in your registry. 

Posted

Ok my here is what I'm doing... Im using only one $Paused variable at the top. Then I put my second hotkey where my first one is. Then I put the code starting from the ;;;;;;;Body of program would go here;;;. But it doesn't work. I will post my code in a few minutes.

Posted

Rabbitman,

You asking me to guess why your code will not work without seeing it. Unfortunately I don't own a crystal ball. What is your second hotkey? what code are you putting into 'Body of program would go here'? Is that a Function your placing there? If so that will not work.

I understand that your OP above is your the first script, and your attempting to combine a second script. How about showing the other script, or what your attempting to accomplish code wise. It would be a lot easier for us to help you, if we can see what your attempting. You explanations are not enough, at least for me. If you don't want to show your code, then atleast write an example of it, and provide it.

Realm

My Contributions: Unix Timestamp: Calculate Unix time, or seconds since Epoch, accounting for your local timezone and daylight savings time. RegEdit Jumper: A Small & Simple interface based on Yashied's Reg Jumper Function, for searching Hives in your registry. 

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
×
×
  • Create New...