Sign in to follow this  
Followers 0
vins

CheckBox

10 posts in this topic

Hi All,

I am trying to automate the installation of my desktop application. There is a check box that asks user to check it so that the istallation will start.

I need my code to go and check that check box? How do i do that?

Any help is appreciated?

Thank You...

PS: Today is the first day in my life that i have heard of AutoIt..So please be gentle.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Welcome to the forum, vins!

Use the application supplied with the AutoIt installation, AutoIt Window Info.

Click the "Control" tab.

Press Ctrl+Alt+F to unlock/lock the application.

Then click in the install window to activate it (give it focus).

Move your mouse over the checkbox and note down the "ID" number.

Create a new script and use this as a starting point:

WinActivate("Date and Time")
ControlClick("Date and Time","",351)

On Windows 7, if you open the Date and Time settings, this will activate the window and click "Show this clock" (Control ID 351) in the Tab "additional clocks".

Good luck!

footswitch

Edited by footswitch

Share this post


Link to post
Share on other sites

rather than relying on clicks or send commands, depending on which application it is, you might be able to issue a /silent command when starting the installer. Often times application installers have switches for passive and silent install. If I had the option, I would do that instead.

Share this post


Link to post
Share on other sites

Welcome to the forum, vins!

Use the application supplied with the AutoIt installation, AutoIt Window Info.

Click the "Control" tab.

Press Ctrl+Alt+F to unlock/lock the application.

Then click in the install window to activate it (give it focus).

Move your mouse over the checkbox and note down the "ID" number.

Create a new script and use this as a starting point:

WinActivate("Date and Time")
ControlClick("Date and Time","",351)

On Windows 7, if you open the Date and Time settings, this will activate the window and click "Show this clock" (Control ID 351) in the Tab "additional clocks".

Good luck!

footswitch

Share this post


Link to post
Share on other sites

Tried the below but they do not work:

ControlClick ("Setup FlipShare", "", "[CLASSN:Button4; ID:5; INSTANCE:4]") ## Clicks on the checkbox OR

ControlCommand ("[CLASS:Setup FlipShare]", "","5","Check", "[CLASSN:Button4;INSTANCE:1]")

Any Suggestions??? (Is a CheckBox)

Title: Setup FlipShare

CLASS" #32770

CLASS: Button

CLASSNN: Button4

INSTANCE:4

ID :5

TEXT: NONE

Share this post


Link to post
Share on other sites

What program are you trying to install?


Drunken Frat-Boy Monkey Garbage

Share this post


Link to post
Share on other sites

I am trying to automate the installation of FlipShare.Gives me a script error for the above code.

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Any Suggestions??? (Is a CheckBox)

Title: Setup FlipShare

CLASS" #32770

CLASS: Button

CLASSNN: Button4

INSTANCE:4

ID :5

TEXT: NONE

Based in the above, this should work:

;this sets exact title match mode
AutoItSetOption("WinTitleMatchMode", 3)

$hFlipShare = WinGetHandle("[CLASS:#32770; TITLE:Setup FlipShare]", "")

ControlClick($hFlipShare, "", "[CLASS:Button; INSTANCE:4]")

;)

EDIT: If this does not work anyway, just play with AutoItSetOption("WinTitleMatchMode", 3) set the parameter to 1 or 2

Edited by ALTIN

Share this post


Link to post
Share on other sites

Took me longer than I thought (I'm new to AuI too, so I needed the practice) but I made a simple GUI script for you with comments on what everything does. It's a simple "Check Me" like "Crack Me" if you do any RE type of stuff...

I commented every line to explain what each line means and what it does. Sorry if it's overkill. I realize I'm treating you like a total idiot, but I know comments like this is what helped me on my first day, so I'm hoping it does the same for you!

I use GUIOnEventMode, which means Functions. If you prefer If...Then statements, I can write you a code for that too. Just let me know!

#Include <GUIConstants.au3>  ;  Required to make GUI

AutoItSetOption("MustDeclareVars",1)  ;  Personal thing, not required, just a preference
AutoItSetOption("GUIOnEventMode",1)  ;  Same as above.  If you use OnEventMode, you use functions.  Otherwise, you use "If...Then" statements

Global $GUI = GUICreate("Check Me",200,40)  ;  Create the GUI window (if not using OnEventMode, delete Global
GUISetOnEvent($GUI_EVENT_CLOSE,"_Close")  ;  If we hit the 'X' go to the _Close function
Global $Box = GUICtrlCreateCheckbox("Check Me",60,10)  ;  Creates a Checkbox with the text: "Check Me" beside it
GUICtrlSetOnEvent($Box,"_Checked")  ;  If the box becomes checked, go to the _Checked function

GUISetState()  ;  Allows us to see the GUI we created

While 1  ;  A simple loop that will prevent closing
    Sleep(10)  ;  A low sleep time so we get a fast response but it doesn't drain all the memory in our pc
WEnd

Func _Checked()  ;  Beginning of the _Checked function
    MsgBox(0,"YAY","You checked the box!")  ;  Creates a message box that says "You checked the box!"
    GUICtrlSetState($Box,$GUI_Unchecked)  ;  Unchecks the checkbox so we can recheck it again
EndFunc  ;  End of the _Checked function
;It will now return to the While 1 loop

Func _Close()  ;  Beginning of the _Close function
    Exit  ;  Exits the program
EndFunc  ;  End of the _Close function (not that it is really needed...)

00101101011110000101000001101100011011110110100101110100

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

Took me longer than I thought (I'm new to AuI too, so I needed the practice) but I made a simple GUI script for you with comments on what everything does. It's a simple "Check Me" like "Crack Me" if you do any RE type of stuff...

I commented every line to explain what each line means and what it does. Sorry if it's overkill. I realize I'm treating you like a total idiot, but I know comments like this is what helped me on my first day, so I'm hoping it does the same for you!

I use GUIOnEventMode, which means Functions. If you prefer If...Then statements, I can write you a code for that too. Just let me know!

Hey xPloit, this looks to be a little off topic from what the thread starter was looking for, but is extremely helpful in helping me figure out the issue that lead me to this thread. Would you mind PMing me code with If Then statments? Also, I'm very new to AutoIT, and I'm not a big programmer, your commenting on everything helps me quite a bit!

Edited to take out xPloit's code, to make it easier to read ;)

Edited by Bilson

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