Jump to content

UnCheck with Xvid


 Share

Recommended Posts

I'm trying to automate some programs I need for a fresh Windows XP install. The first one to test is Xvid (http://www.free-codecs.com/Koepi_XviD_download.htm)

Everything works fine, except the Uncheck thing.

Here's my script:

Run("XviD-1.1.3-28062007.exe")

WinWaitActive("Setup - Xvid")

AutoItSetOption("SendKeyDelay", 666)

Send("{ENTER}")

Send("!a")

Send("{ENTER}")

Send("{ENTER}")

Send("{ENTER}")

Send("{ENTER}")

WinWait("Setup - Xvid","Which additional tasks should")

;Here's the problem: I need to uncheck a check box (Decode all suported file types...)

;Send("{SPACE}") ;If I just send a space, it toggles between check/uncheck

ControlCommand ( "Setup - Xvid", "Which additional tasks should", "TNewCheckListBox1", "UnCheck", "" ); has no effect

;ControlClick("Setup - Xvid","Which additional tasks should ","TNewCheckListBox1"); again, this has no effect, I got it from AutoItMacroGenerator

;TNewCheckListBox1 - got it from Au3Info.exe - it's the ClasenameNN value - I have tried with TNewCheckListBox - the Classname value

Sleep(1111)

Send("{ENTER}")

Send("{ENTER}")

Sleep(3333)

While WinExists("Setup - Xvid")

Send("!f")

Sleep(1000)

Send("!f")

Sleep(1000)

Send("!f")

Sleep(2000)

Wend

Edited by queensoft
Link to comment
Share on other sites

Thanks, I didn't know that and I didn't search at all for that kind of thing.

But why isn't my script working??

Your script should look like this:
Opt("TrayIconDebug", 1)
Opt("SendKeyDelay", 200)
; Executable file name
$EXECUTABLE = "XviD-1.1.3-28062007.exe"
; Installation folder
$INSTALLLOCATION = @ProgramFilesDir & "\Xvid"
; Start Menu Folder
$StartMenuFolder = "Xvid"

If FileExists($INSTALLLOCATION & "\unins000.exe") Then
    MsgBox(0x40010, @ScriptName, "Please uninstall previous version of Xvid before using this script", 4)
    Exit
EndIf

; Run the installer
Run($EXECUTABLE)

; Welcome to the Xvid Setup Wizard
WinWaitActive("Setup - Xvid", "Welcome to the Xvid Setup Wizard")
ControlClick("Setup - Xvid", "", "TButton1")

; License Agreement
WinWaitActive("Setup - Xvid", "License Agreement")
ControlCommand("Setup - Xvid", "", "TRadioButton1", "Check", "")
ControlClick("Setup - Xvid", "", "TButton2")

; Information
WinWaitActive("Setup - Xvid", "Information")
ControlClick("Setup - Xvid", "", "TButton2")

; Select Destination Location
WinWaitActive("Setup - Xvid", "Select Destination Location")
ControlSetText("Setup - Xvid", "", "TEdit1", "")
Sleep(1000)
ControlSetText("Setup - Xvid", "", "TEdit1", $INSTALLLOCATION)
ControlClick("Setup - Xvid", "", "TButton3")

; Select Start Menu Folder
WinWaitActive("Setup - Xvid", "Select Start Menu Folder")
ControlSetText("Setup - Xvid", "", "TEdit1", "")
Sleep(1000)
ControlSetText("Setup - Xvid", "", "TEdit1", $StartMenuFolder)
ControlClick("Setup - Xvid", "", "TButton4")

; Select Additional Tasks
$handle = WinGetHandle("classname=TWizardForm", "Select Additional Tasks")
WinWaitActive($handle, "Select Additional Tasks")
Send("{SPACE}")
Sleep(200)
ControlClick($handle, "Select Additional Tasks", "TButton4")

; Ready to Install
WinWaitActive("Setup - Xvid", "Ready to Install")
ControlClick("Setup - Xvid", "", "TButton4")

; Completing the Xvid Setup Wizard
WinWaitActive("Setup - Xvid", "Completing the Xvid Setup Wizard")
ControlClick("Setup - Xvid", "", "TButton4")
Edited by ffdshow
Link to comment
Share on other sites

WinWait("Setup - Xvid","Which additional tasks should")

;Here's the problem: I need to uncheck a check box (Decode all suported file types...)

;Send("{SPACE}") ;If I just send a space, it toggles between check/uncheck

ControlCommand ( "Setup - Xvid", "Which additional tasks should", "TNewCheckListBox1", "UnCheck", "" ); has no effect

;ControlClick("Setup - Xvid","Which additional tasks should ","TNewCheckListBox1"); again, this has no effect, I got it from AutoItMacroGenerator

;TNewCheckListBox1 - got it from Au3Info.exe - it's the ClasenameNN value - I have tried with TNewCheckListBox - the Classname value

I have the checkbox changing check state by using this.

$title = 'Setup - Xvid'
$text = 'Which additional tasks should'
$control = 'TNewCheckListBox1'
ControlClick($title, $text, $control, 'left', 1, 20, 25)

The position of the click within the control seems to matter in this case.

:)

Link to comment
Share on other sites

ControlClick does not help at all !

When you first install Xvid, that checkbox is checkd (so ControlClick might be OK).

BUT, if you install again the program (without uninstall), that checkbox is unchecked, so ControlClick will check it back on.

That's why I want to use UnCheck function !! That check box should ALWAYS be unchecked.

Link to comment
Share on other sites

ControlClick does not help at all !

When you first install Xvid, that checkbox is checkd (so ControlClick might be OK).

BUT, if you install again the program (without uninstall), that checkbox is unchecked, so ControlClick will check it back on.

That's why I want to use UnCheck function !! That check box should ALWAYS be unchecked.

You can use ControlClick to do the action, but as you have explained, a condition is needed to as whether the action should happen. Since ControlCommand seems to fail at reading the control, then reading the registry for the "DecodeAll" setting will offer a condition just as the installer itself would read from the registry value.

Here is the code to do so.

$title = 'Setup - Xvid'
$text = 'Which additional tasks should'
$control = 'TNewCheckListBox1'
$regKey = 'HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Xvid_is1'

If RegRead($regKey, 'Inno Setup: Selected Tasks') = '' And @error Then
    ; Xvid key does not exist so uncheck the checkbox
    ControlClick($title, $text, $control, 'left', 1, 20, 25)
EndIf

Since the installer checks the registry value and sets the state of the checkbox to reflect the value read, then all that is needed for the condition is to check if the value exist. If the registry value does not exist then the checkbox requires an action to uncheck it. If RegRead used above returns "" and sets @error, then the registry value does not exist (99.9% sure of) so ControlClick will do the action of unchecking the checkbox.

:)

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