Sign in to follow this  
Followers 0
SBASS

Detect Hidden Text

8 posts in this topic

Hi,

I was wondering if anyone can offer some assitance... I have looked at the help file and on the site here and can't work out what I need in order to use the detect hidden text option in a message box.

I am trying to automate an installation which has 3 dialog boxes that appear;

The 1st box has a title so is easy enough,

The 2nd box, is a progress bar (from WISE) and has no Window title but does have hidden text.

The 3rd box has a title so is easy enough,

I am trying to script it so that while the 2nd box progress box is on the the screen, the script will wait/sleep until the 3rd box appears, but as I cannot identify the 2nd progress box I am unsure how to tell the script what to wait for before it moves on.

I can use sleep for x amount of time but this is unrelaible as the install takes longer on some PC's as opposed to others.

I have created a While Loop that works on other scripts that have windows titles and I no that you can enable the Detect Hidden Text option, but the big question I have is how do I use that in cunjunction with say a WinExists or WinWaitActive Command?

Hope that makes sense? Any help would be greatly appreciated :-)

###

Opt("WinDetectHiddenText", 1);0=don't detect, 1=do detect

ShellExecute("C:\Windows\EUS\UK Audit\Install Groove SMS Package.exe")

Do

Until WinExists("Groove Virtual Office")

WinWait("Groove Virtual Office")

WinActivate("Groove Virtual Office")

Send("{ENTER}")

While WinExists("[TITLE: ];[CLASS:Static];[iNSTANCE:1"],"") ;This is where I cannot ID the Window

Sleep (36000)

WEnd

Do

Until WinExists("Groove Virtual Office Installation")

WinWait("Groove Virtual Office Installation")

WinActivate("Groove Virtual Office Installation")

Send("{ENTER}")

Exit

The script is simple, just the hidden text bit is a pain.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

I'm missing the problem. Does it not work if you get rid of the Sleep(36000) and just have it wait for the 3rd window? Identifying the 2nd is not necessary if it disappears before the 3rd spawns.

You also don't want to sleep for 36 seconds inside of a loop. You should set the sleep to 250 or 500ms, otherwise you've got a potential 36 second wait before that loop exits when the window no longer exists.

Edited by Airwolf

Certifications: A+, Network+, Security+, Linux+, LPIC-1, MCSA | Languages: AutoIt, C, SQL, .NETBooks: AutoIt v3: Your Quick Guide - $7.99 - O'Reilly Media - September 2007-------->[u]AutoIt v3 Development - newbie to g33k[/u] - Coming Soon - Fate Publishing - Spring 2013UDF Libraries: SkypeCOM UDF Library | ADUC Computers OU Cleanup | Find PixelChecksumExamples: Skype COM Examples - Skype4COMLib Examples converted from VBS to AutoIt

Share this post


Link to post
Share on other sites

Sorry I wrote that all wrong got myself in a bit of a muddle...

What I was suppsoe to say is that the 2nd Progess bar/box has the same title as the 3rd message box, so without the sleep the script thinks the 2nd box is the 3rd and processes the command.

What I should have said I am trying to do is, get the Hidden Text from the 2nd box so I can identify it using that as opposed to the Window title, but I dont understand how to identify the window other than using the title...

This line is not working for me While WinExists("[TITLE: ];[CLASS:Static];[iNSTANCE:1"],"")

I was just trying various things from the help to get what I needed.

Apprecaite if you can advise?

Share this post


Link to post
Share on other sites

I've never been a fan of using keyboard or mouse input during installation routines, as a user will always figure out a way to interrupt the script. Is there a silent installation command for the application?

If not, is there any identifiable progress bar text that stays constant or is it just a blank progress bar? If there is something like "Installing..." on the progress bar, you could always identify the window by WinExists("Groove Virtual Office","Installing...").


Certifications: A+, Network+, Security+, Linux+, LPIC-1, MCSA | Languages: AutoIt, C, SQL, .NETBooks: AutoIt v3: Your Quick Guide - $7.99 - O'Reilly Media - September 2007-------->[u]AutoIt v3 Development - newbie to g33k[/u] - Coming Soon - Fate Publishing - Spring 2013UDF Libraries: SkypeCOM UDF Library | ADUC Computers OU Cleanup | Find PixelChecksumExamples: Skype COM Examples - Skype4COMLib Examples converted from VBS to AutoIt

Share this post


Link to post
Share on other sites

A few things...

  • You say that the 2nd and 3rd boxes have the same title. If it's "Groove Virtual Office Installation", then why are you looking for "[TITLE: ]" ?
  • Second, if the 2nd box is destroyed before the 3rd appears, then they won't overlap and the 3rd will also be "[iNSTANCE:1]".
  • Do...Until WinExists uses unneccesary cycles. Replace it with WinWait.
  • Ditto what Andy said about Send. If it's a button, use ControlClick instead.
Handles are more reliable than titles. Try this...
Opt("WinDetectHiddenText", 1);0=don't detect, 1=do detect

ShellExecute("C:\Windows\EUS\UK Audit\Install Groove SMS Package.exe")

WinWait("Groove Virtual Office")
WinActivate("Groove Virtual Office")
Send("{ENTER}")

WinWait("Groove Virtual Office Installation") ; Wait for 2nd Box to appear
WinWaitClose(WinGetHandle("Groove Virtual Office Installation")) ; Wait for 2nd Box to close

WinWait("Groove Virtual Office Installation") ; This should be the 3rd box.
WinActivate("Groove Virtual Office Installation")
Send("{ENTER}")
Exit

[font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font]

Share this post


Link to post
Share on other sites

Thanks guys - both of you were very helpful

The amended code Skruge supplied did the job perfect for me, nice work. I had never used the WinWaitClose WinGetHandle option before but will make use of this more often for this type of thing.

Out of intrest, just for future ref, do either of you no how to make use the hidden text option... I no how to enable it but not sure how to read it and make use of what is read?

If not no worries, I really apprciated the help.

Thanks again

Share this post


Link to post
Share on other sites

Out of intrest, just for future ref, do either of you no how to make use the hidden text option... I no how to enable it but not sure how to read it and make use of what is read?

If the option is enabled, then hidden text just behaves the same as visible text.

You can extract it with WinGetText, and you can search for it in the text parameter of most Window functions.

A good example to play with is the "System Properties" dialog in WinXP. The text on the active tab is visible and the rest is hidden.


[font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font]

Share this post


Link to post
Share on other sites

Thanks again mate. Much apprciated

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0