Very basic query

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
paraic
Newbie
Posts: 4
Joined: Wed Jan 06, 2016 2:42 pm

Very basic query

Post by paraic » Wed Jan 06, 2016 2:54 pm

Hi
I just opened up the Beginner's Tutorial and ran into issues right away.
I am trying to Send the ALT f,ALT Release, a to open the Save As dialog in Notepad but for some reason it will not do it. So I tried the Send keystrokes wizard and it also failed. What it ends up doing is sending the letters f and a into the Notepad text as if it can't register the ALT key for some reason. (the last line: "This is the third and final linefa"
During the running of the macro I can intervene and do the ALT f,a myself and sure enough it continues and saves the file correctly. I really like the Macro Scheduler approach and the feature set looks great but its hard to recommend to my boss when I can't even finish the beginner's tutorial :D

Anyhow here is the code - any help appreciated!

Rgds
Paraic

Let>filename=c:\temp\newfile.txt
Let>SK_DELAY=20

IfFileExists>filename
DeleteFile>filename
Endif

run>notepad.exe
WaitWindowOpen>Untitled - Notepad
Send> this is the first line
Press Enter
Send>this is the second line
Press Enter
Send>This is the third and final line
Press Enter
GetWindowHandle>Untitled - Notepad,hWndParent
FindObject>hWndParent,Edit,,1,hWnd,X1,Y1,X2,Y2,result
ObjectSendKeys>hWnd,ALT_DN,f,ALT_UP,a
WaitWindowOpen>Save As
Wait>1
Send>filename
Press Enter
WaitWindowClosed>Save As

paraic
Newbie
Posts: 4
Joined: Wed Jan 06, 2016 2:42 pm

Re: Very basic query

Post by paraic » Wed Jan 06, 2016 3:16 pm

Well I solved my own problem but I found it unintuitive.
The Sending of the ALT key is actually pressing ALT, then f, then a then release ALT, which is not how it works when you do it manually.
Anyhow problem solved.

Press Alt
send>fa
Release Alt

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

Re: Very basic query

Post by Marcus Tettmar » Wed Jan 06, 2016 3:27 pm

When you press alt-f you have to hold down ALT only WHILE f is sent. So if you break this up you press ALT, then press F, then release ALT. ALT is a modifier key so it must be pressed and released WHILE other keys are pressed. F isn't a modifer key, it's a character, so it is sent.

Hope this helps.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

paraic
Newbie
Posts: 4
Joined: Wed Jan 06, 2016 2:42 pm

Re: Very basic query

Post by paraic » Wed Jan 06, 2016 7:31 pm

Thanks Marcus.
I also noticed you can't have spaces in the Send> command - I had " fa" instead of "fa" and that didn't work. Good to know.

Paraic

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

Re: Very basic query

Post by Marcus Tettmar » Thu Jan 07, 2016 1:18 pm

If you like spaces you can have spaces. See:
https://www.mjtnet.com/manual/index.htm ... spaces.htm
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
cron
Sign up to our newsletter for free automation tips, tricks & discounts