Jump to content

Hotkey Problem


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!

Link to comment
Share on other sites

  • Developers

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

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

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

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

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

Spoiler

My Humble Contributions:
Personal Function Documentation - A personal HelpFile for your functions
Acro.au3 UDF - Automating Acrobat Pro
ToDo Finder - Find #ToDo: lines in your scripts
UI-SimpleWrappers UDF - Use UI Automation more Simply-er
KeePass UDF - Automate KeePass, a password manager
InputBoxes - Simple Input boxes for various variable types

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