if box is checked move a file to startup
Posted: 19 Jul 2018, 12:07
Hello,
I have a GUI that has some check boxes on a page. They will each do something different, but this one needs to move a file I have titled bob.lnc (it's a shortcut) to my startup folder. I have tried some variations of this, even trying FileCreateShortcut and making a new one. My original testing was done with just the message boxes, which all change on command perfectly.
Thank you for your help!
I have a GUI that has some check boxes on a page. They will each do something different, but this one needs to move a file I have titled bob.lnc (it's a shortcut) to my startup folder. I have tried some variations of this, even trying FileCreateShortcut and making a new one. My original testing was done with just the message boxes, which all change on command perfectly.
Thank you for your help!
Code: Select all
Gui, Add, CheckBox, x94 y179 w310 h30 vCheckOne , button that changes different file to start folder
Gui, Add, CheckBox, x94 y239 w310 h30 vCheckTwo , boxname2
Gui, Add, Button, x195 y289 w100 h30 , Finish
Gui, Show, x467 y200 h399 w499, New GUI Window
Return
...
ButtonFinish:
gui, submit, nohide
BoxesChecked = 0 ;counter for number of boxes / which boxes are checked
if (CheckOne = 1)
BoxesChecked += 1 ;only 1 box is checked
if (CheckTwo = 1)
BoxesChecked += 2 ;a second box is checked, so to indicate it is different from 1 box, it is += 2
if (BoxesChecked = 1)
MsgBox, moving to startup
FileMove, %A_WorkingDir%\bob.lnc, C:\Users\mhall\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\ ; needs to be changed to general startup folder instead of users\mhall
if (BoxesChecked = 2)
MsgBox, you selected 2
if (BoxesChecked = 3) ;if both are checked 1+2=3. If you had 3 boxes, this would be 6 because 1+2+3=6 or variations of
MsgBox, you selected both
;ExitApp
return