Jump to content

Recommended Posts

Quote
HotKeySet("1", "Hotkey1")
HotKeySet("2", "Hotkey2")

While 1
    Sleep(100)
WEnd

Func Hotkey1()
   HotKeySet ("1")
   Send("testkey1_1")
   Send("testkey1_2")
   Send("testkey1_3")
   HotKeySet("1", "Hotkey1")
EndFunc

Func Hotkey2()
   HotKeySet ("2")
   Send("testkey2_1")
   Send("testkey2_2")
   Send("testkey2_3")
   HotKeySet("2", "Hotkey2")
EndFunc

 

Hi Guys,

just trying to realize a simple script, when 1 is pressed type something, if 2 is pressed type something else. this thing is just exiting after a couple uses and messes arround, inserts sometimes content from hotkey1.

any clues how to improve that? also sometimes just exists, should normally run forever.

Thanks guys!

Share this post


Link to post
Share on other sites

That posted script won't just exit assuming you don't have that first line you have in there.
Guess your real script isn't the same and contains some sort of error maybe?

Jos

 

Edited by Jos

Share this post


Link to post
Share on other sites

Thanks Jos for your reply ✌🏾

Not byitself, but after using the Hotkey a couple times. The mixing up of the Hotkeys content gets me also confused.

Maybe i am overseeing something general in this?

Share this post


Link to post
Share on other sites

Post a replicator script which simulates the issue to avoid the guessing game as the posted script isn't causing any issues as far as I can see.

Jos

Share this post


Link to post
Share on other sites

You got the right idea when you removed the hotkey before sending the text, but you failed to unregister both hotkeys, which causes both hotkey functions to fire, I imagine :)

Basically, this happens?

  • You run the script and press 1...
  • This launches HotKey1, which unregisters 1 as a hotkey
  • it then types testkey1_1testkey1_2 and launches HotKey2
  • HotKey2 unregisters itself and sends all it's text
  • HotKey1 continues

All my code provided is Public Domain... but it may not work. ;) Use it, change it, break it, whatever you want.

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

×
×
  • Create New...