pushButton bug?

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
BobDDstryr
Junior Coder
Posts: 38
Joined: Fri Oct 22, 2010 2:47 am

pushButton bug?

Post by BobDDstryr » Wed Dec 15, 2010 4:28 am

Hey guys,

I've found some strange behavior that puzzles me.

I'm doing scripting with Norton Ghost 2003 - and writing a script to restore an image. So - the very last normal window, Restore Wizard, is a summary, and has a button "Run Now," which is what it defaults to if you just hit enter. Upon hitting that button, a system window pops up with a yellow exclamation point, with the title "Norton Ghost" - it says "Norton Ghost is about to run a task that will restart your computer. Save your data and close all open applications before clicking ok.

So - my first script example:

setfocus>Restore Wizard
pushButton>Restore Wizard,Run Now
messagemodal>blaarg

the second is:

setfocus>Restore Wizard
press>Enter
messagemodal>blaarg

In the first example - where I've used "pushbutton" - the script gets stuck - nothing after that will run until I manually close the "Norton Ghost" system pop up - at which point it will then print blaarg

In the second example - where I've used "press Enter" - it will immediagely print "blaarg" likewise - if I replace the print message in each of those scripts with:

wait>5
WaitWindowOpen>Norton ghost
IfWindowOpen>Norton Ghost
setfocus>Norton Ghost
wait>1
pushButton>Norton Ghost,Cancel
else
messagemodal>Window didn't open!
endif

In the pushbutton example, it gets stuck just after the push button command - when I close the "Norton Ghost" window, if will THEN proceed, waiting 5 seconds, and then not finding the window (since I've had to close it)
In the second example, with press Enter - it waits 5 seconds, recognizes the window, hits enter, and everything works.

So - why is pushButton working differently than press>Enter, when they're both hitting the same button? Is this a known issue, with some system prompts? And is there anything that I could do here to continue using the pushbutton command, or should I just cave and use press>Enter?

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

Post by Marcus Tettmar » Wed Dec 15, 2010 6:09 am

PushButton works by sending a WM_CLICK message to the control - so it gets behind the user interface to try to avoid having to actually simulate sending keys to it. But we can't guarantee how an application will respond to this. The only method we can more or less guarantee is the sending keystrokes method since this simulates a user. In theory it should be possible to invoke the button by sending the WM_CLICK message. But the app could be doing something different/unusual. Who knows? We didn't write it. You just have to suck it and see. And if it doesn't work send keystrokes instead - or choose a different method.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

BobDDstryr
Junior Coder
Posts: 38
Joined: Fri Oct 22, 2010 2:47 am

Post by BobDDstryr » Wed Dec 15, 2010 7:33 pm

Alright; thanks.

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