Jump to content

Unable to WinWait/ControlSend for a program that's been hidden using SW_HIDE


Recommended Posts

Hey, I've searched over about 40 pages of results for this topic, but can't find an answer.

I'm ALMOST done!! I'm making a program that auto-installs a program. And I want to have it hidden from the user during installation. Smoke helped me figure that part out. But once it's hidden, it seems like the program either can't WinWait for a Window that I just hid.... or it can't send a control to a window that's been hidden.

Run ("C:\Program Files\CrewKit\CDevKit\CDevKitinstall.exe")
WinWait("CDevKit Setup", "Welcome to CDevKit Setup Wizard")
TrayTip("", "Step1", 5)
$hWnd = WinGetHandle("CDevKit Setup", "Welcome to CDevKit Setup Wizard")
WinSetState($hWnd, "",@SW_HIDE)
ControlSend("CDevKit Setup","","&Next >","{SPACE}")
;WinActivate($Window)
WinWait("CDevKit Setup", "License Agreement")
TrayTip("", "Step2.", 5)
ControlFocus ("CDevKit Setup" , "" , "Button9")
ControlSend ("CDevKit Setup" , "" , "Button9" , "{SPACE}")
ControlSend("CDevKit Setup","","&Next >","{SPACE}")
WinWait("CDevKit Setup", "Options")
TrayTip("", "Step3", 5)

It always displays Step1 in the traytip... so I know it can't get to Step2.

Link to comment
Share on other sites

  • Moderators

Are you sure the text doesn't change when you toggle to different windows?

Is it a child window?

You may look at Opt('WinSearchChildren', 1) and Opt('WinDetectHiddenText', 1) (Just in case it has hidden text.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

I'm not sure.... When I ran the Window Tool from Autoit, I got this when it was visible...

Press CTRL-ALT-F to freeze the display.

>>>>>>>>>>>> Window Details <<<<<<<<<<<<<
Title:  CDevKit Setup
Class:  #32770
Size:   X: 517  Y: 499  W: 539  H: 386

>>>>>>>>>>> Mouse Details <<<<<<<<<<<
Screen: X: 824  Y: 861
Cursor ID:  2

>>>>>>>>>>> Pixel Color Under Mouse <<<<<<<<<<<
RGB:    Hex: 0xEBE9ED   Dec: 15460845

>>>>>>>>>>> Control Under Mouse <<<<<<<<<<<
Size:       X: 255  Y: 317  W: 68   H: 24
Control ID: 1008
ClassNameNN:    Button1
Text:       &Next >
Style:      0x58010000
ExStyle:        0x00000004
(Control is disabled)

>>>>>>>>>>> Status Bar Text <<<<<<<<<<<


>>>>>>>>>>> Visible Window Text <<<<<<<<<<<
&Next >
< &Back
C&ancel
License Agreement
TERMS AND CONDITIONS

;;License Removed to Keep it Short
I a&ccept the agreement

>>>>>>>>>>> Hidden Window Text <<<<<<<<<<<
Step 2 / 4
Welcome to CDevKit Setup Wizard
This application is about to install the CDevKit Network Tools on your computer. To continue, click Next.
Options

And this after I hid it...

Press CTRL-ALT-F to freeze the display.

>>>>>>>>>>>> Window Details <<<<<<<<<<<<<
Title:  CDevKit Setup
Class:  #32770
Size:   X: 517  Y: 499  W: 539  H: 386

>>>>>>>>>>> Mouse Details <<<<<<<<<<<
Screen: X: 811  Y: 857
Cursor ID:  5

>>>>>>>>>>> Pixel Color Under Mouse <<<<<<<<<<<
RGB:    Hex: 0xFFFFFF   Dec: 16777215

>>>>>>>>>>> Control Under Mouse <<<<<<<<<<<
Size:       X: 255  Y: 317  W: 68   H: 24
Control ID: 1008
ClassNameNN:    Button1
Text:       &Next >
Style:      0x58010000
ExStyle:        0x00000004
(Control is disabled)
(Control is hidden)

>>>>>>>>>>> Status Bar Text <<<<<<<<<<<


>>>>>>>>>>> Visible Window Text <<<<<<<<<<<

>>>>>>>>>>> Hidden Window Text <<<<<<<<<<<
&Next >
< &Back
C&ancel
Step 2 / 4
Welcome to CDevKit Setup Wizard
This application is about to install the CDevKit Network Tools on your computer. To continue, click Next.
License Agreement
TERMS AND CONDITIONS
;;Removed for Space
I a&ccept the agreement
Options
Edited by CrewXp
Link to comment
Share on other sites

  • Moderators

ControlSend("CDevKit Setup","","&Next >","{SPACE}")

I just scrolled up and noticed that quickly (didn't look through the rest when I saw it).... That's not the ControlID or the ClassNameNN :whistle:

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

lol.... I wonder why it worked...? The Control Send command works when it's active with the code above, and for some reason, it works when it's hidden too. I paused my script before I un-hide commanded it, and it was already on Step2. It just couldn't detect the window. lol.

Edited by CrewXp
Link to comment
Share on other sites

Okay, I just saw that "Welcome to CDevKit Setup Wizard" in my WinWait command is seen in the "Hidden Text" field after using SW_HIDE on the window... Before it was in the "Visible Text" area. Is there any way to work around that? WinWaitActiveHidden.. or something?

I can usually think of something right about now, but am brain dead from coding the rest of my script. I can't really use the Opt code you posted above, because I'm not really sure how that will help me. It detects Hidden Text, but I'm pretty sure the text will be hidden the whole time after using SW_HIDE.... so it can't really wait for the Window that way.

Augh!! I'm stuck.

Link to comment
Share on other sites

  • Moderators

Opt('WinDetectHiddenText', 1)

Try that at the top of your script.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...