Jump to content
Sign in to follow this  
krzyrice

Please give me example of using this?

Recommended Posts

krzyrice

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

Share this post


Link to post
Share on other sites
sandin

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

Share this post


Link to post
Share on other sites
rudi

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!

Share this post


Link to post
Share on other sites
krzyrice

thank you so much for the help!!

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.