If Else in CheckBox and DropDownList Topic is solved

Get help with using AutoHotkey 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: 464
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 v1.1+ (Unicode 32-bit)
User avatar
evilC
Posts: 4787
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”

Who is online

Users browsing this forum: AHKStudent, Bing [Bot], BushMange, hasantr, Laser-Ben-2020, mikemap, zhainv2013 and 40 guests