Open a file from the Open dialog Window

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
Capstan
Newbie
Posts: 3
Joined: Fri Dec 14, 2007 7:37 pm
Location: Vancouver, Canada

Open a file from the Open dialog Window

Post by Capstan » Tue Dec 18, 2007 10:09 pm

Hi
I'm new to Macro Scheduler and I'm trying to select File/Open File from an application menu and then select a file 'testSQL.sql' and click the Open button.
This is a snippet of what i have so far...
//Tab 7 times to get to the Connect button
Press Tab*7

//Click the 'Connect' button
Press Enter

//Open file 'SQL to test db connectivity.sql'
Let>SQLfilename=C:\Projects\testSQL.sql

//Open the Windows Open Dialog
Press ALT
Send>fo
Release ALT

Now how do I select the file and click the open button?

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

Post by Marcus Tettmar » Tue Dec 18, 2007 10:17 pm

Just send the filename to it and press enter:

Code: Select all

//Open file 'SQL to test db connectivity.sql'
Let>SQLfilename=C:\Projects\testSQL.sql

//Open the Windows Open Dialog
Press ALT
Send>fo
Release ALT

WaitWindowOpen>Open File
Send>SQLfilename
Press Enter
I assume here that the open dialog is called "Open File" - you may have to change that if the title is something different.

Usually however you can open a file in an app via the command line:

ExecuteFile>C:\Projects\testSQL.sql

Or

Run Program>c:\...\someapp.exe C:\Projects\testSQL.sql

Thus avoiding sending keystrokes to the file open dialog.

But that all depends on the app in question.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

Capstan
Newbie
Posts: 3
Joined: Fri Dec 14, 2007 7:37 pm
Location: Vancouver, Canada

Post by Capstan » Tue Dec 18, 2007 11:25 pm

Wow! I like the prompt reply on the post.
But now I'm having problem before it gets to File/Open File step

In more details:
1) I launch Toad for Oracle which pop-up two windows. The focus window is the one to enter the schema name, id etc then i click the connect button
2) After the connect that popup window goes away and the focus goes on the window at the back this is where I want to open my sql file from the menu


//Wait for Toad for Oracle Window to be ready
WaitWindowOpen>Toad for Oracle*
//Set focus on Toad for Oracle Window
SetFocus>Toad for Oracle*

//Open the Open File Dialog Window
Press ALT
Send>fo
Release ALT
//Open file 'SQL to test CMRIdb connectivity.sql'

I run the step in debugging and it's failing on getting focus on the Toad for Oracle Window. any idea!

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

Post by JRL » Wed Dec 19, 2007 12:52 am

I don' have your app so I can't test this but maybe there is another non-visible window that is also named "Toad for Oracle something something". Try using the exact name for the window you want focused and remove the asterisk from the setfocus line.

Eg.
//Wait for Toad for Oracle Window to be ready
WaitWindowOpen>Toad for Oracle
//Set focus on Toad for Oracle Window
SetFocus>Toad for Oracle

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