Parsing properties in Link- and Internet Shortcut files

matthias_livecode_150811 at m-r-d.de matthias_livecode_150811 at m-r-d.de
Fri Feb 26 10:26:27 EST 2021



I tried here to find an "empty" .url file, but w/o success. My .url files i have collected over the years on my Windows VM are all textfiles. If you could provide a link to such an empty one, i would be really interested to see that.

Regarding the .lnk files, which seem to be in a binary form, did you already see this discussion here?
https://stackoverflow.com/questions/397125/reading-the-target-of-a-lnk-file-in-python

Someone posted a Python script there which is able to read the target of an .lnk file.
May be that is an alternative.

Matthias




-
Matthias Rebbe
Life Is Too Short For Boring Code

> Am 12.02.2021 um 18:53 schrieb R.H. via use-livecode <use-livecode at lists.runrev.com>:
> 
> I am on Windows 10 (but answer will apply to MacOS as well).
> 
> I am trying to read the URL property of a file that I create simply
> dragging-dropping the Internet address from my browser to the Desktop and
> then storing this file. There are thousands now!!!
> 
> Some of such files are readable text files with the readable content
> "[internetshortcut], URL: xxx etc." -- but most Internet shortcut files on
> Windows with the invisible .url or .ink extension are empty when trying to
> read with using a text editor or opening them in LiveCode.
> 
> In such Windows file's there is a property url:<link> that contains the web
> address. It is visible when opening using the right mouse button (context
> menu) and then selecting the "properties" item. When double-clicking such
> file, the default browser will open and open the web page directed to.
> 
> But I want to read this URL property as text directly and use it from
> within LiveCode.
> 
> I assume that these Internet shortcuts store the URL information not in the
> file itself, or I just cannot get to this information.
> 
> I found one batch file script that promises such a solution. Such batch
> text file can be called through the SHELL() command and will then execute.
> It has the file extension ".bat".
> 
> #-- START BATCH SCRIPT
> echo off
> setlocal enableextensions enabledelayedexpansion
> pushd %1
> for %%F in (%1\*.url) do (
>   echo %%~dpnxF
>   call :findurl "%%~dpnxF"
> )
> popd
> goto end
> :findurl inputfile
> set url=
> for /f "tokens=2 delims==" %%i in ('findstr URL %1') do set url=%%i
> echo %url%
> echo -----
> :end
> #-- END BATCH SCRIPT
> 
> Unfortunately, my knowledge of such batch scripts is very limited.
> 
> I get error messages when calling the batch file through the shell
> function. Maybe there is someone here who can interpret this script? To me
> it would be sufficient to simply call shell("location of the file and file
> name of the url-file .. shell commands") and receive back the URL property
> as text. Or is there any other way to get to this information?
> 
> Since LC is cross-platform, such solution also would be nice to have for
> OSX and Linux?
> 
> Regards, Roland
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list