Hi Everyone,
I am struggling with filling out a form via an applescript. I’ve figured it out mostly, except am having a strange problem… Sometimes when I run the script I end up with no result, a reply of “missing value” whereas other times I run it, it actually works…
I am on OS X Lion and Safari 5.1.2… I am finding a lot of complaints about javascript just not working on Lion properly with Safari — I hope there is a solution, b/c this is really annoying!!
WHAT I AM DOING
taking a filemaker pro record, copying some fields out of it, and filling in a web form (which is based on my desktop, but feeds into Salesforce.com)
tell application "FileMaker Pro Advanced" --collecting the info I need
do script "findCurrentOnly"
set pubTitle to cell "Title"
set contactEmail to cell "Email"
set theURL to cell "Website"
set thePhone to cell "Phone"
--set trueValue to "true"
tell application "Safari" --filling out the form
activate
open location "file:///Users/InNov8/Desktop/NewLEAD.html"
set x to "
document.forms[0].elements[4].value='" & contactEmail & "' ;
document.forms[0].elements[5].value='" & pubTitle & "' ;
document.forms[0].elements[6].value='" & theURL & "' ;
document.forms[0].elements[7].value='" & thePhone & "' ;
document.forms[0].elements[12].value='12/04/11';
"
tell application "Safari" to do JavaScript x in document 1
end tell
end tell
Anybody have any ideas on why it sometimes results in a missing value?
If the filemaker pro field is blank it should just come up blank — which seems to work sometimes…
Thanks!