Tested on Windows 10:
I now found and tested the batch file script that works now:
Create a batch file, for example "GetURL.bat"
Edit the file with a text editor (Notepad++ or whatever)
Put the following script into this file:
:: START OF SCRIPT -- comment line
@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 OF SCRIPT -- comment line
Save the file and place it for this demo in the C:\folder (which is
accessible for admins only. Otherwise use a "documents/..." folder.
-- Usage
When calling the .bat file here we assume that the .bat file is in the C:\
directory .
...Calling from Windows CMD opened with Administrator rights:
C:\GetURL.bat "C:\Users\<your username>\Desktop\Links"
This assumes that there is a folder "Links" on the desktop containing the
Internet shortcut file (hidden file extension .url) and that you want to
read the content of the URL plus the filename.
-- Now, we can call the .bat file from LiveCode with a little script in a
test button:
on mouseUp
# Example script to call the .bat file:
set the hideconsolewindows to true
put "C:\GetURL.bat" into tCmd -- Calling the commands in the .bat file
put "C:\Users\Rolan\Desktop\Links" into tFolder -- The folder containing
Internet Shortcut files .url
put tCMD && tFolder into tCommand
put shell (tCommand) into msg --x Could be messages box or any field...
end mouseUp
-- Example output in the message box (a list of .url files with the
content of their url)
The script in the .bat file looks at all files with a .url extension in the
folder specified and returns the name and the URL content of that file.
Each record is separated by three "---".
C:\Users\Roland\Desktop\Links\simultaneous multiple database access -
LiveCode Forums.url
https://forums.livecode.com/viewtopic.php?t
---
C:\Users\Roland\Desktop\Links\Sons of Thunder Software - Developer
Resources - LiveCode.url
http://www.sonsothunder.com/devres/livecode/livecode.htm
---
C:\Users\Roland\Desktop\Links\Sons of Thunder Software - Products.url
http://www.sonsothunder.com/products/products.htm
---
Please, if there is anything for Mac (OSX) and Linux, we could publish this
in the Forum.
Roland
P.S: I will also check how to read the local .ink files that are shortcuts
to files and folder in Windows. It should also be possible using this for
".ini" files.
_______________________________________________
use-livecode mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode