Send>filename to Save as

Hints, tips and tricks for newbies

Moderators: JRL, Dorian (MJT support)

Post Reply
marknunes
Newbie
Posts: 2
Joined: Fri Mar 01, 2013 3:46 pm
Location: United States, California

Send>filename to Save as

Post by marknunes » Fri Mar 01, 2013 5:20 pm

I am very new to Macro Scheduler but I am picking it up fast with the help of the sample codes.
I am trying a very simple code as it was listed with out total success.
Looking at the code listed below everything works as expected until the Send>filename command for the Save as window. The Send command never executes so the Save As window keeps the focus with out populating the file name or the Press Enter command.
I kept the code as basic as possible to test the function.
Any ideas?

Code: Select all

Let>filename=C:\sample.txt

Run>Notepad.exe
WaitWindowOpen>Untitled - Notepad

Let>firstline=This is the first line
Let>secondline=This is line two.
Let>thirdline=This is the third and final line.
Let>entiretext=%firstline%%CR%%secondline%%CR%%thirdline%

Send>entiretext

Press Alt
send fa
Release Alt
WaitWindowOpen>Save As

IfFileExists>filename
    DeleteFile>filename
Endif

SetFocus>Save As
Send>filename
Press Enter
Mark Nunes

marknunes
Newbie
Posts: 2
Joined: Fri Mar 01, 2013 3:46 pm
Location: United States, California

Solution Found

Post by marknunes » Fri Mar 01, 2013 6:24 pm

I have been doing some reading on the Macro Scheduler site. There is a lot of great information.
https://www.mjtnet.com/manual/index.htm ... alt-fa.htm

The problem was with the "WaitWindowOpen>Save As" command. It states in the WaitWindowOpen description that -
It is best to try to provide an exact (including case) window title to ensure the correct window is found, as many applications have multiple invisible windows with similar names.
To solve for this you can determine what kind of window you are waiting for.
Let>WF_TYPE=0 - No Child Windows
Let>WF_TYPE=1 - ALL Windows (Default)
Let>WF_TYPE=2 - Visible Windows Only
Let>WF_TYPE=3 - Child Windows Only
I inserted the statement Let>WF_TYPE=2 To wait for a visible window.
This corrected my problem and the script ran as expected.
Mark Nunes

User avatar
Rain
Automation Wizard
Posts: 550
Joined: Tue Aug 09, 2005 5:02 pm
Contact:

Post by Rain » Fri Mar 01, 2013 9:32 pm

Use WriteLn instead.

Code: Select all

Let>filename=C:\sample.txt
Let>firstline=This is the first line
Let>secondline=This is line two.
Let>thirdline=This is the third and final line.
Let>entiretext=%firstline%%CRLF%%secondline%%CRLF%%thirdline%
WriteLn>%filename%,r,%entiretext%

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