mattslav Posted September 17, 2004 Posted September 17, 2004 I tried: FileCreateShortcut ("http://www.yahoo.com", @USERPROFILEDIR & "\Favorites") and it says the target cannot be found. What do I need to do?
SlimShady Posted September 17, 2004 Posted September 17, 2004 (edited) CreateURLShortcut (@DesktopDir & "\AutoIt.url", "http://www.autoitscript.com") Func CreateURLShortcut ($File, $URL) $Content = "[InternetShortcut]" & @LF & "URL=" & $URL & @LF & @CRLF $OpenShortcut = FileOpen($File, 2) If $OpenShortcut = -1 Then FileClose($OpenShortcut) Return -1 EndIf FileWrite($OpenShortcut, $Content) FileClose($OpenShortcut) Return 0 EndFunc ;==>CreateURLShortcut Edited September 17, 2004 by SlimShady
Valik Posted September 17, 2004 Posted September 17, 2004 Slim, you could of done that another way, specifically, in one line (Without even wrapping it in a function!). IniWrite(@DesktopDir & "\AutoIt.url", "InternetShortcut", "URL", "www.autoitscript.com") Also, until Jon changes it, calling FileClose() on a handle of -1 produces a script aborting error, so I don't recommend doing that.
SlimShady Posted September 17, 2004 Posted September 17, 2004 Also, until Jon changes it, calling FileClose() on a handle of -1 produces a script aborting error, so I don't recommend doing that. <{POST_SNAPBACK}>FileOpen($File, 2) I assume the folder where the user wants the file to be written, is accessible. The problem you mentioned often occurs when reading a file that doesn't exist.
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