Press random key?
Moderators: JRL, Dorian (MJT support)
Press random key?
Anyway to script a random keystroke of a specific set of keys? Like "O", "P", "S", "OO", "PS"...let the script pick any combination of those keys and send it
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Re: Press random key?
Code: Select all
//list of possible keystrokes
Let>keystrokes=O,P,S,OO,PS
//separate to an array
Separate>keystrokes,comma,arrKeys
//get a random number within the range 0 - length of array -1
Random>arrKeys_count,randKeyNumber
//add one to random number (our array starts at 1)
Let>randKeyNumber=randKeyNumber+1
//get the key combo from the array using that index
Let>theKey=arrKeys_%randKeyNumber%
//send it
Send>theKey
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
Re: Press random key?
Awesome! Thanks you
Re: Press random key?
Hmmmm...its sending keys so fast the program is not catching it. Its not an issue with sk_delay...its the key itself, like the program needs human speed keypress duration and this is doing StarTrek press duration
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Re: Press random key?
Split the press into a key down, a wait and a key up. You can do that with KeybdEvent.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?