Sign in to follow this  
Followers 0
Firstone

Hotkey Conflicts

9 posts in this topic

Hi,

I'm trying to run 2 identical scripts, both have the same pause hotkey function "Pause".

I made a main script which runs these 2 scripts, also with the same hotkey function.

Is there a way to make it so all the scripts pause when pause is pressed?

I tried using the control send feature, which will send it straight to the script, but i can't find the title or handle of the other 2 scripts.

Or if anyone knows another way to get my other scripts paused with one button?

Thanks

Share this post


Link to post
Share on other sites



Yeah I thought about that, but the problem was if I added more identical scripts (Which I intend to do later), I will be using alot of different keys for the pause button, and that will affect other things I do on my PC. Since it wouldn't be using controlsend.

Share this post


Link to post
Share on other sites

Then it is important that you find a solution to make the scripts communicate. I believe there are no (or no proper) libraries to do this.

Some recommendations:

- Use file or registry writing in a fixed location. All other scripts monitor this file or reg value.

- Use TCP connections, make scripts connect to eachother.

In either case:

- Make one script the "boss" (script that is started first) which controls the other scripts.

Share this post


Link to post
Share on other sites

Ahh ok.

That stuff is too advance for me. I'll prob just find some keys I won't be using to set as the pause hotkey.

Thanks

Share this post


Link to post
Share on other sites

Wouldn't this work?

HotKeySet("{Pause}", "PauseFunc")

While 1
    ; Program here
WEnd

Func PauseFunc()
    HotKeySet("{Pause}") ;Deassign Pause Key
    Send("{Pause}") ;Send Pause so other programs will be able to respond
    HotKeySet("{Pause}", "PauseFunc")
    ;Do your toggle stuff here
EndFunc   ;==>PauseFunc

Share this post


Link to post
Share on other sites

Wouldn't that cause a deadlock at some point? Or is the polling delay long enough to let all scripts be able to get the hotkey?

Share this post


Link to post
Share on other sites

Not sure if that would work in my case.

But anyway my problems been solved now =D Did a wider search and found this topic.

http://www.autoitscript.com/forum/index.php?showtopic=85460&st=0&p=612928&hl=hotkey%20for%202%20functions&fromsearch=1&#entry612928

martin suggested to use _IsPressed, and it works nicely for me. I just had to include a adlib function in each of the other scripts.

Share this post


Link to post
Share on other sites

Clever thaught Jeff West. However, the problem is that you can't register the hotkeys all at once.

I didn't mention the _IsPressed technique because it is not fail-safe. But, it's your call.

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