Put text into fld at a website

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

User87
Livecode Opensource Backer
Livecode Opensource Backer

Re: Put text into fld at a website

Post by User87 » Thu Feb 18, 2016 7:53 pm

I want to display the value in the field that is visible at the browser and than make some action with it (only in the field that is visible).

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10052
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Put text into fld at a website

Post by FourthWorld » Thu Feb 18, 2016 7:59 pm

You can send a JavaScript call to the browser instance to work with the browser, but if the ultimate goal were to fill in the form and send it to the server that could be done super-easy with the POST command.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

User87
Livecode Opensource Backer
Livecode Opensource Backer

Re: Put text into fld at a website

Post by User87 » Thu Feb 18, 2016 8:03 pm

Can you tell me how to send a javascript call to the browser?
I only want to put the text into that field. Thats all.

AndyP
Posts: 634
Joined: Wed Aug 27, 2008 12:57 pm
Contact:

Re: Put text into fld at a website

Post by AndyP » Thu Feb 18, 2016 8:40 pm

You can do

Launch URL "https://www.google.com/search?ie=UTF-8&q=LiveCode"

to send a search request to Google.
Andy .... LC CLASSIC ROCKS!

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10052
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Put text into fld at a website

Post by FourthWorld » Thu Feb 18, 2016 9:14 pm

User87 wrote:Can you tell me how to send a javascript call to the browser?
I only want to put the text into that field. Thats all.
Filtering the Dictionary with "revBrowser" I found revBrowserExecuteScript.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

User87
Livecode Opensource Backer
Livecode Opensource Backer

Re: Put text into fld at a website

Post by User87 » Thu Feb 18, 2016 9:56 pm

I don't get this work with and external browser. In addition to that I have no control of the website on which I want to put text in the form (field).

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10052
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Put text into fld at a website

Post by FourthWorld » Thu Feb 18, 2016 11:22 pm

User87 wrote:I don't get this work with and external browser. In addition to that I have no control of the website on which I want to put text in the form (field).
Correct, the revBrowser commands only work with an embedded browser in LiveCode. Controlling an external browser may be tricky - what OS are you on, and can you point us to other apps that do what you're looking for so we can see how they work?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

User87
Livecode Opensource Backer
Livecode Opensource Backer

Re: Put text into fld at a website

Post by User87 » Fri Feb 19, 2016 9:38 pm

I am using Windows 10 and Mac OSX (it hneed to work on both systems). I want to control Firefox. I don't use other apps. Only the livecode app with the button (I explaned it in my first post).

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10052
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Put text into fld at a website

Post by FourthWorld » Sat Feb 20, 2016 1:01 am

User87 wrote:I am using Windows 10 and Mac OSX (it hneed to work on both systems). I want to control Firefox. I don't use other apps. Only the livecode app with the button (I explaned it in my first post).
Whenever you want to build something you've never seen any other app do it's helpful to expect the need for some research. :)

The question here is: what mechanisms does Firefox provide for allowing other apps to manipulate the content of web pages displayed within it.

For security reasons the answer may be "none", since if outside apps could alter page contents then a malware installed on the system could wreak all sorts of havoc.

But it may also be that Firefox has a more lax approach, based on the old adage that "physical access equals root" anyway. If so, it may be that they provide hooks by which other apps can control it.

On OS X the most common means by which apps can control each other is AppleScript. You can open up Firefox in the AppleScript editor and see what options it provides. All OS X apps are required to support a few AppleScript events, but the sort you're looking for may or may no be provided. If you see anything like the ability to execute JavaScript within a page, that would allow you to send the JS within an AppleScript to Firefox using LC's "do...as" syntax.

Similarly, it may be that Firefox on Windows includes support for Powershell or other Windows scripting solution. Not sure, but a little time at the Firefox developer site should provide the info you're looking for. If there is such a hook the method would be similar to Mac, using "do...as <externalScriptingLanguage>" or perhaps calling a Powershell script via LC's shell function.

Seems like a lot of work, though. Can you describe the goal of this? Perhaps there's another way to meet that goal with fewer moving parts.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

User87
Livecode Opensource Backer
Livecode Opensource Backer

Re: Put text into fld at a website

Post by User87 » Sat Feb 20, 2016 12:01 pm

Yes this seams to be a lot of work.
The goal is:
I have my LC-App which includes a pull-down-menu with text files linked.
I want the LC-App to put the text into the field at the website in the external browser.
The website in the external browser include other text information. And all the text information together I send via mail (sending via mail has to be done via the website it is not possible/allowed to do this via another LC-App.)

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10052
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Put text into fld at a website

Post by FourthWorld » Sat Feb 20, 2016 5:40 pm

User87 wrote:The goal is:
I have my LC-App which includes a pull-down-menu with text files linked.
I want the LC-App to put the text into the field at the website in the external browser.
The website in the external browser include other text information. And all the text information together I send via mail (sending via mail has to be done via the website it is not possible/allowed to do this via another LC-App.)
If I understand that correctly we could distill the goal to the last step, since the first are just means to that goal:

Goal: send data from a form on a web page to a server so it can send that data in an email

To accomplish that we don't need an external browser at all, nor even an embedded one. We merely need a way to submit the form data to the server the page comes from. And for that we can use a field in a LiveCode stack to enter the data and then use LiveCode's built-in POST command to send that to the server, as I'd suggested earlier and is outline here in this handy brief tutorial:
http://livecode.byu.edu/internet/postMethodSteps.php

The server doesn't care whether the data is being sent via POST to it from Firefox, or Chrome, or any other specific client. LiveCode is as good as anything else as far as the server is concerned. But as far as your project is concerned, I can think of no simpler way to accomplish the goal than doing this directly in LiveCode with the POST command.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

User87
Livecode Opensource Backer
Livecode Opensource Backer

Re: Put text into fld at a website

Post by User87 » Sun Feb 21, 2016 12:44 pm

FourthWorld wrote:
User87 wrote:The goal is:
I have my LC-App which includes a pull-down-menu with text files linked.
I want the LC-App to put the text into the field at the website in the external browser.
The website in the external browser include other text information. And all the text information together I send via mail (sending via mail has to be done via the website it is not possible/allowed to do this via another LC-App.)
If I understand that correctly we could distill the goal to the last step, since the first are just means to that goal:

Goal: send data from a form on a web page to a server so it can send that data in an email

To accomplish that we don't need an external browser at all, nor even an embedded one. We merely need a way to submit the form data to the server the page comes from. And for that we can use a field in a LiveCode stack to enter the data and then use LiveCode's built-in POST command to send that to the server, as I'd suggested earlier and is outline here in this handy brief tutorial:
http://livecode.byu.edu/internet/postMethodSteps.php

The server doesn't care whether the data is being sent via POST to it from Firefox, or Chrome, or any other specific client. LiveCode is as good as anything else as far as the server is concerned. But as far as your project is concerned, I can think of no simpler way to accomplish the goal than doing this directly in LiveCode with the POST command.
Hmm I add a picture with an overview what I want to do. Please have a look at it.
Are you still shure it will work what you told me?
use LC in ext. Browser.JPG

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm

Re: Put text into fld at a website

Post by [-hh] » Sun Feb 21, 2016 2:44 pm

What you intend to do is
= fill the form on the webpage and
= use a "send by mail button" from the webpage?

As long as you don't know exactly what it's sending (may also additional hidden data what each browser knows about you) this will be difficult. If you know, then Richard will tell you how to do that (I would ask him too).

Also you could think about an easier approach like using a "hotkey tool" (Hotkey on Win, Spark on Mac).
shiftLock happens

User87
Livecode Opensource Backer
Livecode Opensource Backer

Re: Put text into fld at a website

Post by User87 » Sun Feb 21, 2016 7:53 pm

[-hh] wrote:What you intend to do is
= fill the form on the webpage and
= use a "send by mail button" from the webpage?

As long as you don't know exactly what it's sending (may also additional hidden data what each browser knows about you) this will be difficult. If you know, then Richard will tell you how to do that (I would ask him too).

Also you could think about an easier approach like using a "hotkey tool" (Hotkey on Win, Spark on Mac).
If I click the "send by mail button" it first shows a summary of the texts. (Where you can check if it's ok and than push the button send mail is shown)
The button I considure only shows the next side with that summary and it does:
<input id="set_status" class="submit" type="submit" value="Continue" name="set_the_status" style=""></input>

But I think this is not what you wanted to know?
And it is as you said that there shure will be some hidden action. :-/

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm

Re: Put text into fld at a website

Post by [-hh] » Sun Feb 21, 2016 9:07 pm

Probably Richard wants to know the source code of that next page with the summary
(the one you can view and copy in the browser in developer views, in firefox with developer tools often cmd-U on Mac and ctrl-U on Win).

What you could also do: Use one of the Firefox AddOns.

Also: some of them are open source, so you could look there how they do it with js, for example HERE (Autofill Forms on github).
shiftLock happens

Post Reply