Multiple keypress options

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
User avatar
Esabik
Pro Scripter
Posts: 52
Joined: Wed Jun 15, 2005 8:03 pm
Location: Fairfield, NJ

Multiple keypress options

Post by Esabik » Fri Jan 11, 2013 7:31 pm

Hi

Maybe I missed it but is there a command that I can use that when I have a specific instruction that it can be set to execute multiple times with one line of code? I am looking to shorten keystrokes in the scripts. For example I have this code:

WAIT>.2
Press Tab
Wait>.2
Press Tab
Wait>.2
Press Tab
Wait>.2
Press Tab
Wait>.2
Press Tab
Wait>.2
Press Tab
Wait>.2
Press Tab
WAIT>.2
Press TAB
Wait>.2
Press Enter
Wait>.2

I would like to enter something like :idea:
Press TAB/8/.2 so this would enter tab 8 times during the run at .2 sec intervals.
Any suggestions?
Just when you thought it was safe to go in the water........:evil:

User avatar
JRL
Automation Wizard
Posts: 3518
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Fri Jan 11, 2013 10:12 pm

You can use a quantity atthe end of a key press command

Code: Select all

Press Tab * 8
But that does not give you a dwell between key presses. I'd recommend a subroutine. Something like.

Code: Select all

GoSub>PressTab,8,0.2

SRT>PressTab
  Let>PressTabCounter=0
  Repeat>PressTabCounter
    Add>PressTabCounter,1
    Wait>%PressTab_var_2%
    Press Tab
  Until>PressTabCounter=%PressTab_var_1%
END>PressTab

User avatar
Marcus Tettmar
Site Admin
Posts: 7391
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Fri Jan 11, 2013 10:52 pm

If you want a delay between presses:

Let>SK_DELAY=100
Press Tab * 8

That will put a 100ms delay between the 8 tabs.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

User avatar
JRL
Automation Wizard
Posts: 3518
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Sat Jan 12, 2013 1:13 am

You are right. SK_DELAY works with the Press functions. For some reason I thought it only worked with Send>.

User avatar
jpuziano
Automation Wizard
Posts: 1085
Joined: Sat Oct 30, 2004 12:00 am

Post by jpuziano » Sat Jan 12, 2013 7:41 pm

JRL wrote:You are right. SK_DELAY works with the Press functions. For some reason I thought it only worked with Send>.
Its easy to see why someone might think that...
Help File topic for System Variables wrote:SK_DELAY .......... Millisecond delay to pause between sending characters in SendText
the above would be clearer if instead we wrote:SK_DELAY .......... Millisecond delay to pause between sending characters via SendText or Press
Also, the Help File topic for SendText> mentions the SK_DELAY system variable while the topic for Press does not.

In my opinion, system variables that directly affect a command should be mentioned in the Help File Topic for that command so it wouldn't hurt to update the Help File topic for Press to mention it.

Not being critical here Marcus. I appreciate all the effort that goes into maintaining a well written Help File with clear examples, etc.

Thanks for listening and take care
jpuziano

Note: If anyone else on the planet would find the following useful...
[Open] PlayWav command that plays from embedded script data
...then please add your thoughts/support at the above post - :-)

User avatar
Marcus Tettmar
Site Admin
Posts: 7391
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Sun Jan 13, 2013 7:35 am

It used to be specific to sendtext but a more recent update made it work with Press too. Seems this change was missed when updating the docs. I'll add it to the next help update.

[john, as you have access to the bug tracker please post omissions like this their instead of raising here]
Last edited by Marcus Tettmar on Sun Jan 13, 2013 7:44 am, edited 1 time in total.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

User avatar
jpuziano
Automation Wizard
Posts: 1085
Joined: Sat Oct 30, 2004 12:00 am

Post by jpuziano » Sun Jan 13, 2013 7:43 am

Perfect Marcus, thanks!
jpuziano

Note: If anyone else on the planet would find the following useful...
[Open] PlayWav command that plays from embedded script data
...then please add your thoughts/support at the above post - :-)

User avatar
Esabik
Pro Scripter
Posts: 52
Joined: Wed Jun 15, 2005 8:03 pm
Location: Fairfield, NJ

Post by Esabik » Mon Jan 14, 2013 7:52 pm

Marcus Tettmar wrote:If you want a delay between presses:

Let>SK_DELAY=100
Press Tab * 8

That will put a 100ms delay between the 8 tabs.
This does work, but I now run into that it maintains the delay during the running of the script while it loops. How would I remove the SK_Delay after that??

Code: Select all

//Send Notes for transaction
Send Character/Text>rm physical count 2012-2013
WAIT>.2
Let>SK_DELAY=200
Press Tab * 8
Wait>.2
Press Enter 
I send a line of about 25 characters and it now puts that delay between every character during the script run and the SK_Delay instruction was after the SendChar in my script so that means that the SK_Delay has been set and the delay is now caught in the loop. Every SendChar/Press is affected. I would like that function to work only for that instance of 8 tabs vs the whole script. Is this possible? I can include the balance of my script if necessary.
Just when you thought it was safe to go in the water........:evil:

User avatar
JRL
Automation Wizard
Posts: 3518
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Mon Jan 14, 2013 7:58 pm

Code: Select all

Let>SK_DELAY=100
Press Tab * 8 
Let>SK_DELAY=0

User avatar
Esabik
Pro Scripter
Posts: 52
Joined: Wed Jun 15, 2005 8:03 pm
Location: Fairfield, NJ

Post by Esabik » Mon Jan 14, 2013 8:18 pm

JRL wrote:

Code: Select all

Let>SK_DELAY=100
Press Tab * 8 
Let>SK_DELAY=0
I thought about doing that and then I thought it might make it zero at some other point during the script run that I dont want it to be unless that is of course the default is normally zero and wont override something else as if never setting the SK_delay???
Just when you thought it was safe to go in the water........:evil:

User avatar
jpuziano
Automation Wizard
Posts: 1085
Joined: Sat Oct 30, 2004 12:00 am

Post by jpuziano » Mon Jan 14, 2013 8:27 pm

Hi Esabik,

Even though it is not explicitly stated anywhere in the Help File, I do believe that the default value of SK_DELAY if you do not set it yourself is 0.

Marcus:
- Can you verify this?
- I will also add a note in Sifter saying updating the Help File to state the default value of SK_DELAY might be helpful.

Thanks and take care
jpuziano

Note: If anyone else on the planet would find the following useful...
[Open] PlayWav command that plays from embedded script data
...then please add your thoughts/support at the above post - :-)

User avatar
JRL
Automation Wizard
Posts: 3518
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Mon Jan 14, 2013 8:31 pm

Its milliseconds... set it to zero for no delay.

User avatar
Marcus Tettmar
Site Admin
Posts: 7391
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Mon Jan 14, 2013 8:31 pm

By default is not set. There is no delay. You could therefore say it is zero but in fact it just isn't set. Which is probably why no mention of a default in the help.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

User avatar
Marcus Tettmar
Site Admin
Posts: 7391
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Mon Jan 14, 2013 8:36 pm

I'm wrong. The default is zero.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

User avatar
jpuziano
Automation Wizard
Posts: 1085
Joined: Sat Oct 30, 2004 12:00 am

Post by jpuziano » Mon Jan 14, 2013 8:55 pm

Sifter updated:
#59 - Update Help File to mention default value of SK_DELAY is 0 in Send, Press & System Variables topic

Thanks Marcus
jpuziano

Note: If anyone else on the planet would find the following useful...
[Open] PlayWav command that plays from embedded script data
...then please add your thoughts/support at the above post - :-)

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts