Jump to content

Create Shortcut Through AutoLISP Code


Ahankhah

Recommended Posts

Hello friends,

how is it possible to make a shortcut by AutoLISP programming. I mean creating a file with .lnk extension which refers to an executeable file in Windows.

Link to comment
Share on other sites

theoretically you can create any type of file by writing out to it - but you must know the coding of that type of file in order for it to be correct and readable...some files may have to be compiled in order for them to work.

Link to comment
Share on other sites

Please don't forget that the LNK file is a formatted type and therefore cannot be created/edited in text mode.

 

Regards,

Mircea

Link to comment
Share on other sites

You can create a shortcut for a file using a VBScript routine - see code below:

With CreateObject("WScript.Shell").CreateShortcut("C:\Documents and Settings\User\Desktop\theTool.lnk")
 .TargetPath = "C:\MyTools\theTool.exe"
 .WindowStyle = 1
 .IconLocation = "C:\MyTools\theTool.exe, 0"
 .Description = "Shortcut"
 .WorkingDirectory = "C:\Projects"
 .Save
End With

I suggest you to write this by your AutoLISP code into a file with VBS extension located in the temporarily folder and run it using the code below; you may remove that file when done.

(command "_START" theBVSFilePath)

 

Regards,

Mircea

Link to comment
Share on other sites

Please don't forget that the LNK file is a formatted type and therefore cannot be created/edited in text mode.

 

Regards,

Mircea

Mircea, thank you for your notice. The link LibertyOne mentioned is a library of C++ or VBA codes containing the required tasks. I am currently reviewing it to make my own code through AutoLISP.

Edited by Ahankhah
Link to comment
Share on other sites

You can create a shortcut for a file using a VBScript routine - see code below:

With CreateObject("WScript.Shell").CreateShortcut("C:\Documents and Settings\User\Desktop\theTool.lnk")
.TargetPath = "C:\MyTools\theTool.exe"
.WindowStyle = 1
.IconLocation = "C:\MyTools\theTool.exe, 0"
.Description = "Shortcut"
.WorkingDirectory = "C:\Projects"
.Save
End With

I suggest you to write this by your AutoLISP code into a file with VBS extension located in the temporarily folder and run it using the code below; you may remove that file when done.

(command "_START" theBVSFilePath)

 

Regards,

Mircea

Mircea, thank you for the offer, althoght the link suggested by Lee has the exact code in Visual LISP.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...