AutoIT Code Sample - Adding a shortcut in the user's Windows Startup folder in order to auto-start an AutoIT application every time a user logs-on to Windows. This script assumes that there is a checkbox defined on your Form, and will dynamically create or delete the shortcut on the check or uncheck event.
;===============================================================================
; Description: Add link to Windows startup folder
; Author(s): Videre Research, LLC - http://videreresearch.com
;===============================================================================
...
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
;Do something
Case $Checkbox1
If BitAND(GUICtrlRead($Checkbox1), $BN_CLICKED) = $BN_CLICKED Then
If _GUICtrlButton_GetCheck($Checkbox1) Then
ConsoleWrite("Checkbox checked... " & @CRLF)
If Not FileExists(@StartupDir & "\linkName.lnk") Then
FileCreateShortcut(@ScriptFullPath, @StartupDir & "\linkName.lnk", @ScriptDir, "", "AutoIT Script Description")
...
If FileExists(@StartupDir & "\linkName.lnk") Then
_GUICtrlButton_SetCheck($Checkbox1)
EndIf
|
AutoIT >