saving window titles as varibles, how do i do it?

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
Killerworm51

saving window titles as varibles, how do i do it?

Post by Killerworm51 » Thu Jun 10, 2004 1:10 am

Ok, first I want to get my script to save the active windows title as new_title

then i want the script to check if new_title=old_title and if it does then it goes back to the start of the script (@start)

then i want it to get the name of the active window and save the title of it as new_title.



thanks :)

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Thu Jun 10, 2004 4:42 am

You want to use the GetActiveWindow> command.

This will get the name of the currently active window and store it in a variable. You can optionally include variables for the width and height also. You can also use LET>GAW_TYPE=1 to get the name of the active child window. Default for GAW_TYPE=0 so you will normally get the name of the active parent window.

Basic sample of comparing windows:
Label>Stuff
GetActiveWindow>Window1
Wait>300
GetActiveWindow>Window2
If>%Window1%=%Window2%,Start,NotSame

Label>NotSame
Do Other Stuff
....
....

Label>End
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

Killerworm51

Post by Killerworm51 » Thu Jun 10, 2004 9:44 am

Thank you for trying to help, but it thinks that window1 and window2 are the same :S

ill post my script, basically it just clicks a link to go to a random picture on a website and then comments on it. the windows title is always in the format of "WebsitesName: *Name of picture here*" so the name of the website is always in the title bar. When I use GAW and then get it to type out the name of the window it gives me '0'

"••" is just notes trying to help you understand my script


Label>Absolute
let>counter=1
Label>Start
••This part Clicks on a link to the webpage••
MouseMove>1016,100
LClick
Wait>1
MouseMove>938,125
LClick
Wait>7
••end click link••
IfWindowOpen>404*,Start
GetActiveWindow>Window1
If>%Window1%=%Window2%,Start,NotSame
Label>NotSame
••Finds text next to text box and then clicks on text box
Press CTRL
Send Character/Text>f
Release CTRL
Wait>0.2
Send Character/Text>emoticon legend
Wait>0.5
Press Enter
Wait>0.2
MouseMove>624,394
Wait>0.2
LClick
MouseMove>492,590
LClick
Wait>0.2
••end find text••
if>counter=1,1
if>counter=2,2
if>counter=3,3
••some if>counters removed from here••
if>counter=25,25
if>counter=26,26
if>counter=27,27
if>counter=28,28
label>1
Send Character/Text>excellent work :)
goto>adding
label>2
Send Character/Text>wow, i really like this :)
goto>adding
••more comments in here (labels 3-26) removed cause theres so many••
label>27
Send Character/Text>this is so good i could eat it for dessert :D
goto>adding
label>28
Send Character/Text>if this wasnt digital media i would have eaten it by now :P
goto>adding
label>adding
add>counter,1
GetActiveWindow>Window2
••submits the text
Press Tab
Press Enter
••
if>counter=29,Absolute
Wait>3
Goto>Start




thank you :)

Killerworm51

Post by Killerworm51 » Sat Jun 12, 2004 10:58 am

any ideas? :P

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