Intel91 Posted December 6, 2009 Posted December 6, 2009 I am trying to write an application to convert a Microsoft windows shortcut .lnk that references a .exe directory into a linux launcher that references that same directory file. All I need to know how to do is extract the location data from a .lnk shortcut. I can take care of the rest. I just can't find solid information anywhere on how this can be done. .lnk files are obfuscated if viewed in a text editor, I can see the obfuscation of the link and my brain can make out the directory, but I don't know how to make an application do this. Thanks, Intel
AdmiralAlkex Posted December 6, 2009 Posted December 6, 2009 So why don't you use FileGetShortcut()? .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface
Intel91 Posted December 7, 2009 Author Posted December 7, 2009 Thanks, I didn't realize that function existed, is that relatively new? One more thing How do I modify the text of a variable for example if [ $file = chrome.lnk ]then how do I make $file = "/chrome.lnk" without actually just saying $file = "/chrome.lnk", modifying it like (I know this doesn't work) [ $file = " + / + $file + " ] Here is my code so far: If Not _FileCreate("C:\Users\workingtext.txt") Then MsgBox(4096,"Error", " Error Creating/Resetting log. error:" & @error) EndIf ; Shows the filenames of all files in the current directory. $search = FileFindFirstFile("*.lnk*") ; Check if the search was successful If $search = -1 Then MsgBox(0, "Error", "No files/directories matched the search pattern") Exit EndIf While 1 $file = FileFindNextFile($search) If @error Then ExitLoop $details = FileGetShortcut(@DesktopDir & $file) <--Problem, this should be format "\place" but instead with $file is place alone no "\" exist _FileWriteFromArray("C:\Users\workingtext.txt", $details, 0, 1) <------Problem because the above $details is incorrectly formatted for proper return _ReplaceStringInFile("C:\Users\workingtext.txt", "C:\", "\home\") WEnd ; Close the search handle FileClose($search) Hopefully you can see what I'm doing. Trying to search for .lnk file in a directory (desktop for now) then right all those arrays to a text file one line each, then convert them by changing C:\ to my desired new location in the text file. Next comes write one line at a time to new text files, if 500 lines then 500 new text files. Then I will edit the .txt files for my needs(easy enough to do).
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