Locating the File Name Field in a Save As window?

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
RNIB
Macro Veteran
Posts: 159
Joined: Thu Jan 10, 2008 10:25 am
Location: London, UK

Locating the File Name Field in a Save As window?

Post by RNIB » Wed Mar 16, 2016 3:30 pm

Is there an easy way of locating the file name field in a Save As dialogue window?

I'm trying to write something that automatically loads files from a specificed folder and then saves them to another specified folder. To do this I want to enter the full path and file name into the file name field but I can't find a way of doing that which works on all PC's and screen resolutions and when the window has been moved to a different area of the screen. I was trying to do it via Tabbing but the tab order in this program changes depending on what you last did in the program.

RNIB
Macro Veteran
Posts: 159
Joined: Thu Jan 10, 2008 10:25 am
Location: London, UK

Re: Locating the File Name Field in a Save As window?

Post by RNIB » Wed Mar 16, 2016 3:39 pm

Ahh fixed it. Guess it would help if I looked at the shortcuts! :oops:

Jerry Thomas
Macro Veteran
Posts: 267
Joined: Mon Sep 27, 2010 8:57 pm
Location: Seattle, WA

Re: Locating the File Name Field in a Save As window?

Post by Jerry Thomas » Wed Mar 16, 2016 6:46 pm

A lot of the time, you can use the 'FindObject Wizard' (under Window Objects) and get the code to do it a little more reliably.

It is usually something like this example for NotePad
UISetValue>{"Open"},{"File name:"},{"MyFile.txt"}
Thanks,
Jerry

[email protected]

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

Re: Locating the File Name Field in a Save As window?

Post by Marcus Tettmar » Thu Mar 17, 2016 9:04 am

In my many years of experience I have never had to locate the filename box in a Save As window because it already has the focus. And the button is the default button so all I have ever had to do is:

Code: Select all

WaitWindowOpen>Save As
SetFocus>Save As
Send>the_filename
Press Enter
WaitWindowClosed>Save As
Often it helps to slow down the keysend rate and maybe add a couple of small waits:

Code: Select all

Let>SK_DELAY=30
WaitWindowOpen>Save As
SetFocus>Save As
Wait>0.2
Send>the_filename
Wait>0.2
WaitWindowClosed>Save As
Press Enter
Don't over complicate things and get hung up with objects and handles and all that unless you REALLY need to. In 20 years I've NEVER had to do that for a regular Windows Save As box!!
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

RNIB
Macro Veteran
Posts: 159
Joined: Thu Jan 10, 2008 10:25 am
Location: London, UK

Re: Locating the File Name Field in a Save As window?

Post by RNIB » Thu Mar 17, 2016 11:30 am

saveAs.png
This is the Save As Window that opens.

Every single time when the window opens the focus is in the area highlighted blue where it lists the Free Space. There is zero reason for the focus to be there especially as you can't even enter anything in that area. It makes no sense but that's how it is. :shock:

I'll have a look at the FindObjectWizard.

Many Thanks

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

Re: Locating the File Name Field in a Save As window?

Post by Marcus Tettmar » Thu Mar 17, 2016 11:58 am

Ok, I guess this is not a standard Windows Save As dialog then, or there's some customisation to it which is mucking up the focus. Never seen that pane before.
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