bucky002 Posted April 22, 2006 Share Posted April 22, 2006 (edited) I want to know this because I made a little installer script.(Isn't completed yet) I would put the installer script inside one of my other scripts to install it, but how would I make it so it would create a shortcut on the desktop? Here's my script #region --- GuiBuilder code Start --- ; Script generated by AutoBuilder 0.6 Prototype #include <GuiConstants.au3> GuiCreate("Installer", 293, 83,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS)) $Input_1 = GuiCtrlCreateInput(@ProgramFilesDir & "\AutoIt", 10, 10, 180, 20) $Browse = GuiCtrlCreateButton("Browse", 210, 10, 60, 20) $OK = GuiCtrlCreateButton("OK", 190, 50, 90, 30) $Cancel = GuiCtrlCreateButton("Cancel", 90, 50, 90, 30) $Checkbox_5 = GuiCtrlCreateCheckbox("Shortcut", 10, 60, 60, 20) GuiSetState() While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Browse $file = FileSelectFolder("Browse", "", 1+2+4, @ProgramFilesDir) guictrlsetdata($Input_1, $file & "\AutoIt", "") Case $msg = $Cancel Exit Case $msg = $OK $dir = DirCreate(GUICtrlRead($Input_1)) Exit Case Else ;;; EndSelect WEnd Exit #endregion --- GuiBuilder generated code End --- Edited April 22, 2006 by bucky002 Link to comment Share on other sites More sharing options...
neogia Posted April 22, 2006 Share Posted April 22, 2006 Harder than I thought: $pathToEXE = "C:\Windows\Notepad.exe" $dirToShortcut = "C:\test\" $shortcutName = "Shortcut to Notepad.lnk" Func _CreateShortcut($pathToEXE, $dirToShortcut, $shortcutName) If FileExists($pathToEXE) Then If DirCreate($dirToShortcut) Then $oWSHShell = ObjCreate("WScript.Shell") $oShortCutLink = $oWSHShell.CreateShortcut($dirToShortcut & "\" & $shortcutName) $oShortCutLink.TargetPath = $pathToEXE $oMyError = ObjEvent("AutoIt.Error", "ErrorFunc") $oShortCutLink.Save Else MsgBox(0,"","Could not create directory for shortcut.") EndIf Else MsgBox(0,"","File to make shortcut from does not exist.") EndIf EndFunc Func ErrorFunc() $hexErrorCode = Hex($oMyError.Number, 8) Msgbox(0,"","We intercepted a COM Error !" & @CRLF & _ "Number is: " & $HexNumber & @CRLF & _ "Windescription is: " & $oMyError.windescription ) SetError(1); something to check for when this function returns Endfunc [u]My UDFs[/u]Coroutine Multithreading UDF LibraryStringRegExp GuideRandom EncryptorArrayToDisplayString"The Brain, expecting disaster, fails to find the obvious solution." -- neogia Link to comment Share on other sites More sharing options...
PsaltyDS Posted April 22, 2006 Share Posted April 22, 2006 Harder than I thought: CODE$pathToEXE = "C:\Windows\Notepad.exe"$dirToShortcut = "C:\test\"$shortcutName = "Shortcut to Notepad.lnk"Func _CreateShortcut($pathToEXE, $dirToShortcut, $shortcutName) If FileExists($pathToEXE) Then If DirCreate($dirToShortcut) Then $oWSHShell = ObjCreate("WScript.Shell") $oShortCutLink = $oWSHShell.CreateShortcut($dirToShortcut & "\" & $shortcutName) $oShortCutLink.TargetPath = $pathToEXE $oMyError = ObjEvent("AutoIt.Error", "ErrorFunc") $oShortCutLink.Save Else MsgBox(0,"","Could not create directory for shortcut.") EndIf Else MsgBox(0,"","File to make shortcut from does not exist.") EndIfEndFuncFunc ErrorFunc() $hexErrorCode = Hex($oMyError.Number, 8) Msgbox(0,"","We intercepted a COM Error !" & @CRLF & _ "Number is: " & $HexNumber & @CRLF & _ "Windescription is: " & $oMyError.windescription ) SetError(1); something to check for when this function returns EndfuncEasier than I thought: FileCreateShortcut() in Beta. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
rambo3889 Posted April 22, 2006 Share Posted April 22, 2006 U took the words out of my mouth My Scripts:Radioblog Club Music DownloaderOther stuff:Fun movieIm serious read the help file it helps :PFight 'Till you drop. Never stop, You Cant give up. Til you reach the top Fight! youÂ’re the best in town Fight! Link to comment Share on other sites More sharing options...
neogia Posted April 22, 2006 Share Posted April 22, 2006 Bah! there goes another 15 mins. of my life. [u]My UDFs[/u]Coroutine Multithreading UDF LibraryStringRegExp GuideRandom EncryptorArrayToDisplayString"The Brain, expecting disaster, fails to find the obvious solution." -- neogia Link to comment Share on other sites More sharing options...
PsaltyDS Posted April 22, 2006 Share Posted April 22, 2006 Bah! there goes another 15 mins. of my life.If you don't mind wasting another minute or two...What the heck is that in your user picture? It looks the black spy from 'Spy Vs Spy' in Mad Magazine, having a heart attack. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
neogia Posted April 22, 2006 Share Posted April 22, 2006 Hah, you're the first that asked.. it's been my general forum picture for awhile now. My sig in another forum was "Chili Cheese Burritos make me smile..." and I needed an avatar pic, so I did a google image search for "Chili Cheese Burritos" and behold. I had to have it. It's interesting you asked me where it's from, though, because I just re-searched for it and it turns out it's from Columbia University's school paper. Who knew? Without further ado... Chili Cheese Burritos make me smile... P.S.: Sorry for OT [u]My UDFs[/u]Coroutine Multithreading UDF LibraryStringRegExp GuideRandom EncryptorArrayToDisplayString"The Brain, expecting disaster, fails to find the obvious solution." -- neogia Link to comment Share on other sites More sharing options...
bucky002 Posted April 22, 2006 Author Share Posted April 22, 2006 Thanks for the help. Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted April 23, 2006 Share Posted April 23, 2006 im guessing its a chili cheese burrito tied up and a guy smiling cuz he got one? Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now