keyfinger Posted May 22, 2006 Share Posted May 22, 2006 I'm running this simple script to try and retrieve the target path of this url (.lnk) file and it's coming back blank. Using beta version .124#include <Array.au3>FileCreateShortcut("http://www.autoitscript.com", @DesktopDir & "\AutoIT.lnk")$details = FileGetShortcut(@DesktopDir & "\AutoIT.lnk")_ArrayDisplay($details, "")FileDelete(@DesktopDir & "\AutoIT.lnk") Link to comment Share on other sites More sharing options...
Valuater Posted May 22, 2006 Share Posted May 22, 2006 (edited) put this in the script$Url = "http://www.autoitscript.com/forum/index.php?act=idx" DllCall("shell32.dll", "long", "ShellExecute", "hwnd", 0, "string", 'open', "string", $Url, "string", '', "string", @ScriptDir, "long", @SW_SHOWNORMAL)then compile itthen create the shortcut... with your scriptor create the shortcut within the script... then compile ithey DEV's ... jonthe Autoit code tags create errors8) Edited May 22, 2006 by Valuater Link to comment Share on other sites More sharing options...
keyfinger Posted May 22, 2006 Author Share Posted May 22, 2006 Getting an error when I try to compile. DllCall("shell32.dll", "long", "ShellExecute", "hwnd", 0, "string", & ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ Link to comment Share on other sites More sharing options...
CyberSlug Posted May 22, 2006 Share Posted May 22, 2006 An internet shortcut is actually NOT a lnk file; it is a ini-formatted url file. $url = IniRead("New Internet Shortcut.url", "InternetShortcut","URL", "ERROR") MsgBox(0,"Result", $url) Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! Link to comment Share on other sites More sharing options...
keyfinger Posted May 22, 2006 Author Share Posted May 22, 2006 Ok, then tell me how I do this with a .lnk file that has a url taget path. If I create the lnk with the url as the taget path, the file comes across as a .lnk not a .url like your example. Link to comment Share on other sites More sharing options...
Valuater Posted May 22, 2006 Share Posted May 22, 2006 (edited) the autoit code box created an error on my last post $Url = "http://www.autoitscript.com/forum/index.php?act=idx" DllCall("shell32.dll", "long", "ShellExecute", "hwnd", 0, "string", 'open', "string", $Url, "string", '', "string", @ScriptDir, "long", @SW_SHOWNORMAL) try again... it wasn't me 8) EDIT... that works Edited May 22, 2006 by Valuater Link to comment Share on other sites More sharing options...
CyberSlug Posted May 22, 2006 Share Posted May 22, 2006 You can use IniWrite in order to create the Internet Shortcut. FilechangeDir(@DesktopDir) IniWrite("Shortcut to AutoIt site.url", "InternetShortcut","URL","http://www.autoitscript.com") $url = IniRead("Shortcut to AutoIt site.url", "InternetShortcut","URL", "ERROR") MsgBox(0,"Result", $url) Like I said, it's a URL file instead of LNK file. I don't know why Microsoft chose a different format, but the file type/extension is not LNK. Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! Link to comment Share on other sites More sharing options...
Valuater Posted May 22, 2006 Share Posted May 22, 2006 (edited) You can use IniWrite in order to create the Internet Shortcut. FilechangeDir(@DesktopDir) IniWrite("Shortcut to AutoIt site.url", "InternetShortcut","URL","http://www.autoitscript.com") $url = IniRead("Shortcut to AutoIt site.url", "InternetShortcut","URL", "ERROR") MsgBox(0,"Result", $url) Like I said, it's a URL file instead of LNK file. I don't know why Microsoft chose a different format, but the file type/extension is not LNK. @cyber... I totally respect your knowledge and abilities. Your way is correct and probably the easiest. But my way will work also I only posted again so that my script was correct and i could leave the incorrect info for someone to try and fix the code box thanks 8) EDIT after fixing all of my spelling errors... can i blame it on the phone...lol Edited May 22, 2006 by Valuater Link to comment Share on other sites More sharing options...
keyfinger Posted May 22, 2006 Author Share Posted May 22, 2006 Very interesting. You're right, the url extension works, but not the lnk extension. If I use the url extension, is there a way I can change the icon? Link to comment Share on other sites More sharing options...
keyfinger Posted May 22, 2006 Author Share Posted May 22, 2006 Also, how come the filegetshortcut doesn't work the same for a url lnk as it does for a file lnk? Link to comment Share on other sites More sharing options...
Valik Posted May 22, 2006 Share Posted May 22, 2006 Also, how come the filegetshortcut doesn't work the same for a url lnk as it does for a file lnk?Because a URL is not a "lnk" file. The extension on a shortcut to a URL is url, not lnk. It's not the same type of file. They are both "shortcuts" but they are not the same type of shortcut.They aren't the same, got it yet? Link to comment Share on other sites More sharing options...
keyfinger Posted May 22, 2006 Author Share Posted May 22, 2006 No, what I was talking about is when I do a FileCreateShortcut and use a URL as the target, AutoIt creates a .lnk file. So my question is why doesn't FileGetShortcut work the same way with getting the target path of the .lnk file with a URL target vs a FILE target?Try it, it doesn't create a .url file, it creates a .lnk file.FileCreateShortcut(http://www.autoitscript.com, @DesktopDir & "\AutoIT.lnk") Link to comment Share on other sites More sharing options...
Valik Posted May 23, 2006 Share Posted May 23, 2006 The answer to that question very likely lies in Redmond. I just tried every flag Microsoft provide for getting the path of a shortcut and none of them would return the URL. For whatever reason, it doesn't seem like the function we are using supports shortcuts with a URL. Link to comment Share on other sites More sharing options...
keyfinger Posted May 23, 2006 Author Share Posted May 23, 2006 Alright, how about this then. If I create the .URL file, which I CAN retrieve the target path, then is there a way to change the icon using AutoIT? Anyone? Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now