Page 1 of 1
implement a new browser
Posted: Wed Feb 29, 2012 11:37 am
by tal_is_back
Hi,
I would like to know if implemeting a new browser with livecode was possible, and if it was difficult to do? ( how many line codes?)
I want a new browser, cause i use a website, which edits travel tickets, ( the tickets are edited in .asp extension)
I want, that every time a ticket is edited, to extract the datas i need to an external file( or in rev).
Ticket number / Name customer / Price passenger / tax passenger / Price car / tax car / total price
If it is too difficult, how much could it cost approximatively to make it do by someone? thanks
Re: implement a new browser
Posted: Wed Feb 29, 2012 11:57 am
by Klaus
Hi Tal,
LiveCode comes with a nice Browser example stack!
Menu: Help: Example stacks and Resources -> Folder "Examples": Browser Sampler.rev
Best
Klaus
Re: implement a new browser
Posted: Wed Feb 29, 2012 2:35 pm
by tal_is_back
Ok thanks, you think it is easy to customize it like i said in my previous post : adding new internet browser functionnalities
Tal
Re: implement a new browser
Posted: Wed Feb 29, 2012 2:48 pm
by Klaus
Hi Tal,
yes, this is possible.
If this is easy or not, I cannot say
Please check the example stack and get used to the commands and functions that "control"
a browser object in LiveCode. then you can decide if your modification are easy or not
Best
Klaus
Re: implement a new browser
Posted: Wed Feb 29, 2012 8:10 pm
by tal_is_back
Hi,
I looked at the example browser, it is good one, i am checking how to do what i want, so first i am trying to extract data from a simple pdf file :
I get the browserid and then i try to save or extract data from it using jscripts :
get revBrowserExecuteScript(sBrowserId, ";")
or
get revBrowserCallScript(tBrowserId, ";")
But i didnt succeed, if someone can do that?
Tal
Re: implement a new browser
Posted: Wed Feb 29, 2012 8:26 pm
by tal_is_back
i also tried this :
libURLDownloadToFile "
http://www.senat.fr/rap/r08-441/r08-441 ... C:\Program Files (x86)\RunRev\LiveCode 5.0.2\sav","downloadComplete"
No error, but the folder is empty...
Tal
Re: implement a new browser
Posted: Wed Feb 29, 2012 8:29 pm
by Klaus
Hi Tal,
tal_is_back wrote:...
get revBrowserExecuteScript(sBrowserId, ";")
or
get revBrowserCallScript(tBrowserId, ";")
...
I don't know much about JavaScript, but I guess that a simple semicolon ;
is neither a valid JavaScript nor the name of a JavaScript function!
Check the dictionary for "revBrowserExecuteScript" and "revBrowserCallScript".
Best
Klaus
Re: implement a new browser
Posted: Wed Feb 29, 2012 8:34 pm
by Klaus
Hi Tal,
1. Alway use the SLASH / as a pathdelimiter in LiveCode.
The Windows BACKSLASH in pathnames is only necessary when you do a SHELL call on Windows.
2.C:\Program Files (x86)\RunRev\LiveCode 5.0.2\sav
is this ("sav") the FOLDER where you want to download the PDF to?
If yes, you need to specify a FILENAME here, not a target folder:
THis should work:
...
## watch linebreak!
libURLDownloadToFile "
http://www.senat.fr/rap/r08-441/r08-441 ... C:/Program Files (x86)/RunRev/LiveCode 5.0.2/sav/New PDF File from Net.PDF","downloadComplete"
...
Best
Klaus
Re: implement a new browser
Posted: Wed Feb 29, 2012 8:50 pm
by tal_is_back
Thanks, i succeeded doing like that :
set the defaultfolder to "C:\save "
libURLDownloadToFile "
http://www.senat.fr/rap/r08-441/r08-4411.pdf",test
So the file test is saved in my t folder
it can be a solution, i have to automate it for each specific filei wanna save.
The second step is to find a way in rev to directly extract data from pdf file...
Tal
Re: implement a new browser
Posted: Wed Feb 29, 2012 10:04 pm
by Klaus
Hi Tal,
Important hint! Use QUOTES around the filename:
libURLDownloadToFile "
http://www.senat.fr/rap/r08-441/r08-4411.pdf","test"
And always use a SLASH / in LiveCode as the path delimiter, in case I did not mention this yet!
OK, setting the defaultfolder will do, but directly setting the filename without changing the defaultfolder is more elegant
tal_is_back wrote:it can be a solution, i have to automate it for each specific filei wanna save.
Ther are several ways to automatically save the files like setting the name to something with "the seconds",
so you could extract the exact date and time of the download if necessary.
Think about what you need and ask again here
tal_is_back wrote:The second step is to find a way in rev to directly extract data from pdf file...
Uhh! That's not an easy task and I wish you good luck!
Please post here if you found a solution!
Best
Klaus
Re: implement a new browser
Posted: Wed Feb 29, 2012 10:41 pm
by mwieder
The second step is to find a way in rev to directly extract data from pdf file...
You may just want to shell to a freeware commandline application to do that
http://www.foolabs.com/xpdf/home.html
Re: implement a new browser
Posted: Wed Feb 29, 2012 10:59 pm
by tal_is_back
Ther are several ways to automatically save the files like setting the name to something with "the seconds",
so you could extract the exact date and time of the download if necessary.
Think about what you need and ask again here
Thats the automation i wanna do : It is a website, which edit travel ticket in .asp to be printed, i want that everytime a ticket is edited ---> save the file or extract the datas
Finaly, thats what i need, a table containing that datas : Ticket number / Name customer / Price passenger / tax passenger / Price car / tax car / total price
YEs, maybe there is a way to call that software from revolution?
Re: implement a new browser
Posted: Wed Feb 29, 2012 11:05 pm
by mwieder
See the shell function in the documentation.