Jump to content



Photo

_FileGetShortcutEx


  • Please log in to reply
2 replies to this topic

#1 Ascend4nt

Ascend4nt

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 1,073 posts

Posted 03 August 2010 - 11:01 PM

_FileGetShortcutEx



This UDF will return shortcut (.LNK) file information for more advanced shortcuts that AutoIt's built-in FileGetShortcut() chokes on.

The following types of shortcuts can be retrieved using this function:
  • MSI Advertised Shortcuts
  • URL (website) Shortcuts that are embedded (rather than put in a .URL file)
  • Special GUID Shell Item Shortcuts. This is only one level deep at the moment, so it will only read the base Folder GUID (For example: shortcuts to 'My Computer', 'Recycle Bin' return fine)
  • UNC Shortcuts ("\\PCNAME"). This is also only one level deep currently, so "\\PCNAME\Folder" shortcuts will fail
  • (as well as regular shortcuts, of course)
Operation is simple: call '_FileGetShortcutEx("filename")' to get an array that is arranged the same as FileGetShortcut().

Included in the ZIP are two examples of shortcuts that AutoIt will fail on, but this function will work on. I don't have any MSI Advertised shortcut examples, but I believe Microsoft Office and ACDSee shortcuts both use these shortcuts types which return wonky results using AutoIt's function.

Thanks go out to Prog@ndy for the original '_FileGetShortcutEx' function and MSI shortcut code (which I converted for Unicode). See my original post here for his code.

*Special note on 'Normal' Internet shortcuts: While this UDF only looks at .LNK shortcuts (what you use FileGetShortcut() with), some confuse .URL Internet shortcuts with these types, so I decided I'd put a solution for those interested on how to get a URL Internet shortcut. It's actually so simple it can be done in one line, so here it is (note the .URL extension):

$sURL=IniRead(@UserProfileDir&"\Favorites\Google.URL","InternetShortcut","URL","")



Ascend4nt's AutoIT Code License agreement:
While I provide this source code freely, if you do use the code in your projects, all I ask is that:
  • If you provide source, keep the header as I have put it, OR, if you expand it, then at least acknowledge me as the original author, and any other authors I credit
  • If the program is released, acknowledge me in your credits (it doesn't have to state which functions came from me, though again if the source is provided - see #1)
  • The source on it's own (as opposed to part of a project) can not be posted unless a link to the page(s) where the code were retrieved from is provided and a message stating that the latest updates will be available on the page(s) linked to.
  • Pieces of the code can however be discussed on the threads where Ascend4nt has posted the code without worrying about further linking.

Download the ZIP from my site


Edited by Ascend4nt, 14 September 2011 - 02:35 AM.








#2 KaFu

KaFu

    Hey, it's just me, KhaFoo...

  • MVPs
  • 3,166 posts

Posted 03 August 2010 - 11:07 PM

Snatched :blink:, just gimme 10 minutes to integrate it into the next SMF release ;).

#3 Ascend4nt

Ascend4nt

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 1,073 posts

Posted 03 August 2010 - 11:14 PM

haha you're fast. Bear in mind this was sort of an old script, and I didn't do much in the way of cleanup. I just decided to post it as-is since I wanted to help someone out. Didn't think it'd be of much use to anyone else, but l guess I was wrong :blink:




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users