WaitWindowOpen>WordPad* & setfocus>WordPad* ?

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
Hades_UK
Newbie
Posts: 4
Joined: Thu Jun 26, 2003 9:27 pm
Location: UK
Contact:

WaitWindowOpen>WordPad* & setfocus>WordPad* ?

Post by Hades_UK » Mon Jun 30, 2003 7:57 am

Hi,
I seem to be getting inconsistant results with my macro script,somtimes it works flawlessly,sometimes it needs me to click a window for it,and sometimes it goes out of control,opening anything it can ...so my question is ,can my code be modified to make it work more consistent

What i need the script to do.....
Modify 30 different text files changing Caps as it goes (find@replace),then save and exit,then open the next...and so on
So currently i open the uk01-30_statistics in WordPad 30 times over (i have 30 WordPads up)

uk01_statistics.csv
uk02_statistics.csv
||
uk30_statistics.csv

SCRIPT>>>>>>>>>>>>>>>>>


Let>WW_TIMEOUT=10
let>go=1
label>01
WaitWindowOpen>WordPad*
If>WW_RESULT=FALSE,Error
WindowAction>2,WordPad*
setfocus>WordPad*
label>start
press ctrl
send>h
release ctrl
press alt

\//\\//\\//\\//\\//\\/

press enter
let>go=go+1
if>go=31,Done
goto>01
Label>Error
Message>Error Processing File
goto>Stop
Label>Done
Message>All files complete
label>Stop
Message>Done



Thanks


John

Lumumba

Post by Lumumba » Mon Jun 30, 2003 12:15 pm

Code: Select all

.
.
.
release ctrl 
press alt 
.
.
.
Where's the Release Alt command?

Hades_UK
Newbie
Posts: 4
Joined: Thu Jun 26, 2003 9:27 pm
Location: UK
Contact:

I Just pasted part of the code

Post by Hades_UK » Mon Jun 30, 2003 12:29 pm

\//\\//\\//\\//\\//\\/ = The break in the code..sorry about that,did`ent make it very clear,but i did not wanna paste the whole thing up,because 90% of it works fine (the find&replace bit)its just the gettting the correct window focus i was having problems with.


John

Lumumba

Post by Lumumba » Mon Jun 30, 2003 2:50 pm

WordPad's window title for uk01_statistics.csv should be: uk01_statistics.csv - WordPad. Correct?

I've changed a little in your code (assume you've already done it the same way, but not provided it).

Code: Select all


Let>WW_TIMEOUT=10 
let>go=0

label>01 
let>leadingzero=0
Add>go,1
Length>%go%,golen
If>golen>1,WordPading
ConCat>leadingzero,%go%
Let>go=%leadingzero%

Label>WordPading
Run Program>wordpad uk%go%_statistics.csv
WaitWindowOpen>uk%go%_statistics - WordPad
If>WW_RESULT=FALSE,Error 
WindowAction>2,uk%go%_statistics - WordPad
setfocus>uk%go%_statistics - WordPad
label>start 
press ctrl 
send>h 
release ctrl 
press alt
.
.
.
:!:
you've to delete this line: let>go=go+1
cause it's already done by that: Add>go,1

Hades_UK
Newbie
Posts: 4
Joined: Thu Jun 26, 2003 9:27 pm
Location: UK
Contact:

Top Stuff Lumumba

Post by Hades_UK » Mon Jun 30, 2003 3:46 pm

That works an absolute treat now,heck it even opens wordpad for me.
I would luv to say i was gonna come up with a similiar solution,given the time...but alas i that would be a lie

Thanks

John

Lumumba

Post by Lumumba » Tue Jul 01, 2003 7:04 am

Hope you don't close 30 windows manualy?!

Therefore there should be a CloseWindow>uk%go%_statistics - WordPad in your code (right after were you've finished the editing of that file).

But that's still the case, right? :wink:

BTW: Set Let>RP_WINDOWMODE=2 right before you run wordpad so you can get rid of the following WindowAction>command as well.

Hades_UK
Newbie
Posts: 4
Joined: Thu Jun 26, 2003 9:27 pm
Location: UK
Contact:

Close all 30 Wndows??

Post by Hades_UK » Tue Jul 01, 2003 7:40 am

As for closing all 30 wordpads,i just use a CTRL S,ENTER,then ALT F and ALT X commands,(i still aint got past the point of seeing Macro Schuler as a thing for just pressing keyboard shortcuts yet :roll:

Anyways big thanks for your guidance on more graceful,effective and generally much better code writing,but working SMART goes against my philosophical approach to life,why work smart,when u can work hard..and working SMART has never been a strong point 4 me :(

Lumumba

... replace one string with another throughout a file

Post by Lumumba » Tue Jul 01, 2003 12:20 pm

To work even smarter (combined with MSched's Run Program>command).

The CommandLine Commando

The CommandLine Commando is the first release of a growing collection of FreeWare Utilities for Windows 9X/NT. These are primarily utilities
ported from the 16 bit DOS World and the majority of these utilities are
32 Bit except where the 32 bit calls are unsupported. The 32 bit
utilities handle Long File Names and the Long CommandLine.

These utilities include many filters and other text processing commands
as well as file and text search utilities.

The WIN9X/NT filters
--------------------

Basename | gets basename from filename.
Decho | echoes standard input to screen (great for debugging).
Dict | puts each word of a file onto a separate line.
Lcase | translate all uppercase characters to lowercase.
Numbey | number all the lines in a file.
Onespace | removes extra blank lines from a file.
Pad | pad each line in a file to a fixed length.
Strip | create comments file from a c source code file.
Sub | replace one string with another throughout a file.
Sum | add columns of numbers from a redirected file.
Trim | trim trailing blanks from each line in a file.
Truncate | truncates a line at first matching char (or space).
Ucase | translate all lowercase characters to uppercase.
Uniq | deletes multiple occurances from a sorted list.
Untab | expand all tabs in a file to blanks.
Unws | translate a wordstar document to plain text.
Xtodos | translate Unix text or Apple Text to DOS text.

The WIN9X/NT "almost filters" and utilities
-------------------------------------------

Bingrep | a grep (text search) for binary files.
Ffeed | reads a filespec and sends files to standard output.
Grabasc | a tsr ascii text screen capture utility.
Hexval | create character arrays from binary files.
Idiff | compare 2 textfiles and report differences.
Igrep | a grep (text search) for text files.
Longtext | remove wordwrap from textfiles (DOS to Windows Text).
Mloc | count lines in text files and report totals.
Modeget | get video mode.
Modeset | set video mode.
Newfiles | create list of files modified after specified date.
Pipecon | pipe the console to a diskfile.
Touch | modify file dates and times.
Txt2pcx | convert ascii text to monochrome .PCX image.
Unfeed | undo a lumped file created by ffeed into single files.
Whereis | search the harddisk for files specified.
Which | search the environment for the specified file.
Wraptext | add wordwrap to textfiles (Windows to DOS Text).
Yesno | batchfile extension to allow yes/no questions.

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