moose Posted April 22, 2011 Share Posted April 22, 2011 Hi, I'm trying to create a keyboard macro that will send text to an editor when a key combination is pressed (alt+a). Whenever I press alt+a, I get an error beep, and the first letter of the macro text is missing. Thanks in advance. Opt("SendKeyDelay", 0) Opt("SendKeyDownDelay", 0) ; Set the HotKeys HotKeySet("!a", "_align") HotKeySet("{ESC}", "On_Exit") ; Now keep the script active While 1 Sleep(10) WEnd Func _align() ; Unset the HotKey HotKeySet("!a") ; Send the keys Send("hello") ; Reset the HotKey HotKeySet("!a", "_align") EndFunc Result when alt+a is pressed: ello Link to comment Share on other sites More sharing options...
Developers Jos Posted April 22, 2011 Developers Share Posted April 22, 2011 Works fine here with SciTE after completing the posted script so it runs. 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 More sharing options...
moose Posted April 22, 2011 Author Share Posted April 22, 2011 (edited) I don't use Scite. Broken in Notepad++ and Notepad here (Windows XP) Interestingly, if I hold alt down, and continue to press 'a' 'a' 'a', the first one is broken, but subsequent ones work ok. =\ Edited April 22, 2011 by moose Link to comment Share on other sites More sharing options...
Developers Jos Posted April 22, 2011 Developers Share Posted April 22, 2011 Try adding a sleep(200) before the Send() to allow for the release of Alt ... else you simulate ALT+(the send characters) 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now