Jump to content

FileGetShortcut does not retrieve url target info


Recommended Posts

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

put this in the script

$Url = "http://www.autoitscript.com/forum/index.php?act=idx"
        DllCall("shell32.dll", "long", "ShellExecute", "hwnd", 0, "string", &apos;open&apos;, "string", $Url, "string", &apos;&apos;, "string", @ScriptDir, "long", @SW_SHOWNORMAL)

then compile it

then create the shortcut... with your script

or create the shortcut within the script... then compile it

hey DEV's ... jon

the Autoit code tags create errors

8)

Edited by Valuater

NEWHeader1.png

Link to comment
Share on other sites

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 by Valuater

NEWHeader1.png

Link to comment
Share on other sites

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

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 by Valuater

NEWHeader1.png

Link to comment
Share on other sites

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

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

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

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...