Sign in to follow this  
Followers 0
MNeMiC

Creating shortcuts?

5 posts in this topic

So what I'd like to do is to create a shortcut to a file at a specific path (@ProgramFilesDir/AppFolder/AppName.exe), and move it to C:\Windows, in order to be able to type that shortcut's name into the RUN and then launch the program.

I need to be able to:

Create a shortcut from a file

Rename the shortcut to a custom name

Move the shortcut to the Windows directory

I'm pretty much a beginner at AutoIT, but I'm already amazed at what it can do.

I looked at some .INK shortcuts, and they are all binary, is there a way to create an ASCII shortcut, or would this have to be done with keypresses? (Like, RMB->Create Shortcut), because that probably wouldn't be too good if it's going to be executed on an international system.

Aside from actually copying the whole EXE-file, I have no idea on how to do this.

Ideas anyone?

Thanks in advance,

MNeMiC

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

The HelpFile Does Wonders...You Should Try It Sometime

FileCopy(@ProgramFilesDir & "\app\app.exe", @WINDOWSDIR & "\app.exe")

Then later in your script:

Run(@WINDOWSDIR & "\app.exe")

Enjoy

ez :D

Ill get back to you on the name of the name of it

FileCreateShortcut(@Programfilesdir & "\app\app.exe", @WINDOWSDIR & "\app.exe")

Edited by Swift

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Man do I feel like a freaking retard right now. Thanks alot for the help. I did search the forums and tried looking through the function & macro lists in the online docs. Didn't figure to search for "shortcut" in the functions list though, stupid me.

Another quick question:

To rename a file, do I use the FileMove or what?

FileMove ("oldpath/oldname.oldext", "oldpath/newname.oldext")

*EDIT*

And man, do I feel like an even bigger retard now when I looked at the description, not just the syntax and it said:

"Because AutoIt lacks a "FileRename" function, use FileMove to rename a file!"

Edited by MNeMiC

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Or...use FileCopy("samefile.au3", "file.au3")

then...

FileDelete("samefile.au3")

:D

goodluck with your script

Edited by Swift

Share this post


Link to post
Share on other sites

Or...use FileCopy("samefile.au3", "file.au3")

then...

FileDelete("samefile.au3")

:D

goodluck with your script

Actually, I think that hat would be a bad idea... It would go slower then just FileMove(), and if there's no point in copying it you should avoid it.

My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

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  
Followers 0