Entering a file name in an Export window

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
grrgold
Newbie
Posts: 3
Joined: Tue Aug 16, 2011 1:04 pm

Entering a file name in an Export window

Post by grrgold » Tue Aug 16, 2011 4:43 pm

I am trying to create a simple script that exports a report to a .txt file every night.
I have gotten as far as generating the report, however when the Export To dialogue appears I am having problems filling in the File Name field. I have tried everything from using a SetFocus> and Send> combination, and have even tried moving the mouse and clicking the filed to activate it. For some reason the file name variable doesn't seem to be going to the File Name field in the window

Here is my code so far:

Code: Select all

//Set IGNORESPACES to 1 to force script interpreter to ignore spaces.
//If using IGNORESPACES quote strings in {" ... "}
//Let>IGNORESPACES=1

//Make Aptus the active application
SetFocus>Aptus*
Wait>1

//Open the Checkin report
Press ALT
Wait>1
Send>rm
Wait>1
Press Right
Wait>1
Send>cc
Wait>1
Press Enter
Wait>1

//Click the Refresh Button to create the report
GetScreenRes>sX,sY
FindImagePos>C:\Users\joe.000\Documents\Macro Scheduler 12\bitmaps\Refresh button.bmp,SCREEN,0,1,X,Y,NumFound
If>NumFound>0
    MouseMove>X_0,Y_0
Endif
Wait>1
LClick
Wait>2

//Find and click the Report menu to export email addresses
GetScreenRes>sX,sY
FindImagePos>C:\Users\joe.000\Documents\Macro Scheduler 12\bitmaps\Report button.bmp,SCREEN,0,1,X,Y,NumFound
If>NumFound>0
    MouseMove>X_0,Y_0
Endif
Wait>1
GetCursorPos>Xpos,Ypos
Let>Ypos=Ypos+50
MouseMove>Xpos,Ypos
Wait>2
LClick

//Entere file name to save exported email addresses
Wait>5
Year>YearV
Month>MonthV
Day>DayV
Let>FilenameV=checkin_
ConCat>FilenameV,YearV,MonthV,DayV
Let>PathV=c:checkin
SetFocus>Export*
Let>SK_DELAY=10
SendText>PathV
SendText>FilenameV
Press ENTER
Wait>5


adroege
Automation Wizard
Posts: 438
Joined: Tue Dec 07, 2004 7:39 pm

Post by adroege » Tue Aug 16, 2011 8:29 pm

SetFocus>Export*
Let>SK_DELAY=10
What I might suggest is:

on the SetFocus command try to use more of the window title and eliminate the asterisk (if possible) this avoids the issue of multiple windows matching and the focus being given to the wrong one.

Also you may need to experiment with the WF_TYPE variable settings
also prior to issuing the setfocus command.

Put a wait>0.5 after the setfocus

I would also increase the SK_DELAY to a larger value maybe 50 or more.


If these fail to help, use the debugger and step with F8 line by line through the script to see what is happening.

Good luck.

grrgold
Newbie
Posts: 3
Joined: Tue Aug 16, 2011 1:04 pm

Post by grrgold » Wed Aug 17, 2011 9:09 pm

@adroege

thank you for your suggestions. I tried them with no success... however, you indirectly helped me.
I set the SK_DELAY as high as 500 and that allowed me to notice that the SEND was going to the wrong control. Once I figured out the name of the correct control on in the window i was able to use a SetControlText> instead and it did the trick

thanks! :D

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