Re: Parsing properties in Link- and Internet Shortcut files

2021-03-01 Thread Rick Harrison via use-livecode
Hi Matthias,

Yes, I meant lcMailAndFtp.livecode.

I’m looking at https://www.techstrategies.com.au/tsnet-resources/ 
 now.

I’ll get back to you later after absorbing what I can understand.

Thanks!

Rick



> On Mar 1, 2021, at 12:38 PM, matthias rebbe via use-livecode 
>  wrote:
> 
> Rick,
> 
> do you mean the stack lcMailAndFtp.livecode?
> 
> The original stack was created by Charles Warwick, the developer of the tsNet 
> externals.
> If i remember correctly, i added the FTP part or so and put that modified 
> stack as lcMailAndFtp.livecode online.
> 
> You could look here for a newer version (1.2) of Charles mail sample stack.
> https://www.techstrategies.com.au/tsnet-resources/
> 
> Although the version 1.2 of the mail stack is more current then the one from 
> my site, it still is a little bit "outdated".
> There is a new command in LC available called mimeEncodeAsMIMEEmail which 
> would make some of the code in the sample stack obsolete if it would be used. 
> But the sample stack from Techstrategies should still work.
> 
> If you still have problems you can contact me also directly at   matthias 
> (at) m-r-d.de
> 
> Regards,
> 
> Matthias
> 
>> Am 01.03.2021 um 17:49 schrieb Rick Harrison via use-livecode 
>> :
>> 
>> Hi Matthias,
>> 
>> I ran into your send email stack with TSNet
>> yesterday while looking for a solution to
>> some of my livecode email problems.  
>> After filling in the test fields to send a message
>> and hitting the send button, it told me the
>> message was sent, but upon checking my
>> email it was clear that it never got sent.
>> 
>> I know you put that stack together in 2017
>> so some things have changed since then
>> including macOS.  
>> 
>> Have you tested the stack recently at all 
>> and do you know if it still works?  
>> 
>> If so, the other possibility is that I have 
>> somehow not filled in one of the fields properly.  
>> Could you supply a better example using 
>> gmail smtp settings or something similar,
>> or update the documentation?
>> 
>> Thanks,
>> 
>> Rick
>> 
>> 
>>> On Feb 26, 2021, at 10:26 AM, matthias rebbe via use-livecode 
>>>  wrote:
>>> 
>>> 
>>> 
>>> 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
>>> 
>>> 
>> 
>> 
>> ___
>> use-livecode mailing list
>> use-livecode@lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your subscription 
>> preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
> 
> 
> 
> -
> Matthias Rebbe
> Life Is Too Short For Boring Code
> 
> 
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Parsing properties in Link- and Internet Shortcut files

2021-03-01 Thread matthias rebbe via use-livecode
Rick,

do you mean the stack lcMailAndFtp.livecode?

The original stack was created by Charles Warwick, the developer of the tsNet 
externals.
If i remember correctly, i added the FTP part or so and put that modified stack 
as lcMailAndFtp.livecode online.

You could look here for a newer version (1.2) of Charles mail sample stack.
https://www.techstrategies.com.au/tsnet-resources/

Although the version 1.2 of the mail stack is more current then the one from my 
site, it still is a little bit "outdated".
There is a new command in LC available called mimeEncodeAsMIMEEmail which would 
make some of the code in the sample stack obsolete if it would be used. But the 
sample stack from Techstrategies should still work.

If you still have problems you can contact me also directly at   matthias (at) 
m-r-d.de

Regards,

Matthias

> Am 01.03.2021 um 17:49 schrieb Rick Harrison via use-livecode 
> :
> 
> Hi Matthias,
> 
> I ran into your send email stack with TSNet
> yesterday while looking for a solution to
> some of my livecode email problems.  
> After filling in the test fields to send a message
> and hitting the send button, it told me the
> message was sent, but upon checking my
> email it was clear that it never got sent.
> 
> I know you put that stack together in 2017
> so some things have changed since then
> including macOS.  
> 
> Have you tested the stack recently at all 
> and do you know if it still works?  
> 
> If so, the other possibility is that I have 
> somehow not filled in one of the fields properly.  
> Could you supply a better example using 
> gmail smtp settings or something similar,
> or update the documentation?
> 
> Thanks,
> 
> Rick
> 
> 
>> On Feb 26, 2021, at 10:26 AM, matthias rebbe via use-livecode 
>>  wrote:
>> 
>> 
>> 
>> 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
>> 
>> 
> 
> 
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode



-
Matthias Rebbe
Life Is Too Short For Boring Code


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Parsing properties in Link- and Internet Shortcut files

2021-03-01 Thread matthias rebbe via use-livecode
Hi Matthias,

I ran into your send email stack with TSNet
yesterday while looking for a solution to
some of my livecode email problems.  
After filling in the test fields to send a message
and hitting the send button, it told me the
message was sent, but upon checking my
email it was clear that it never got sent.

I know you put that stack together in 2017
so some things have changed since then
including macOS.  

Have you tested the stack recently at all 
and do you know if it still works?  

If so, the other possibility is that I have 
somehow not filled in one of the fields properly.  
Could you supply a better example using 
gmail smtp settings or something similar,
or update the documentation?

Thanks,

Rick


> On Feb 26, 2021, at 10:26 AM, matthias rebbe via use-livecode 
>  wrote:
> 
> 
> 
> 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
> 
> 


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


-
Matthias Rebbe
Life Is Too Short For Boring Code


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Parsing properties in Link- and Internet Shortcut files

2021-03-01 Thread Rick Harrison via use-livecode
Hi Matthias,

I ran into your send email stack with TSNet
yesterday while looking for a solution to
some of my livecode email problems.  
After filling in the test fields to send a message
and hitting the send button, it told me the
message was sent, but upon checking my
email it was clear that it never got sent.

I know you put that stack together in 2017
so some things have changed since then
including macOS.  

Have you tested the stack recently at all 
and do you know if it still works?  

If so, the other possibility is that I have 
somehow not filled in one of the fields properly.  
Could you supply a better example using 
gmail smtp settings or something similar,
or update the documentation?

Thanks,

Rick


> On Feb 26, 2021, at 10:26 AM, matthias rebbe via use-livecode 
>  wrote:
> 
> 
> 
> 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
> 
> 


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Parsing properties in Link- and Internet Shortcut files

2021-02-27 Thread R.H. via use-livecode
@ Hagan
@ Matthias

I posted my hack on the forum also mentioning our discussion here:

https://forums.livecode.com/viewtopic.php?f=7&t=35458

Of course, if some one has clean solution to actually read Window's binary
".lnk" file, it would be another lesson to enjoy. Unfortunately, I cannot
do it now because of time constraints. But the solution works (for me).

Roland
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re. Parsing properties in Link- and Internet Shortcut files

2021-02-26 Thread R.H. via use-livecode
@ Matthias

Windows 10 with "ink" and "url" files:

Thank you very much for the link regarding ".lnk" files. I did not see this
before. I will look into it. I also checked the binary format as published
by Microsoft. I just answered Hakan without having read your suggestion. )
Sorry that I did not read your message before.

Regarding the empty files (maybe they could just not be read in LC for
whatever reason): Unfortunately, I have deleted them all. They had
assembled for years and I extracted their links with the Batch and stored
the links in a database.

Testing with different browsers dragging the Internet links, for the moment
there is no problem reading with such ".url" files. So, the problem may
have be very specific to my system and may not need further attention. If I
still find such file then I will it send to you. No problem.

Thanks to all here for attending
Roland
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Parsing properties in Link- and Internet Shortcut files

2021-02-26 Thread R.H. via use-livecode
Dear Hakan

Thank you very much for this information. As you may have noticed, I had
solved the problem using the Batch file the same day I posted the question
for Windows.

For Mac, I had no idea and your input is highly appreciated. For Linux I
also do not know.

Actually, these special files on Windows (with the hidden ".url" extension)
are usually fine to read simply using URL("binfile:" & tFilePath ). My
problem has be with a number of files that returned empty for unknown
reasons.

It is a more difficult to parse "shortcut" or ".lnk" files in Windows since
they have a binary format and to extract relevant information requires
knowing the detailed file structure and reading relevant bytes or trying a
hack to extract the readable links they represent without (which I did so
far). Also for these files, Windows hides the extension ".lnk", but it is
visible when calling files (tFolderpath) in LiveCode.

Happy weekend
Roland

On Fri, Feb 26, 2021 at 2:52 PM  wrote:

> On macOS URL link files are stored as a plist-file like:
> 
>  http://www.apple.com/DTDs/PropertyList-1.0.dtd";>
> 
> 
> URL
> https://lessons.livecode.com/
> 
> 
>
> 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@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: 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@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Parsing properties in Link- and Internet Shortcut files

2021-02-26 Thread matthias rebbe via use-livecode



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 
> :
> 
> 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: 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@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Parsing properties in Link- and Internet Shortcut files

2021-02-26 Thread Håkan Liljegren via use-livecode
On macOS URL link files are stored as a plist-file like:

http://www.apple.com/DTDs/PropertyList-1.0.dtd";>


URL
https://lessons.livecode.com/



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 
, 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: 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@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Parsing properties in Link- and Internet Shortcut files -- SOLVED for Windows 10 -- Added remarks

2021-02-12 Thread R.H. via use-livecode
Hi there

Windows 10:

The .bat file is required for those .url files that do not give you a text
when opening (and that was the problem).
Some of the .url files can also simply be read using this sample script.
(And these specific files cannot be read with the .bat file as I seem to
recognize. Further testing is needed.)

on mouseUp  local tFilePath
 ask "Please paste the file path"
 if it is not empty then put it into tFilePath
 put URL("binfile:"&tFilePath) into msg
end mouseUp

You must provide the filepath with the filename.
The result (as an example):

Example output for .url file (same file not readable with the .bat)
   [InternetShortcut]
   URL=https://cosi.lino-framework.org/tour/index.html

Greetings, Roland


On Fri, Feb 12, 2021 at 11:11 PM R.H.  wrote:

> 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\\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
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Parsing properties in Link- and Internet Shortcut files -- SOLVED for Windows 10

2021-02-12 Thread R.H. via use-livecode
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\\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
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Parsing properties in Link- and Internet Shortcut files

2021-02-12 Thread R.H. via use-livecode
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: 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@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode