Pop up's in the Browser Widget
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Posts: 7
- Joined: Tue Mar 27, 2018 4:33 pm
Pop up's in the Browser Widget
Hello,
I am using the internet browser widget to load a web page. There is a link on the web page that, when clicked in a normal browser, opens another internet window and the file is automatically downloaded from a temp folder on the website. Pop up's must be enabled in the browser (Chrome) for the download window to appear. Whenever I run the code to simulate the pressing of the link in the browser widget, a loading symbol appears just like when I clicked the link in a normal Chrome window, but now no download window pops up nor is anything downloaded - just like when pop up's are disabled for a normal chrome window and the button is pressed.
I wanted to know how I could simulate a pop up window or open another browser widget with the download window displayed as well as download the file
The code I am using to simulate a button press is below
do "onclick="getMosPublishedVersionExcel('45-1523-1');" in widget "Browser"
The web address of the window that pops up with the download is a temporary address, but if I could somehow get that address within the program then I could just launch that URL and the file would download. Any insight/help would be great appreciated.
Thanks
I am using the internet browser widget to load a web page. There is a link on the web page that, when clicked in a normal browser, opens another internet window and the file is automatically downloaded from a temp folder on the website. Pop up's must be enabled in the browser (Chrome) for the download window to appear. Whenever I run the code to simulate the pressing of the link in the browser widget, a loading symbol appears just like when I clicked the link in a normal Chrome window, but now no download window pops up nor is anything downloaded - just like when pop up's are disabled for a normal chrome window and the button is pressed.
I wanted to know how I could simulate a pop up window or open another browser widget with the download window displayed as well as download the file
The code I am using to simulate a button press is below
do "onclick="getMosPublishedVersionExcel('45-1523-1');" in widget "Browser"
The web address of the window that pops up with the download is a temporary address, but if I could somehow get that address within the program then I could just launch that URL and the file would download. Any insight/help would be great appreciated.
Thanks
-
- Posts: 7
- Joined: Tue Mar 27, 2018 4:33 pm
Re: Pop up's in the Browser Widget
I believe I found a solution to the previous issue - but another has arisen.
I used browserNewUrlWindow pUrl to get the url of the new window and then set the url of the current browser to that one. This downloads the file, but now I am having trouble automatically saving the file that it downloads without having any user input.
I used browserNewUrlWindow pUrl to get the url of the new window and then set the url of the current browser to that one. This downloads the file, but now I am having trouble automatically saving the file that it downloads without having any user input.
Re: Pop up's in the Browser Widget
I'm not sure most users would want a program surreptitiously downloading and saving files to their systems without their input. Any web browser at least prompts asking what you want to do with any files that request download, with out some kind of prompt, it might appear to be 'sneaky'.gavin.funderburg wrote: ↑Tue Mar 27, 2018 7:34 pmbut now I am having trouble automatically saving the file that it downloads without having any user input.
-
- Posts: 7
- Joined: Tue Mar 27, 2018 4:33 pm
Re: Pop up's in the Browser Widget
You are certainly right that most users would not want that. However, I am writing a very specific program for my boss's use only in which he has outlined certain functionality that he wishes to see. Among those functionalities is for the program to download and save the file without his having to save it to a specific location and then browse his computer to upload it to the program.
The file is a schematic from our company website and in no way could be malicious or sneaky, though I understand the concern.
The file is a schematic from our company website and in no way could be malicious or sneaky, though I understand the concern.
Re: Pop up's in the Browser Widget
If I follow the point of the program, and you want to get a file from your server and put it directly into Lc without prompting, why use a browser at all? Why not, for instance, just use 'get URL "http://www.yourServerAddress.com/yourFile" ', which will allow you to put it directly into whatever container your planning to put it.gavin.funderburg wrote: ↑Wed Mar 28, 2018 12:39 pmAmong those functionalities is for the program to download and save the file without his having to save it to a specific location and then browse his computer to upload it to the program.
-
- Posts: 7
- Joined: Tue Mar 27, 2018 4:33 pm
Re: Pop up's in the Browser Widget
As of right now, I don't have direct access to the static URL of the file. When I hit the download button in the browser, through clicking or code, it opens another window that has a temporary URL that redirects to the actual location of the file. Until I get access to the direct address, which I am in the process of communicating with IT to see if that is possible, I'm unsure of another way to do it.
The "get URL" command works great. I was unaware of the URL aspect of that command. It is now just a matter of creating a new temporary address every time I want to download a file until I can hard-code the static address in.
Thank you for your help thus far.
The "get URL" command works great. I was unaware of the URL aspect of that command. It is now just a matter of creating a new temporary address every time I want to download a file until I can hard-code the static address in.
Thank you for your help thus far.
Re: Pop up's in the Browser Widget
No problems. URL works both ways, get and put, so if your boss modifies the file once it is in Lc, you can write to 'put (what ever object the change was made in) into URL(any valid file path).
-
- Posts: 7
- Joined: Tue Mar 27, 2018 4:33 pm
Re: Pop up's in the Browser Widget
The issue I am now encountering is that the file I am "getting" is an Excel spreadsheet. Livecode obviously doesn't like excel directly imported, it must be a csv Excel file. I am having trouble getting the file directly from the address (with "get") and getting it into a format I can work with without manually saving the file and exporting it as a csv in Excel.
Re: Pop up's in the Browser Widget
Well, there is the easy way out (3 separate links from http://www.aslugontheroad.com and rev, not an endorsement, just shows it can be done), and there is the harder way out .
Alternately, since you can issue shell commands from Lc, AND you (probably have Excel installed on the system), you could find out which (if any) Excel cli arguments allow formatting of the data, issue those from Lc, etc. (not an excel expert, someone else may chime in with more complete information).
Alternately, since you can issue shell commands from Lc, AND you (probably have Excel installed on the system), you could find out which (if any) Excel cli arguments allow formatting of the data, issue those from Lc, etc. (not an excel expert, someone else may chime in with more complete information).
-
- Posts: 7
- Joined: Tue Mar 27, 2018 4:33 pm
Re: Pop up's in the Browser Widget
Those resources will definitely be helpful, thank you.
I apologize for continuing to ask questions. The "get" command, near as I can tell, gets the contents of a file. So when used like "get URL pUrl" to retrieve an excel spreadsheet from the website it returns a jumbled, un-formatted Excel spreadsheet full of strange characters as well as the germane information. Is there a way to get the file and maintain its formatting and simply save it somewhere on the computer to then use the previously mentioned Excel/Livecode library to carry on from there?
Thanks for your help on previous questions.
I apologize for continuing to ask questions. The "get" command, near as I can tell, gets the contents of a file. So when used like "get URL pUrl" to retrieve an excel spreadsheet from the website it returns a jumbled, un-formatted Excel spreadsheet full of strange characters as well as the germane information. Is there a way to get the file and maintain its formatting and simply save it somewhere on the computer to then use the previously mentioned Excel/Livecode library to carry on from there?
Thanks for your help on previous questions.
Re: Pop up's in the Browser Widget
Hi Gavin,
yep, that how Microsoft files appear in a text editor and LC, lotsa strange characters!
So don't look at IT, just save IT to a file on disk like
Using BINFILE here is essential!
Best
Klaus
yep, that how Microsoft files appear in a text editor and LC, lotsa strange characters!
So don't look at IT, just save IT to a file on disk like
Code: Select all
...
put specialfolderpath("documents") & "/ the excel file.xls" into tFileOnDisk
## Now either:
get url"http://your excel url goes here.xls"
put IT into url("binfile:" & tFileOnDisk)
## Or directly:
put url"http://your excel url goes here.xls" into url("binfile:" & tFileOnDisk)
...
Best
Klaus
-
- VIP Livecode Opensource Backer
- Posts: 9823
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: Pop up's in the Browser Widget
Excel files are Zip archives. Change the file extension to .zip, open it up, and poke around. Once you have the lay of the land you can use the revZip external to automate extraction for reformatting and presentation.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Re: Pop up's in the Browser Widget
I wouldn't, the questions are reasonable and you can't learn without asking. How do you think my post count got over a 1000?
Besides, it gives all of us a look into doing things we might not normally be (even thinking of) doing on our own, so helping you helps all of us.
Klaus and Richard's comments are especially on target.
I am pretty sure Richard meant "lay of the land...", but if he didn't, I'll apologize later
-
- VIP Livecode Opensource Backer
- Posts: 9823
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: Pop up's in the Browser Widget
You're right, I did. The only thing worse than typing on a phone is not typing at all.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn