Find out or get window titles

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
rlcohen70
Newbie
Posts: 4
Joined: Wed Dec 13, 2006 5:23 am
Location: San Jose, CA.

Find out or get window titles

Post by rlcohen70 » Wed Dec 13, 2006 7:31 pm

I have a macro I want to run, yet the windo titles are extremely long. What is the best wayt o get an accurate name of the window title...
Here ar ethe examples. The seond exmaple includes quotation marks and also the | sign... I am using the WaitWindowOpen command..

Example 1.
status:Disconnected | VPN Client - Version 4.8.01.300
Challenges with spaces?? I had it working to the first window but then the program crashed...

Example 2.
VPN Client | User Authentication for "Company Name VPN"
When All Alse Fails...
Manipulate The Data......

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 » Wed Dec 13, 2006 8:31 pm

Use the GetActiveWindow(GAW) function.

From the Help:

GetActiveWindow>window_title,X,Y[,Width,Height]

Retrieves information about the current active window. The window title, and top left coordinates of the active window are stored in window_title, X and Y.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

rlcohen70
Newbie
Posts: 4
Joined: Wed Dec 13, 2006 5:23 am
Location: San Jose, CA.

Get Current Window Name??

Post by rlcohen70 » Wed Dec 13, 2006 9:54 pm

Could you help me with an example? .
This is the code I am using...

Let>Password = login password
Run Program>C:\Program Files\Cisco Systems\VPN Client\ipsecdialer.exe
WaitWindowOpen>status: Disconnected | VPN Client - Version 4.8.01.0300
Press CTRL
Send>o
GetActiveWindow>window_title,X,Y[,Width,Height]
WaitWindowOpen>window_title
Send>Password
Press Enter

It is the second window that opens up and has a title of something like..
VPN Client | Client Authentication for "Company Name"

My challenge is that when I get to the second window that opens up, it will not pass the password and hit enter. I assume it is the window name.
When All Alse Fails...
Manipulate The Data......

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 » Wed Dec 13, 2006 10:38 pm

See untested modifications

Let>Password=login password
Run Program>C:\Program Files\Cisco Systems\VPN Client\ipsecdialer.exe
WaitWindowOpen>status: Disconnected | VPN Client - Version 4.8.01.0300*
SetFocus>status: Disconnected | VPN Client - Version 4.8.01.0300*
Press CTRL
Send>o
Release CTRL
GetActiveWindow>window_title,X,Y
WaitWindowOpen>window_title
Send>%Password%
Press Enter
===========================
Comments:
Spaces will be incorporated as part of variables in Let> commands
Usually need to do a Release after a Press with CTRL/ALT/SHIFT, etc.
Use * with window names
Use % with variables, helps ID values in logs.
Need to set focus before doing Press/Send commands
May need to press TAB a few times before doing Send> commands
Do not include unused optional parameters, or if used, keep commas but remove brackets.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

rlcohen70
Newbie
Posts: 4
Joined: Wed Dec 13, 2006 5:23 am
Location: San Jose, CA.

Updated - Almost working

Post by rlcohen70 » Sun Dec 17, 2006 9:30 pm

So, I took your advice and read through a few things as well. I am now to the point when it works up until the last window. I have tried this a number of ways and still can't get it past this last step. Seems for such a simple script it takes a while to figure it out....
WaitWindowOpen>VPN Client | Banner*

I have tried GetActiveWindow, but no change......

Any help is appreciated....
Thanks for your help so far...

Code:
Let>Password=Password
Run Program>C:\Program Files\Cisco Systems\VPN Client\ipsecdialer.exe
WaitWindowOpen>status: Disconnected | VPN Client - Version 4.8.01.0300*
SetFocus>status: Disconnected | VPN Client - Version 4.8.01.0300*
Press CTRL
Send>o
Release CTRL
wait>2
WaitWindowOpen>VPN Client | User Authentication for "Company VPN"*
SetFocus>VPN Client | User Authentication for "Company VPN"*
Send>%Password%
Press Enter
wait>2
WaitWindowOpen>VPN Client | Banner*
SetFocus>VPN Client | Banner*

Press Enter
End Code
When All Alse Fails...
Manipulate The Data......

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 » Sun Dec 17, 2006 10:46 pm

What is happening/not happening?
What are the symptoms?

Can you provide a log along with your script?

What happens if you single step through the script?
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

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