Reply to topic

Script :: Automating Application Entries
Eric Jones

Joined: 20 Jun 2007
Posts: 5
Reply with quote
I'm trying to automate the mundane task of starting up an app for daily job billing. The process takes a while. I can usually go get a cup of coffee while it starts. I get back and have a simple login to do, then wait for another window, then select a task and wait for that window, then enter my "ID" and the date.

//I've figured out how to kick off the application.

Shell.Execute("c:\90cs\Mas90\Home\pvxwin32.exe", "../launcher/sota.ini slave","C:\90cs\MAS90\HOME");

I think I lucked out on the Wait.ForEdit. This class seems hit or miss.
How does it know which window to wait for this edit control to show up in?
This piece seems to work the best out of the rest that follows, it breaks if I attempt to do anything else while it starts.



If figured out a few of the keystrokes needed. (doc not complete)

Keyboard.Send("EMJ {TAB}");

After the "{Alt-O}" I expect another window to appear, and I need to the follow tasks. This Wait.ForTree _RARELY_ works and I think it typically times out and does the keystrokes - long delay, not necessary, defeats purpose of automating. As you can see I try really hard to get the window's attention and it doesn't seem to matter.

I wonder if the Wait class ForTree is standard or not. The Class is TTreeView. Once it times out, the Keystrokes seem to work.


Window w = window.FindByName("MAS 90 Client/Server");


Keyboard.Send("{Alt-O} D");
Keyboard.Send("{Alt-M} 2");

This section _RARELY_ works. Same question, does the ForEdit NOT work for Style: 0x54800188 of Class: Edit? I've tried foreground, applicaiton, desktop...


Window y = window.FindByName("TimeCard Entry - New Entries Only");


These keystrokes _RARELY_ happen.

Keyboard.Send("50-EJONES {Enter}");

Can you see any gross errors? Do you have any hints? Can we have better error handling?
View user's profileSend private message
Logan Mueller

Joined: 16 Nov 2003
Posts: 565
Reply with quote
Hi Eric,

(1) Wait.ForEdit can be hit or miss situation but you can improve its accuracy by adding some extra code after this call to ensure that say the parent window is also correct, e.g. use FindByClass, FindByName, or FindByPos in the Window class after Wait.ForEdit() succeeds.

(2) You can increase the timeout value for Wait functions using Wait.SetWaitTime() if need be Smile

(3) If you want to use the internal error handling, call Wait.ShowFailures(true) and Wait.ExitOnFail(true) -- whichever suits your needs. Otherwise, consider using the File class or Gizmo.WriteDeskop function to log errors while the script is running

(4) The way Wait.ForEdit() works is that it looks for a window with the window class 'Edit' given the specified coordinates. If it is not working for you, check to make sure your coordinates are correct. I would suggest using coordinates relative to the window (e.g. [Focus]) if it is on a sub-dialog. If the control is on the main application window, then use [Application]. When getting your coordinates from the Window Analyzer, make sure that the window has focus (by clicking on that window) before using the coordinates reported by Window Analyzer for [Focus]

(5) Somewhere you mentioned "long delay, not necessary" I was wondering if you were referring to the delay between each keystroke, or the delay between each set of keystrokes you were sending. The reason I ask this is because you should not experience a delay between keystrokes and I noticed you had calls to Script.Sleep() between your calls to Keyboard.Send.

Support is provided as a convenience to our users. We make no guarantees in the timeliness and accuracy in our responses. We reserve the right to refuse service to anyone.
View user's profileSend private messageVisit poster's website
Script :: Automating Application Entries
All times are GMT - 8 Hours  
Page 1 of 1  


 Reply to topic