Jump to content

What caused errors?


louwho
 Share

Recommended Posts

When trying to automate an InstallShield product install, what exactly is it that causes the script to hang.

For example, I get to the first dialog (welcome), but it goes no further. Is it that there is a problem with my controlclick on the dialog, or, is it related to problems on the dialogs yet to come (incorrect commands for one of those dialogs to come, or, a missing dialog). As far as i know (having run the the uninstall several time), I have no missing dialogs. Can you test a script dialog by dialog, and add the next dialog to the scrip when you are successful with the previous dialogs? On the first dialog, while i am currently showing primary, etc., I have also tried the commands that I have for the second dialog, with no success. Are there problems with buttons that have '>' (&Next > )?

The first dialog has a Middle 'next >' button

The second dialog has three maintenance options (Modify, Repair, Remove), I select the 'Remove', and i am sure of my instances. It also has the Middle 'next >' button to get to the next dialog

The third dialog has the middle "Remove" button.

The fourth dialog is the 'completed' dialog and has the middle 'finish' button.

;BlockInput(1)

Run("setup.exe")

WinWaitActive("[TITLE:Timeline 1.0.20.1 - InstallShield Wizard;]", "")

ControlClick("Timeline 1.0.20.1 - InstallShield Wizard", "", "[CLASS:Button; INSTANCE:1]", "primary", "1", "306","324")

;

WinWaitActive("[TITLE:Timeline 1.0.20.1 - InstallShield Wizard; CLASS:#32770; INSTANCE:1]", "Program Maintenance")

ControlClick("Timeline 1.0.20.1 - InstallShield Wizard", "", "[CLASS:Button; INSTANCE:4]")

ControlClick("Timeline 1.0.20.1 - InstallShield Wizard", "", "[CLASS:Button; INSTANCE:6]")

;

WinWaitActive("[TITLE:Timeline 1.0.20.1 - InstallShield Wizard; CLASS:#32770; INSTANCE:1]", "Remove the Program")

ControlClick("Timeline 1.0.20.1 - InstallShield Wizard", "", "[CLASS:Button; INSTANCE:1]")

;

WinWaitActive("[TITLE:Timeline 1.0.20.1 - InstallShield Wizard; CLASS:#32770; INSTANCE:1]", "InstallShield Wizard Completed")

ControlClick("Timeline 1.0.20.1 - InstallShield Wizard", "", "[CLASS:Button; INSTANCE:4]")

;BlockInput(0)

Link to comment
Share on other sites

The problem is usually here: "WinWaitActive("[TITLE:Timeline 1.0.20.1 - InstallShield Wizard;]", "")"

Try to use Opt("WinTitleMatchMode", 2) and shorten the title to a minimum.

WinWaitActive("Timeline 1.0.20.1", "")

SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Link to comment
Share on other sites

I would say that a little bit more reading from you would be good, it would really help.

Have you read about "Opt"?

AutoItSetOption

--------------------------------------------------------------------------------

Changes the operation of various AutoIt functions/parameters.

AutoItSetOption ( "option" [, param] )

Parameters

option The option to change. See Remarks.

param [optional] The value to assign to the option. The type and meaning vary by option. See remarks below. If the param is not provided, then the function just returns the value already assigned to the option. The keyword Default can be used for the parameter to reset the option to its default value.

Return Value

Success: Returns the value of the previous setting for the option.

Failure: Sets @error to non-zero. Failure will occur if the parameters are invalid (such as an option that doesn't exist).

Remarks

You may use Opt() as an alternative to AutoItSetOption().

WinTitleMatchMode: Alters the method that is used to match window titles during search operations.

1 = Match the title from the start (default)

2 = Match any substring in the title

3 = Exact title match

4 = Advanced mode, see Window Titles & Text (Advanced)

-1 to -4 = force lower case match according to other type of match.

You use that line (usually) at the begining of your script and that changes what exactly a "window title" means.

"Shorten the title" means using a substring (significant) instead of your actual full-length title; I already gave you an example.

Edited by enaiman

SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Link to comment
Share on other sites

I apologize for not immediately grasping concepts that are new to me. The help did not show both an example of using opt, and the next line that would be associated with it. Now I understand that you were showing me the lines in their proper sequence.

Hopefully, i will not get a scolding when I ask the next questions. Do i need the opt only once? Also, A new problem, on the third screen, there are three buttons Back\Remove\Cancel,there instances are 3\1\2. For some reason, when I run the script, the instance numbers of the buttons are reversed to 2\3\1. My script, using 1, is now getting the Cancel button, and the associated "do you want to cancel?" message. How can this be happening, the script is below.

BlockInput(1)

Run("setup.exe")

Opt("WintitleMatchMode", "2")

WinWaitActive("Timeline 1.0.20.1", "")

ControlClick("Timeline 1.0.20.1", "", "[CLASS:Button; INSTANCE:1]")

;

Opt("WintitleMatchMode", "2")

WinWaitActive("Timeline 1.0.20.1", "")

ControlClick("Timeline 1.0.20.1", "", "[CLASS:Button; INSTANCE:4]")

ControlClick("Timeline 1.0.20.1", "", "[CLASS:Button; INSTANCE:6]")

;

Opt("WintitleMatchMode", "2")

WinWaitActive("Timeline 1.0.20.1", "Remove the Program")

ControlClick("Timeline 1.0.20.1", "", "[CLASS:Button; INSTANCE:1]")

;

Opt("WintitleMatchMode", "2")

WinWaitActive("Timeline 1.0.20.1 - InstallShield Wizard", "")

ControlClick("Timeline 1.0.20.1 - InstallShield Wizard", "", "[CLASS:Button; INSTANCE:1]")

BlockInput(0)

Link to comment
Share on other sites

"Opt" is like an On/Off switch, you need it only once at the top of the script.

edited: because somebody loves to pick on mistakes ...

"Opt" is used to alter the default behaviour of certain functions/parameters. You can use "Opt" anywhere and anytime in your script. When it is executed it changes that specific aspect for the remaining of the script execution time OR until a new "Opt" to affect the same function/parameter is encountered.

Talking about "shifting instances", I have seen that happening some time ago.

Solutions:

1 - see if the buttons doesn't have a shortcut assigned (underlined letter) - if you press that Alt + that letter, you will actually "click" that button ("press" => Send that key combination)

Run("notepad")
Sleep(1000)
Send("!f")

2 - get the text for all 3 controls (Back\Remove\Cancel) and "click" the one whose text is matching.

Run("notepad")
Sleep(1000)
Send("t")                       ;send something 
Send("!fx")                     ;send Alt-F to open file menu and x - to select "Exit"
WinWaitActive("Notepad", "")    ;wait for Save dialog to open
;now you have 3 buttons on that Save window
For $i = 1 To 3
    ;ConsoleWrite($i&"  "&ControlGetText("Notepad", "",  "Button"&$i)&@CRLF)
    If ControlGetText("Notepad", "",  "Button"&$i) = "Do&n't Save" Then
        ControlClick("Notepad", "",  "Button"&$i)
        MsgBox(0, "Don't Save", "Clicked")
    EndIf
Next

Good luck,

Edited by enaiman

SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Link to comment
Share on other sites

"Opt" is like an On/Off switch, you need it only once at the top of the script.

Not always true.

$sSep = Opt("GUIDataSeparatorChar", "/")
MsgBox(0, "Result", $sSep)
$sSep = Opt("GUIDataSeparatorChar", $sSep)
MsgBox(0, "Result", $sSep)

I often use this method in a multi-GUI situation if I have to change "GUICoordMode" in different sections of a script. In This case $sSep holds the character prior to the change.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

Do strange things happen if you run on a VM, (XP)? Things hang on the last dialog. This is the completed dialog, with the middle 'finish' button enabled, and the left and right buttons disabled. There are times that the underline (_) shows under the 'F', and other times that it does not. The controlclick does not work.

I have tried the 'for' loop that is successful on the third dialog, the '!f', the Send Enter, but when I add these things, the script hangs on the third dialog. This is the install from hell...(I did not write it). any ideas?

BlockInput(1)

Run("setup.exe")

Opt("WintitleMatchMode", "2")

WinWaitActive("Timeline 1.0.20.1", "")

ControlClick("Timeline 1.0.20.1", "", "[CLASS:Button; INSTANCE:1]")

;

WinWaitActive("Timeline 1.0.20.1", "")

ControlClick("Timeline 1.0.20.1", "", "[CLASS:Button; INSTANCE:4]")

ControlClick("Timeline 1.0.20.1", "", "[CLASS:Button; INSTANCE:6]")

;

WinWaitActive("Timeline 1.0.20.1", "Remove the Program")

;This next line does not work because for some reason, when executed

; the Instance #'s get switched

;ControlClick("Timeline 1.0.20.1", "", "[CLASS:Button; INSTANCE:1]")

For $i = 1 To 3

If ControlGetText("Timeline 1.0.20.1", "", "Button"&$i) = "Remove" Then

ControlClick("Timeline 1.0.20.1", "", "Button"&$i)

;MsgBox(0, "Remove", "Clicked")

EndIf

Next

;

WinWaitActive("Timeline 1.0.20.1", "")

;Sleep(3000)

;Send("!f")

ControlClick("Timeline 1.0.20.1", "", "[CLASS:Button; INSTANCE:1]")

;For $i2 = 1 To 3

;If ControlGetText("Timeline 1.0.20.1", "", "Button"&$i2) = "Finish" Then

; ControlClick("Timeline 1.0.20.1", "", "Button"&$i2)

; ;MsgBox(0, "Finish", "Clicked")

;EndIf

;Next

BlockInput(0)

Link to comment
Share on other sites

I don't know what you mean by "hang"; is the script exiting without clicking your button? or the script is still waiting at "WinWaitActive"?

To see what is happening add the following to the top of your script:

Opt("TrayIconDebug", 1)

When the script runs, if you put the mouse cursor over its tray icon, it will show which line on the script is executed.

If, the script is waiting at "WinWaitActive("Timeline 1.0.20.1", "Remove the Program")", make sure that "Remove the Program" is the text on that window (use AutoIt Window Info tool). If you see the text there, try with only "remove" or nothing ... it is just a matter of trial and error for you now.

SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

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