MACSCRPT Archives

March 2011

MACSCRPT@LISTSERV.DARTMOUTH.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
David Livesay <[log in to unmask]>
Reply To:
Macintosh Scripting Systems <[log in to unmask]>
Date:
Tue, 22 Mar 2011 22:26:22 -0400
Content-Type:
text/plain
Parts/Attachments:
text/plain (62 lines)
You can use the AppleScript "do JavaScript" command to set the values of the input fields.

Use Safari's Web Inspector to determine the names or IDs of the objects you need to address. You can type your JavaScript into the console to test it. When you get the results you want, copy it and paste it into FileMaker.

You can address a form as a property of the document. If the form has a name, e.g. "myWebForm," you would reference it as document.myWebForm or document["myWebForm"]. If it has an id, you can reference it either as document.forms["myWebForm"] or as the object returned from document.getElementById("myWebForm"). If it doesn't have a name or an id, you can reference it by its index in the document.forms HTMLCollection. (An HTMLCollection is an array-like object whose elements can be referenced by name or by index.) If the form is the first (or only) form in the document, you can reference it as document.forms[0].

The elements of a form are also members of an HTMLCollection and can also be referenced by name, index or id. Form elements usually have names, because the names are used to identify the parameters passed to a server when the form is submitted, so this makes access easier. If our form has an element named "color," it can be referenced as document.myWebForm.color, and its value can be set with the expression, document.myWebForm.color = "red"; so the AppleScript would be:

tell application "Safari"
	do JavaScript "document.myWebForm.color = \"red\"" in current tab of window 1
end tell

On Mar 22, 2011, at 10:29 AM, Mark Lively wrote:

> I was feeding a way to submit the form with the data rather than load the data into the form.  You might be able to do it with some javascript.  Unfortunately that is beyond my ken.
> 
> -Mark
> 
> On Mar 21, 2011, at 10:53 PM, jeff donovan wrote:
> 
>> On Mar 21, 2011, at 10:41 PM, Mark Lively wrote:
>> 
>>> On Mar 21, 2011, at 9:09 PM, jeff donovan wrote:
>>> 
>>>> Greetings
>>>> 
>>>> I have a little script/button in filemaker that calls to a web site, how can i pull data from the_current_record : field_one , field_two and auto fill into my browser window ? right now I have to manually copy and paste from filemaker. 
>>>> 
>>>> here is my script call,.. very simple.
>>>> 
>>>> Button --> " open URL [No Dialog; Table::webpagePath]
>>>> 
>>>> webpagepath = https://www.example.com/web/src/my.php
>>>> 
>>>> I was thinking maybe I could use " autofill "  function of the browser, or a get cell data1 repeat get cell data 2 copy and paste each , but that seems so dirty. anyone know a better way ?
>>>> 
>>>> tnx
>>>> -j
>>> 
>>> If you need to submit a form you can do something like
>>> 
>>> data1 = "123"
>>> date2 = "Red"
>>> webpagepath = "https://www.example.com/web/src/my.php?count="&data1&"&color="&data2
>>> 
>> 
>> i tried substituting 
>> https://www.example.com/web/src/my.php?count="&text1&"&color="&text2
>> 
>> it brought up the page but the two fields on the web site did not show the characters in the first two fields.
>> 
>> here is the html Im trying to input into
>> 
>> <tr><td bgcolor="#ffffff" align="left"> 
>> <table bgcolor="#ffffff" align="center" border="0" width="100%"><tr><td align="right" width="30%">Name1:</td>
>> <td align="left" width="70%"><input type="text" name="my_name" value="" onfocus="alreadyFocused=true;" /> 
>> </td>
>> </tr>
>> <tr><td align="right" width="30%">NAME2:</td>
>> <td align="left" width="70%"><input type="name2" name="secretkey" onfocus="alreadyFocused=true;" />
>> </td>

ATOM RSS1 RSS2