Parsing properties in Link- and Internet Shortcut files

hakan at exformedia.se hakan at exformedia.se
Fri Feb 26 08:52:06 EST 2021


On macOS URL link files are stored as a plist-file like:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>URL</key>
	<string>https://lessons.livecode.com/</string>
</dict>
</plist>

So you can open the file as text and then parse the content.

:-Håkan
On 12 Feb 2021, 18:55 +0100, R.H. via use-livecode <use-livecode at lists.runrev.com>, wrote:
> 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