This is why I love seeing emails from Alan. While I might know most of this, I either never think to include it in my responses or it just doesn't occur to me that it applies. Maybe one day.... > Ooops, sorry Paul, I meant Paul! :) No problem! Paul
-----Original Message----- From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Alan Martin Sent: Tuesday, August 08, 2006 9:53 PM To: [email protected] Subject: Re: [power-pro] I must be blind... Hi Tom, In addition to all the good help Dave has provided, I would add: - your parameter "*PRTG*" looks like it could cause problems. - your command: *Keys {to "*welcome to PRTG*"} {enter} sends Space and Enter. For Enter only, it should be: *Keys {to Welcome to PRTG}{enter} with no space before {enter}. > My Word window's taskbar item started flashing at the same time... Maybe Word's caption included "PRTG" at the time. Were you reading some documentation such as "PRTG Manual.doc" or "PRTG Read Me.rtf"? Your script could go wrong in future if any other window has PRTG in its title, such as "PRTG_changes.txt - Notepad", or its log or inifile. You need a _unique_ window identifier, such as the complete caption without asterisks (asterisks add ambiguity and are not needed if you write the full title), or maybe the window class would be even better. Although that kind of argument is known as a caption "list", for Keys you want to be sure it is a list of one. :) Your second caption list parameter is probably unique: "Welcome to PRTG" but your first parameter "*PRTG*" is certainly not. You cannot be sure which window is being targeted by some of your commands. In particular, your second win.setfocus(win.handle("*PRTG*") is ambiguous because at least two windows contain "PRTG" after you have simulated an Enter in the first window to show the second. If you set a hotkey such as Win+i with command: Exec WindowInfo you could inspect each of the two target windows, while the second is waiting for you to press Enter, and read the classname of each, (the parent's class, middle item in row 5 in WindowInfo, is probably suitable) to substitute for ClassOne and ClassTwo in the following: "C:\Program Files\PRTG Traffic Grapher\PRTG Traffic Grapher.exe" wait.until (visiblewindow("c=ClassOne")) win.setfocus(win.handle("c=ClassOne")) *Keys {to c=ClassOne}{enter} wait.until (visiblewindow("c=ClassTwo")) win.setfocus(win.handle("c=ClassTwo")) *Keys {to c=ClassTwo}{enter} It was only the first parameter "*PRTG*" which worried me. The full title (no asterisks needed) is probably unique enough for the second window instead of "c=ClassTwo". *Keys {to Welcome to PRTG}{enter} BTW, I think the "captionlist" parameter in Keys {to captionlist} does not need quotes around the captionlist, though they don't seem to do any harm if included. Notice that I've switched the order in each of the pairs of lines (wait.until and set.focus), changing from your: > win.setfocus(win.handle("*PRTG*")) > wait.until (visiblewindow("*prtg*")) Surely you would focus a window after waiting until it exists rather than before :) ---------------------------------------------------------- After giving your commands more specific arguments, you may find that it works with only these three lines: "C:\Program Files\PRTG Traffic Grapher\PRTG Traffic Grapher.exe" *Keys {to +c=ClassOne}{enter} *Keys {to +c=ClassTwo}{enter} The extra "+" in the Keys command makes it wait (up to 3 seconds) until the target is ready to receive keystrokes, which should make wait.until and win.setfocus unnecessary. Maybe. [Non-text portions of this message have been removed] Attention: PowerPro's Web site has moved: http://www.ppro.org Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/power-pro/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
