Wrong Button Clicked

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
minchia
Newbie
Posts: 14
Joined: Tue Apr 28, 2009 8:33 am

Wrong Button Clicked

Post by minchia » Thu Apr 30, 2009 2:32 am

Hey All, having a problem where i'm not sure what the macro pro is clicking and i can't work out where it's getting the message box.

if u can see the image below, the menu option that's up there, i've not idea where it's come from. it happens randomly when running the macro and it the only thing stopping the macro for working properly.

i've tried stepping thru the code, but it doesn't happen when i do that.
i don't really know what else to do unless there is some type of Trace tool for windows that will hold everything that's opened at any given time.

any help is appreciated.
thanks


Image

gdyvig
Automation Wizard
Posts: 447
Joined: Fri Jun 27, 2008 7:57 pm
Location: Seattle, WA

Please include your code.

Post by gdyvig » Thu Apr 30, 2009 4:26 am

Hi Minchia,

It always helps to include the code near the problem. Several suggestions were offered for your previous thread, we don't know what you ended up with.

Intermittant problems or problems that go away when you run in debug usually indicate a timing problem. The script is getting ahead of the application. Adding wait statements can help you find where the timing problem is.

There is a trace selection in the debug menu that will step through the code at a pace you select and show how variable values are changing in the watchlist.

What is the title of the obscured window? Is it the same as the dialog you are attempting to send the alt-o to?

If you have a SetFocus for the dialog, precede it with a WaitWindowOpen statement. Errors and strange things can happen if the window is not ready when you do a SetFocus. That is because you are bypassing program edits and interfering with the program.

This should provide the necessary waittime.

Code: Select all

WaitWindowOpen>Open Pro-Planner MSG Attachment
SetFocus>Open Pro-Planner MSG Attachment
//send the keystrokes to the window
//Alt-o is the same as clicking the "Open File" button

If you are doing a MouseMove and a click, add a wait statement after the MouseMove so you can see the cursor.

Hope this gets you going again,

Gale

minchia
Newbie
Posts: 14
Joined: Tue Apr 28, 2009 8:33 am

Post by minchia » Thu Apr 30, 2009 5:03 am

Thanks Gale, I was looking into the waiting time and possible setfocus ideas. I'm not sure where in the code it is happening as it could be just after i open the e-mail or just before it closes.

the title of the hidden window is usually the subject of the e-mail, so it's always going to be different. i have a waitscreenimage on the envelope to be sure it only starts going when that appears.

i'm going to have a play around with longer wait times and setfocus and see if it helps.

Code: Select all

Let>k=1
Label>start
Let>WSI_TIMEOUT=18.5
ReadLn>c:\\\PP5\\\OpenMsgAttachment\\\MsgAttachmentIDs.txt,k,line
StringReplace>line, ,,tmpline
If>line=##EOF##,finish
run>C:\PP5\OpenMsgAttachment\OpenMsgAttachment.exe %tmpline%
WaitScreenImage>C:\PP5\OpenMsgAttachment\MsgProg.bmp,20
send> ALT + o

WaitScreenImage>C:\PP5\OpenMsgAttachment\button.bmp,20
//WaitScreenImage>C:\PP5\OpenMsgAttachment\button2.bmp,20

If>WSI_TIMEDOUT=TRUE
GoTo>Main
else
GoTo>Main
endif

label>Main
PRESS ALT
send>fa
release ALT
    
WaitWindowOpen>Save As
wait>0.5

//choose the MSG extension
press tab
send>oo
release tab
press enter
release enter

//tab to filename
press Shift
send>tab
release shfit
send> C:\PP5\OpenMsgAttachment\MSG Files\doc%tmpline%
press enter
release enter
wait>1

//if file exists, override
IfWindowOpen>Microsoft Office Outlook, override

//close MSG file
press ALT
Press F4
Release ALT
release F4
wait>5

//close attachment
press ALT
send>e
Release ALT

//endif

Let>k=k+1
Goto>start

label>override
press alt
send>y
release alt
press enter
release enter
wait>2

label>finish
MessageModal>Finsihed.
Exit>0

minchia
Newbie
Posts: 14
Joined: Tue Apr 28, 2009 8:33 am

Post by minchia » Thu Apr 30, 2009 6:27 am

Thanks for the help Gale, playing around with the SetFocus and Wait Time has fixed the issue. Now i just have to optimise it a bit more.

Cheers

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