Standalone through Remote Desktop access and VMs

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

AlbertAA
Posts: 41
Joined: Thu May 28, 2020 1:42 pm

Re: Standalone through Remote Desktop access and VMs

Post by AlbertAA » Fri Apr 16, 2021 2:12 am

Thank you very much, Elanor. This was very helpful and it works fine. With your code I am now able to launch webpages from a HTML5 standalone.

Now, what I really need is something similar to be able to do what you described in your Lesson: Import/read the text of a webpage of type "https://www. ... .txt" into a LiveCode variable in a way which works also on a HTML5 standalone.

Is there such a short and elegant script for that too?
... or where in the HTML5 documentation can I find some more of the info I need to try to make it myself?

Thank you
-albert

Please consider that one reason for me to start seriously consider the HTML5 version of LiveCode is that I like the idea not to have to learn java.

elanorb
Livecode Staff Member
Livecode Staff Member
Posts: 516
Joined: Fri Feb 24, 2006 9:45 am

Re: Standalone through Remote Desktop access and VMs

Post by elanorb » Fri Apr 16, 2021 3:38 pm

Hi Albert

If the file you want to load is on the same server as the HTML5 standalone you should be able to use put url, get url and load url.

There is an example here.

https://elanorb.on-rev.com/techsupport/ ... tTest.html

"put url" button code

Code: Select all

on mouseUp
   local tData
   
   put url "https://elanorb.on-rev.com/techsupport/putexample/testfile.txt" into tData
   put tData into field "content"
end mouseUp
"get url" button code

Code: Select all

on mouseUp
   local tData
   
   get url "https://elanorb.on-rev.com/techsupport/putexample/testfile.txt"    
   put it into field "content"
end mouseUp
"load url" button code

Code: Select all

on mouseUp
   load url "https://elanorb.on-rev.com/techsupport/putexample/testfile.txt"  with message "callBackHandler"
end mouseUp

on callBackHandler pURL, pStatus
   if pStatus is "cached" then
      put URL pURL into field "content"
   else if pStatus is "error" then
      put libURLErrorData(pURL) into field "content"     
   end if
end callBackHandler
If you want to access files that are not on your server you will probably run into cross origin issues(CORS).

If you have an example of a particular resource you think should be accessible that is not working please let us know.

I hope that helps.

Kind regards

Elanor
Elanor Buchanan
Software Developer
LiveCode

AlbertAA
Posts: 41
Joined: Thu May 28, 2020 1:42 pm

Re: Standalone through Remote Desktop access and VMs

Post by AlbertAA » Fri Apr 16, 2021 8:03 pm

Thank you very much again, Elanor. You are very helpful - and sorry not to have got your point earlier :)

For the test I am working on, not to be able to access files on the Internet from a HTML5 Standalone is a constraint which can be easily bypassed (just by changing the location of some files on the server). Will definitely test, and the solution/code you have shared should solve all my problems.

What I am worried about are my all my main applications, because my PC and Widows Standalones make extensive use of:
> accessing Internet files to fetch data (not just from files on my server)
> using ftp to store files in another server of mine located in a totally different domain
I realize that all this will NOT be possible with the HTML5 Standalone, or only under the very limiting conditions you described. Not happy, but good to know.

I also realize (hope I do not interpret incorrectly) that given this constraint it also becomes very critical WHERE to position the HTML5 Standalones. To reduce risks I was planning to rather place HTML5 standalones on test servers (where they would not interfere with other running processes), but then my HTML5 Standalones would be are pretty "disconnected" (unable to interact with all the files I have on my other servers).

Thank you again
-albert

elanorb
Livecode Staff Member
Livecode Staff Member
Posts: 516
Joined: Fri Feb 24, 2006 9:45 am

Re: Standalone through Remote Desktop access and VMs

Post by elanorb » Sun Apr 18, 2021 8:59 pm

Hi Albert,

I am glad that was some help. If you have control of the servers you should be able to enable cross origin requests from specific other domains like your test server to ftp domain.

For files on other servers it may be that they are available to you, REST APIs etc are usually set up to allow access.

You might get some good advice on the HTML5 specific board from other users who have been working with HTML5 apps.

Kind regards

Elanor
Elanor Buchanan
Software Developer
LiveCode

AlbertAA
Posts: 41
Joined: Thu May 28, 2020 1:42 pm

Re: Standalone through Remote Desktop access and VMs

Post by AlbertAA » Mon Apr 19, 2021 12:14 pm

Sorry to have to come back, Elanor, but I did some testing and still need help:

1. I implemented a stack in which there are 2 Buttons using your "load" method to access 2 txt files. It can be called from:
https://www.alpha-simulations.com/AAAIN ... /Test.html

2. The first button tries to open a txt file which is located in the same directory of my server where I placed the HTML5 standalone:
http://www.alpha-simulations.com/AAAINS ... Report.txt

AlbertAA
Posts: 41
Joined: Thu May 28, 2020 1:42 pm

Re: Standalone through Remote Desktop access and VMs

Post by AlbertAA » Mon Apr 19, 2021 12:22 pm

3. The second button tries to call a txt file which is in a different directory (but on the same server):
https://www.alpha-simulations.com/DelSN ... Report.txt

RESULTS: The stack executes well, both buttons work and copy the text into the field.
BUT the HTML Standalone returns "Request failed 0".

What I am doing wrong? Am I understanding wrongly your statement "on the same server as the HTML5 standalone"?

AlbertAA
Posts: 41
Joined: Thu May 28, 2020 1:42 pm

Re: Standalone through Remote Desktop access and VMs

Post by AlbertAA » Mon Apr 19, 2021 12:24 pm

... and correct URL of the second text file I am trying to access is:
https://www.alpha-simulations.com/DelSN ... Report.txt

elanorb
Livecode Staff Member
Livecode Staff Member
Posts: 516
Joined: Fri Feb 24, 2006 9:45 am

Re: Standalone through Remote Desktop access and VMs

Post by elanorb » Mon Apr 19, 2021 4:34 pm

Hi Albert,

Can you post the code of your buttons? Have you tried put, or get, instead of load?

Thanks

Elanor
Elanor Buchanan
Software Developer
LiveCode

AlbertAA
Posts: 41
Joined: Thu May 28, 2020 1:42 pm

Re: Standalone through Remote Desktop access and VMs

Post by AlbertAA » Mon Apr 19, 2021 4:57 pm

Yes. Here I copy/pasted the script of the first button:

on mouseUp
--load url "https://elanorb.on-rev.com/techsupport/ ... stfile.txt" with message "callBackHandler"
load url "https://www.alpha-simulations.com/AAAIN ... Report.txt" with message "callBackHandler"

end mouseUp

on callBackHandler pURL, pStatus
if pStatus is "cached" then
put URL pURL into field "repField"
else if pStatus is "error" then
put libURLErrorData(pURL) into field "repField"
end if
end callBackHandler

The second button is the same, besides the change in URL to "https://www.alpha-simulations.com/DelSN ... Report.txt"

I confirm that they work properly and return the text from the files, except for the HTML5 standalone version.

Btw, if you check it again you will see that I have added 2 buttons with the "launch" method you provided, and they both work well in the HTML5 standalone too.

AlbertAA
Posts: 41
Joined: Thu May 28, 2020 1:42 pm

Re: Standalone through Remote Desktop access and VMs

Post by AlbertAA » Mon Apr 19, 2021 6:19 pm

In the last version I inserted also a Get and a Put button.
Again, they work correctly, except in the HTML5 Standalone where they both return empty (in both cases the target field becomes empty).

elanorb
Livecode Staff Member
Livecode Staff Member
Posts: 516
Joined: Fri Feb 24, 2006 9:45 am

Re: Standalone through Remote Desktop access and VMs

Post by elanorb » Tue Apr 20, 2021 11:09 am

Hi Albert,

Your code looks ok. I did a test, with a copy of your file, on my server and it worked ok. I will attach my test stack which you can change to your file URL.

https://elanorb.on-rev.com/techsupport/ ... tTest.html

The test stack includes some answer dialogs to check the result which might give a clue to the issue. There is also a bug report related to certain characters causing issues when displayed in an HTML5 app. I wonder if this might be related.

https://quality.livecode.com/show_bug.cgi?id=23170

In the "Get Test 2" button I display the contents in an answer dialog before trying to display in the field, if it displays in the answer dialog but not the field that might mean the bug is affecting you.

Kind regards

Elanor
Attachments
AlbertTest.livecode.zip
(2.16 KiB) Downloaded 135 times
Elanor Buchanan
Software Developer
LiveCode

AlbertAA
Posts: 41
Joined: Thu May 28, 2020 1:42 pm

Re: Standalone through Remote Desktop access and VMs

Post by AlbertAA » Wed Apr 21, 2021 10:44 am

Thank you a lot again, Elanor, particularly for your patience. With your last post and download I was able to realize that:

1. All the scripts you were sending are working correctly now also on my server.
2. The problem was/is with the .txt files I was trying to import text from. They contain something that does not disturb LC in general, but disturbs/blocks the HTML5 standalones.
3. There was also a problem with the field in MY stack, which probably occurred after importing text with strange characters.

I still have to find out what the problem is with my txt files which causes HTML5 to crash (these files are actually created by a different LC App) but now it is clear that the problem is not on the HTML standalone side or the scripts to access txt files on the web. I will definitely report what I learned about my "bad" files once I have found it out.

Thank you again. In spite of its limitations I start liking the HTML5 standalone feature. But what really makes the difference is the great quality of the support one gets in this forum.

-albert

elanorb
Livecode Staff Member
Livecode Staff Member
Posts: 516
Joined: Fri Feb 24, 2006 9:45 am

Re: Standalone through Remote Desktop access and VMs

Post by elanorb » Wed Apr 21, 2021 11:45 am

Hi Albert,

I'm glad to hear that got you a bit further forward. If you could possibly send the original text file to support@livecode.com I'll do some testing and report a bug.

Kind regards

Elanor
Elanor Buchanan
Software Developer
LiveCode

AlbertAA
Posts: 41
Joined: Thu May 28, 2020 1:42 pm

Re: Standalone through Remote Desktop access and VMs

Post by AlbertAA » Thu Apr 22, 2021 11:30 am

Still looking for the problem. I have now 2 txt files in the same location (both can be easily accessed/read on the Web):

1. https://www.alpha-simulations.com/DelSN ... Report.txt
2. https://www.alpha-simulations.com/DelSN ... nAndUp.txt
  • The first file blocks the HTML5 standalone (when using LOAD, GET or PUT).
    The second works fine with the HTML 5 standalone too (using LOAD, but PUT and GET work too).
  • The first file is an example of the typical report files generate by my LC app (using open file for write, then writing in it some text (around 40/50K), then closing it, and finally transferring it to the server location via ftp).
    The second file is simply the result of downloading the first file (with Filezilla), just changing its Name (adding "DownAndUp"), and then uploading it again in the same location (with FileZilla).
What is surprising to me is that the 2 files are identical in terms of content, even if you look into their HEX coding. I am starting to think that there is something in the file metadata which causes the problem (for the HTML5 standalone).

Another test I have done is to download the first file (via FileZilla) and (without any changes) upload it again, but to a different directory (DelPDF rather than DelSNAPS)on the server. In this case the HTML5 standalone works. Probably the downloading itself changes some of the file characteristics, or removes the "problem" (which unfortunately I have not really identified as there are no differences in content between the these files).You can access the file at:
1. https://www.alpha-simulations.com/DelPD ... Report.txt

Will keep you informed. My challenge now is to change the original LC app which creates these report files (perhaps differently) so that they become readable also by the HTML5 standalone, which seems to see a difference between files which from my perspective are identical.

-albert

AlbertAA
Posts: 41
Joined: Thu May 28, 2020 1:42 pm

Re: Standalone through Remote Desktop access and VMs

Post by AlbertAA » Thu Apr 22, 2021 2:43 pm

My currect hypothesis is that the problem might be rooted on how I send the file to the server:

put "ftp://" & FTPUSER & ":" & FTPPASS & "@" & "ftp.cluster002....//{details removed}/DelSNAPS/" & ftpzipCreated into tDestination
libURLftpUploadFile zipCreatedFull, tDestination, "uploadComplete"

These lines work perfectly well since years. But now I notice that using "ftp" rather than "ftps" might be what causes the difference between the 2 apparently identical files.

Now, if I add an "s" to ftp in the line above, it does not execute well/transfer the file.
What I could try is to move from FTP to FTPS (or directly to SFTP?), modify the address above and see if this resolves the issue. I hope I succeed, and that users with previous versions (with the 2 lines above calling ftp) will not have problems.

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”