Jump to content

Recommended Posts

Posted (edited)

How would you use this in a script? "@MyDocumentsDir" I've searched everywhere but can't find the answer. I'd like to create a shortcut for my program using autoit and would like to know how to place that into my documents folder. Please help me.

Edited by krzyrice
Posted (edited)

maybe this:

$FileExe = FileOpenDialog("select file", "C:\", "Executable (*.exe)")
if @error = 1 then Exit ;cancel has been clicked
$stringSplit = StringSplit ( StringTrimRight($FileExe, 4), "\")
$count = $stringSplit[0]
$ShortcutName = InputBox("Shorcut Name", "Input name of your new shortcut:", $stringSplit[$count])
if @error = 1 then Exit ;cancel has been clicked
FileCreateShortcut($FileExe, @MyDocumentsDir & "\" & $ShortcutName & ".lnk")
MsgBox(0, "Shortcut Creator", "New shortcut for your " & $stringSplit[$count] & " program has been created" _
        & @CRLF & "Location: " & @MyDocumentsDir & "\" & $ShortcutName & ".lnk")
Edited by sandin
Posted

How would you use this in a script? "@MyDocumentsDir" I've searched everywhere but can't find the answer. I'd like to create a shortcut for my program using autoit and would like to know how to place that into my documents folder. Please help me.

$FileName = "C:\FooBar.txt"
$LinkName = "Link to FooBar.txt.lnk"
$handle = FileOpen($FileName, 2)
FileWriteLine($handle, "I'm just a file, leave me alone!")
FileClose($handle)

FileCreateShortcut($FileName, @MyDocumentsDir & "\" & $LinkName, @MyDocumentsDir)
Run("explorer.exe /e,/select," & @MyDocumentsDir & "\" & $LinkName)

Regards, Rudi.

Earth is flat, pigs can fly, and Nuclear Power is SAFE!

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
×
×
  • Create New...