typeleven Posted August 3, 2010 Posted August 3, 2010 Im trying to use FileGetShortcut() to get the url in a .lnk file but the first spot in the array is blank. with this function not work on internet shortcuts? is there something that will extract the url from an internet shortcut?
tannerli Posted August 3, 2010 Posted August 3, 2010 (edited) Hi .url files are a different format than .lnk, so the FileGetShortCut() won't work on those. What you can try though is, since the .url's are built like INI-Files... $url = IniRead("AutoIT.url", "InternetShortcut", "URL", "-1") If $url = "-1" Then ConsoleWrite("There was an error" & @CRLF) Else ConsoleWrite("The url points to: " & $url & @CRLF) EndIf My output from running the above is: The url points to: http://www.autoitscript.com/ Cheers Edited August 3, 2010 by tannerli
tannerli Posted August 3, 2010 Posted August 3, 2010 Okay, this makes the whole thing a little more complicated... In my understanding, this lnk is not targeted to an executable directly as normally, but to some function located inside shell32.dll (at least it looks like this when you open the file in a Hex-Editor and compare it to a "normal" lnk) You also might want to compare it with a lnk generated by Microsoft Office setup, there you have a similar effect (But instead of shell32.dll, the GUID of the windows installer is called with some parameters) I also consulted the official documentation for the lnk-format by microsoft to get a clue on this... but this document's only purpose seems to be to screw up the readers mind... Long story short: FileGetShortcut() fails because the target is not directly stored inside the lnkfile. The effort to read it anyway is probably beyond what you had in mind. I for my part won't do this...
typeleven Posted August 3, 2010 Author Posted August 3, 2010 (edited) But these are .lnk files. Specifically they are made from the renamer.I can do what you are saying with a .url file but this is a .lnk file that has a url in it... very strange. Here is a screen shot of it for you...I have also attached the file to this post if you'd like to take a look at it.lnk file.zip Edited August 3, 2010 by typeleven
Ascend4nt Posted August 3, 2010 Posted August 3, 2010 I created a UDF to get this type of info from a .LNK file, as well as from MSI 'advertised shortcuts'. Its confusing with SHITEMID's and PIDL and whatnot, but basically shortcuts can point to just about anything it seems. You can have them point to 'fake' folders like the Recycle Bin or a Control Panel item and whatnot. UNC links are also issues. The code's a mess right now, but I might be persuaded to put it up. It will find URL's, GUID's and UNC paths, but it won't go any deeper (like extended UNC/GUID paths).. My contributions: Performance Counters in Windows - Measure CPU, Disk, Network etc Performance | Network Interface Info, Statistics, and Traffic | CPU Multi-Processor Usage w/o Performance Counters | Disk and Device Read/Write Statistics | Atom Table Functions | Process, Thread, & DLL Functions UDFs | Process CPU Usage Trackers | PE File Overlay Extraction | A3X Script Extract | File + Process Imports/Exports Information | Windows Desktop Dimmer Shade | Spotlight + Focus GUI - Highlight and Dim for Eyestrain Relief | CrossHairs (FullScreen) | Rubber-Band Boxes using GUI's (_GUIBox) | GUI Fun! | IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) | Magnifier (Vista+) Functions UDF | _DLLStructDisplay (Debug!) | _EnumChildWindows (controls etc) | _FileFindEx | _ClipGetHTML | _ClipPutHTML + ClipPutHyperlink | _FileGetShortcutEx | _FilePropertiesDialog | I/O Port Functions | File(s) Drag & Drop | _RunWithReducedPrivileges | _ShellExecuteWithReducedPrivileges | _WinAPI_GetSystemInfo | dotNETGetVersions | Drive(s) Power Status | _WinGetDesktopHandle | _StringParseParameters | Screensaver, Sleep, Desktop Lock Disable | Full-Screen Crash Recovery Wrappers/Modifications of others' contributions: _DOSWildcardsToPCRegEx (original code: RobSaunder's) | WinGetAltTabWinList (original: Authenticity) UDF's added support/programming to: _ExplorerWinGetSelectedItems | MIDIEx UDF (original code: eynstyne) (All personal code/wrappers centrally located at Ascend4nt's AutoIT Code)
typeleven Posted August 3, 2010 Author Posted August 3, 2010 Might you? I dont care how messy it is if it works! can I put in a path name into a function and have it return the url? that would be perfect!
Ascend4nt Posted August 3, 2010 Posted August 3, 2010 Here you go: _FileGetShortcutEx My contributions: Performance Counters in Windows - Measure CPU, Disk, Network etc Performance | Network Interface Info, Statistics, and Traffic | CPU Multi-Processor Usage w/o Performance Counters | Disk and Device Read/Write Statistics | Atom Table Functions | Process, Thread, & DLL Functions UDFs | Process CPU Usage Trackers | PE File Overlay Extraction | A3X Script Extract | File + Process Imports/Exports Information | Windows Desktop Dimmer Shade | Spotlight + Focus GUI - Highlight and Dim for Eyestrain Relief | CrossHairs (FullScreen) | Rubber-Band Boxes using GUI's (_GUIBox) | GUI Fun! | IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) | Magnifier (Vista+) Functions UDF | _DLLStructDisplay (Debug!) | _EnumChildWindows (controls etc) | _FileFindEx | _ClipGetHTML | _ClipPutHTML + ClipPutHyperlink | _FileGetShortcutEx | _FilePropertiesDialog | I/O Port Functions | File(s) Drag & Drop | _RunWithReducedPrivileges | _ShellExecuteWithReducedPrivileges | _WinAPI_GetSystemInfo | dotNETGetVersions | Drive(s) Power Status | _WinGetDesktopHandle | _StringParseParameters | Screensaver, Sleep, Desktop Lock Disable | Full-Screen Crash Recovery Wrappers/Modifications of others' contributions: _DOSWildcardsToPCRegEx (original code: RobSaunder's) | WinGetAltTabWinList (original: Authenticity) UDF's added support/programming to: _ExplorerWinGetSelectedItems | MIDIEx UDF (original code: eynstyne) (All personal code/wrappers centrally located at Ascend4nt's AutoIT Code)
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