Jump to content

Window Controls Help


Recommended Posts

Greetings Scripting Gurus!

I am new to this facinating scripting language and am in need of some assistance. I am attempting to "control" an InstallShield uninstallation routine, by initiating the uninstall process (this is working) and responding to the dialogs that would be created/displayed throughout. Unfortunatley, I am having some difficulty with my scripts in controlling one of the dialogs that may or may not be displayed (depends upon if a file is found, locked ??). With that said, could someone review my script and let me know if I am completely missing the boat with this one? Here is the code in question:

If ($blnUninstallProduct = True) Then

; Execute the uninstallation process (InstallShield).

Run($oData)

;

AutoItSetOption("WinSearchChildren", 1)

; Wait for "MicroStation Setup" window (Modify, repair, or remove the program).

WinWaitActive("MicroStation Setup", "Modify, repair, or remove the program")

If (WinActive("MicroStation Setup")) Then

; Click on the 'Remove' radio-button.

ControlClick("MicroStation Setup", "", "[CLASSNN:Button3]")

; Click on the 'Next' button.

ControlClick("MicroStation Setup", "", "[CLASSNN:Button5]")

EndIf

; Wait for "Confirm File Deletion" window.

WinWaitActive("Confirm File Deletion", "", 5)

If (WinActive("Confirm File Deletion")) Then

; Click on the 'Yes' button.

ControlClick("Confirm File Deletion", "", "[CLASSNN:Button1]")

EndIf

; Wait for "Locked File Detected" window (five seconds maximum).

WinWaitActive("Locked File Detected", "", 5)

If (WinActive("Locked File Detected")) Then

; Click on the 'Don't display this message again.' check-box.

ControlClick("Locked File Detected", "", "[CLASSNN:Button1]")

; Click on the 'Reboot' button.

ControlClick("Locked File Detected", "", "[CLASSNN:Button5]")

EndIf

; Wait for "Shared File Detected" window.

WinWaitActive("Shared File Detected", "", 5)

If (WinActive("Shared File Detected")) Then

; Click on the 'Don't display this message again.' check-box.

ControlClick("Shared File Detected", "", "[CLASSNN:Button1]")

; Click on the 'Yes' button.

ControlClick("Shared File Detected", "", "[CLASSNN:Button2]")

EndIf

; Wait for "MicroStation Setup" window (Uninstall Complete).

WinWaitActive("MicroStation Setup", "Uninstall Complete", 5)

If (WinActive("MicroStation Setup")) Then

; Click on the 'Finish' button.

ControlClick("MicroStation Setup", "", "[CLASSNN:Button4]")

; Wait five seconds.

Sleep(5000)

; Reboot system.

; Shutdown(2)

EndIf

EndIf

Any and all help will be greatly appreciated. Many thanks in advance.

Link to comment
Share on other sites

What does this mean "...having some difficulty with my scripts in controlling one of the dialogs that may or may not be displayed..."? What happens when it doesn't work?

Perhaps it's more style than substance, but I would prefer to check for the window this way, in case it doesn't happed to become active and stay that way on it's own:

; Wait for "Locked File Detected" window (five seconds maximum).
    If WinWait("Locked File Detected", "", 5) Then 
        ; Activate window
        WinActivate("Locked File Detected")
        WinWaitActive("Locked File Detected")
        ; Click on the 'Don't display this message again.' check-box.
        ControlClick("Locked File Detected", "", "[CLASSNN:Button1]")
        ; Click on the 'Reboot' button.
        ControlClick("Locked File Detected", "", "[CLASSNN:Button5]")
    EndIf

<_<

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

PsaltyDS,

Sorry about the cryptic statement. What is happening is when the "Locked File Detected" dialog is displayed, the script halts as if it is waiting for a response from the user. But, as you can see, I did add language to instruct AutoIT to "wait" for this dialog and ultimately send Control events (ControlClick) to the appropriate controls (i.e. Buttons, in this case) on the window. I will add the WinActivate command to my script as you suggest...I just thought that because the dialog appears to become active, that it would work as do the other conditional expressions (i.e. "Shared File Detected" dialog). I will let you know about my results after testing.

Thank you very much for responding so quickly!!

Link to comment
Share on other sites

  • 8 months later...

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...