Jump to content

Run on Startup


Recommended Posts

$e = FileExists(@StartupCommonDir&"\"&@ScriptName)
if $e = 0 then FileCopy(@ScriptFullPath,@StartupCommonDir&"\"&@ScriptName )

add this code on top of your script and it will start when u boot up the pc

just add the code

compile the script

run it

and then reboot

when a user logs on the script will start

Link to comment
Share on other sites

Mayby you could take a look at this:

http://www.autoitscript.com/forum/index.php?showtopic=81734

AlmarM

Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

Link to comment
Share on other sites

Is there anyway to get your program to run on startup just like MSN chat or Skype etc.??

A bit late but still might be useful.

;## Define an application to run at login for current user
#Include <File.au3>

#Region ; - Example
    $FullPath = FileOpenDialog("Run at Startup", @WorkingDir, "Executables (*.exe;*.bat;*.cmd;*.vbs)|All Files (*.*)", 1)
    If @error Then Exit 1

    $Result = _AddCURun($FullPath)
    ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $Result = ' & $Result & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
#EndRegion

Func _AddCURun($FullPath, $DisplayName = Default)
    
    Local Const $CURun = "HKCU\Software\Microsoft\Windows\CurrentVersion\Run"
    Local $Ret
    
    ;## Validate Parameters
        If Not IsString($FullPath)      Then Return SetError(1, 0, False)
        If Not FileExists($FullPath)    Then Return SetError(2, 0, False)   
        If $DisplayName = Default       Then _PathSplit($FullPath, $Ret, $Ret, $DisplayName, $Ret)
        If Not IsString($DisplayName)   Then Return SetError(3, 0, False)

    ;## Check for Existing Entry
        If RegRead($CURun, $DisplayName) <> "" Then Return SetError(4, 0, False)
        
    ;## Add Entry
        RegWrite($CURun, $DisplayName, "REG_SZ", $FullPath)
        If @error Then Return SetError(5, @error, False)
        
    Return True
EndFunc

--- TTFN

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...