Macro not recognizing keystrokes

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
adunaway
Newbie
Posts: 11
Joined: Tue Sep 05, 2006 2:05 pm

Macro not recognizing keystrokes

Post by adunaway » Wed Jan 10, 2007 6:01 pm

We are writing a macro for a Remote Desktop Session Apllication and it is not reading certain keystrokes. The Macro is not recognizing the following functions: Press ALT, Press CTRL, and Press TAB. When we type the script and run a preview the macro just skips over these functions. I have even tried recording the keys and that does not work either. Is there something I am missing?

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

Post by Marcus Tettmar » Wed Jan 10, 2007 6:43 pm

Are you using SetFocus to make sure the correct window has the focus before the key sequences are sent? Perhaps it would help to see your script.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

adunaway
Newbie
Posts: 11
Joined: Tue Sep 05, 2006 2:05 pm

Post by adunaway » Fri Jan 12, 2007 4:19 pm

Yes we are using the correct SetFocus.

Here is the script we are using:

Change Directory>C:\Program Files\Prophet 21\CommerceCenter 10.5
Run Program>C:\Program Files\Prophet 21\CommerceCenter 10.5\pxxi.exe
Press Enter
Wait>5


***************
**LOCATION 101
***************
Press Alt
Send Character/Text>oo
Release Alt

Press Alt
Send Character/Text>rf
Release Alt

Send Character/Text>101
Press Enter

Press Tab
Press Tab
Press Tab
Press Tab
Press Tab
Press Tab
Press Tab
Press Tab

GetDate>the_date
Sub>the_date,3

MidStr>the_date,1,2,the_month
MidStr>the_date,4,2,the_day
MidStr>the_date,7,2,the_year

Send Character/Text>the_month
Send Character/Text>the_day
Send Character/Text>the_year

Press Alt
Send Character/Text>fp
Release Alt
Wait>2

Press Alt
Send Character/Text>n
Release Alt
Send Character/Text>\\network2\mc-manager

Press Tab
Press Tab

Press Enter

Press Alt
Send Character/Text>fn
Release Alt
Wait>30

**Exit Order Processing
Press ALT
Send Character/Text>fx
Release ALT

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

Post by Marcus Tettmar » Fri Jan 12, 2007 4:44 pm

adunaway wrote:Yes we are using the correct SetFocus.
Err, but you're not. There is not one SetFocus command in your script above. There is nothing to ensure the keystrokes land in the right place. Furthermore there is nothing to ensure the target window is active before the keys are sent. Your posted script is inherently unreliable and potentially dangerous.

Please read "Scripting Windows for Beginners" in the help file. It demonstrates use of SetFocus, WaitWindowOpen and other important concepts to ensure the creation of a reliable script.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

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