If Else in CheckBox and DropDownList Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Rami
Posts: 55
Joined: 19 May 2016, 07:44

If Else in CheckBox and DropDownList

04 Jan 2017, 14:23

Hi,

let's say I have this simple Gui, with button "Dir" that will run the command: Dir

Code: Select all

Gui, Add, checkbox, vA, A
Gui, Add, Checkbox, vB, B
Gui, Add, Checkbox, vC, C
Gui, Add, Checkbox, vD, D
Gui, Add, DropDownList, ,Pause||Dont Pause|Wide
Gui,Add,Button, gDir, Dir
Gui, Show, center
Return

Dir:
Gui, Submit, NoHide
Run, %ComSpec% /k Dir ;here goes as checked above
return                             
But command "Dir" has a lot of parameters (i.e: dir /s /a /b ... etc.)
I need the command:
if Pause is choose

Code: Select all

Dir /p
if Pause is choose and (B, D) are checked.

Code: Select all

Dir /P /b /d
etc ...

So the command is what we chose to add to it after word :"Dir"

Is there any easier way before I go through hundreds of (If, Then, Run) ??

Any suggestion is appreciated
iPhilip
Posts: 822
Joined: 02 Oct 2013, 12:21

Re: If Else in CheckBox and DropDownList  Topic is solved

04 Jan 2017, 14:45

Would this do it?

Code: Select all

Gui, Add, checkbox, vA, A
Gui, Add, Checkbox, vB, B
Gui, Add, Checkbox, vC, C
Gui, Add, Checkbox, vD, D
Gui, Add, DropDownList, vP,Pause||Dont Pause|Wide
Gui,Add,Button, gDir, Dir
Gui, Show, center
Return

Dir:
Gui, Submit, NoHide
a := A ? "/a" : ""
b := B ? "/b" : ""
c := C ? "/c" : ""
d := D ? "/d" : ""
p := P = "Pause" ? "/p" : ""
Run, %ComSpec% /k Dir %a% %b% %c% %d% %p% ;here goes as checked above
return                             
Windows 10 Pro (64 bit) - AutoHotkey v2.0+ (Unicode 64-bit)
User avatar
evilC
Posts: 4823
Joined: 27 Feb 2014, 12:30

Re: If Else in CheckBox and DropDownList

04 Jan 2017, 14:48

Gui, Submit, NoHide will pull tbe values of the GuiControls and populate the associated variables.
So given Gui, Add, checkbox, vA, A, then the variable A will hold 1 if Checkbox A is checked, else 0
Rami
Posts: 55
Joined: 19 May 2016, 07:44

Re: If Else in CheckBox and DropDownList

04 Jan 2017, 15:11

evilC,
Thank you.

iPhilip,
Thank you , i think that is what i'm looking for ...
I will try that in few...

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: inseption86, mikeyww and 453 guests