Ahankhah Posted April 29, 2011 Posted April 29, 2011 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. Quote
LibertyOne Posted April 29, 2011 Posted April 29, 2011 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. Quote
Ahankhah Posted April 29, 2011 Author Posted April 29, 2011 To know or not to know, that is the question! Who knows...? Quote
LibertyOne Posted April 29, 2011 Posted April 29, 2011 AutoLisp gives you the possibility to write text out to an external file. As far as *.lnk files are concerned, you may have to visit another forum to get the details on the *.lnk file. Maybe this will giude you in the right direction => http://www.codeproject.com/KB/winsdk/makelink.aspx Quote
Ahankhah Posted April 29, 2011 Author Posted April 29, 2011 LibertyOne, thanks a lot for your help and your link:). Quote
MSasu Posted April 29, 2011 Posted April 29, 2011 Please don't forget that the LNK file is a formatted type and therefore cannot be created/edited in text mode. Regards, Mircea Quote
Lee Mac Posted April 29, 2011 Posted April 29, 2011 It can be done using WindowScriptHost (WSH): http://www.theswamp.org/index.php?topic=25051.0 Quote
MSasu Posted April 29, 2011 Posted April 29, 2011 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 Quote
Ahankhah Posted April 29, 2011 Author Posted April 29, 2011 (edited) 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 April 29, 2011 by Ahankhah Quote
Ahankhah Posted April 29, 2011 Author Posted April 29, 2011 It can be done using WindowScriptHost (WSH): http://www.theswamp.org/index.php?topic=25051.0 Lee Mac, a fantastic forum and excellent code. Thanks a lot, again. Quote
Ahankhah Posted April 29, 2011 Author Posted April 29, 2011 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. Quote
Recommended Posts
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.