I have a script that uses data from a Filemaker database and submits it to a website as Form Data in IE5. It does not look like this is supported in Safari. does anybody have a solution to this?
Please… I HATE Internet Exploder.
You can bypass the browsers all together and use cURL.
For more info, see:
Jon
I believe I need to use a browser because upon submission, it returns a generated form that i have to extract data from and copy it back to filmaker pro.
I think I would need another college semester to figure out the script you gave me.
Ok, try this:
Just copy and paste it into the Script Editor, no degree required.
Jon
Ok, this is very nice. It works. Although Im not enterning in search data I’m submitting customer data, SSN, Credit card info etc to a secure site.
Is there any documentation on this script? I have no real idea how this works. I can guess, but would likely be wrong.
Is all the “encode url” stuff to take care of non-standard asci characters?
You should write a book on applescript. I have never found a good one that goes beyond the syntax.
Jon, can what I’m trying to do here be done with the Safari “do Javascript” on another site’s form submission? The script example you gave me is too complicated.
Chris
an example of the script I wrote with IE:
tell application "FileMaker Pro"
set lastname to cell "SubLastEncode" in current record
set firstname to cell "SubFirstEncode" in current record
set streetAddress to cell "SubAddressEncode" in current record
set city to cell "SubCityEncode" in current record
set stat to cell "Subscriber State" in current record
set zip to cell "Subscriber Zip" in current record
set txtPhoneAreaCodeField to cell "AreaCode" in current record
set phprefix to cell "phprefix" in current record
set suffex to cell "phsufex" in current record
set txtCardNumberField to cell "Account" in current record
set txtExpMonthField to cell "CCMonth" in current record
set txtExpYearField to cell "CCYEAR" in current record
set txtSubscriberSSN to cell "SSN" in current record
set txtCertificateNo to cell "clubdish" in current record
end tell
tell application "Internet Explorer"
Activate
OpenURL "https://retailer.echostar.com/claims/claimcreate.asp" FormData ("txtSubscriberFName=" & firstname & "&txtSubscriberLName=" & lastname & "&txtSubscriberAddress=" & streetAddress & "&txtSubscriberCity=" & city & "&txtSubscriberState=" & stat & "&txtSubscriberZip5=" & zip & "&optSingleStory=" & "1" & "&optBillingAddress=" & "1" & "&txtSubscriberPhoneArea=" & txtPhoneAreaCodeField & "&txtSubscriberPhonePrefix=" & phprefix & "&txtSubscriberPhoneSuffix=" & suffex & "&txtSubscriberCardNo=" & txtCardNumberField & "&cboSubscriberCreditCardExpMth=" & txtExpMonthField & "&cboSubscriberCreditCardExpYear=" & txtExpYearField & "&txtSubscriberSSN=" & txtSubscriberSSN & "&txtCertificateNo=" & txtCertificateNo & "&hidPromo=" & promocode & "&hidFormAction=" & "VALIDATEFORM" & "&hidFormIteration=" & "0" & "&hidExistingSub=" & "" & "&hidPromoAppCode=" & "" & "&hidCertUsed=" & "") ----format of form data is: FormData ( "field=" & variable & "&field2=" & "data")
end tell
I can’t test this because I don’t have an account but this should work:
Jon
after a day of reading your previous scripts, cross referencing variables and handlers and looking up systax in my boods, I was nearly at the same conclusion. I was just about to start writing modules to test.
This is very nice. I’ll make my changes in this and start testing it. I now think I see what you are doing. Assembling the form data from the variables and values, encoding the ascii text in the %XX scheme, then submitting the completed URL in post or get format.
THANK YOU FOR THE EFFORT!
You work fast.
I have created a test page for a simple login to a site which uses 3 fields using the POST method. It seems that the script is formating the data in the GET method by generating name-value pairs and adding them to the end of the URL and will not log in.
What am I missing here? The fields are just a login, pswd and one hidden.
What I would do is use the first CURL script and then write the results to a text file that Safari opens. Do you have a URL for the test form you created that I could test with?
Jon
http://retailer.echostar.com/login/login.asp
Unfortunatly, I cannot give the password in this forum as it contains very sensitive data. Let me know If there is anything else I could do.
Am I to understand that It will not support POST method?
Chris
This doesn’t help me very much as I don’t have an account. You mentioned that you wrote a quick page with a three field form. Is that URL private?
Sorry, that was my test page to the site I need access to. I don’t know how to create the cgi that authenticates a form that I create. I tried to use forms on my website, but the cgii scripts will not allow direct access.
I now understand your script. Worked on it all day, about the equivalent of a college semester, but could not get it to do a POST method. I suppose that’s what the “FormData” script command in IE5 does.
I’m running into dead-ends. Trying everything.
Could your script along with a Java script to post the data work via the DoJavascript in the Safari Dictionary?
If you have any suggestions, I’m listening…
thanks,
Chris
This is about as far as I can go. The following script will take data from your FMP database, format into a JavaScript to “autofill” the form on the page (adjust the_URL to the actual page where the form resides if it is not correct in the script below). If the form is not the first, adjust it below (remember JavaScript starts at 0 not 1). It will still be up to you to click the submit button but this should make it a bit easier. This is very difficult to troubleshoot without seeing the actual page. If it doesn’t work, perhaps you could bring up the page, copy the source, remove any private or sensitive data (passwords, usernames, etc.) and let me see that. Then I’d know for certain what the form and fields are. Right now, I’m guessing about the field types.
Jon
I really appreciate your help.
This kinda brings be back to square one. With IE5, applescript would “push” the submit button with the “OpenURL & FormData”. This is the automation I am trying to accomplish with Safari, but it appears apple did not put that kind of scripting ability in it.
I fiind it ironic that a Microsoft product has better applescript support than Safari.
Thanks again for your help. sorry to take up so much time on this, but I hope it can be good for others too.
Chris
Please note that I edited the aboved script to account for various form input types.
Jon
Jon, Are you aware of any 3rd party scripting additions that will add the “post” method to Safari? (still working on this problem)… And is there a way to contact Apple and “suggest” that they provide additional applescript for Safari to make it at least as good as explorer, mozilla, omniweb etc?
I don’t know of any third-party Scripting Additions for Safari. As far as letting Apple know about your request, in Safari, under the View menu, check “Bug” then click on the bug button at the top far right of the browser window. While this is mostly for posting bugs, I imagine they take general suggestions too…
Just curious, did the autofill script work for you? I know it doesn’t actually post the data (although it could by simply adding one more JavaScript line to actually submit the filled-in form). Is this really not a feasible solution for you?
Jon
Here is the complete script with the submit line, a better routine for checking if the page has actually loaded, and support for a username and password to open the original URL. Again, I guessed on the input types and values for the various fields and they may need to be tweaked for the actual types and values but that is a relatively simple matter.
Jon
So far my original script for explorer is more elegant and gets the job done very well. I will incorporate the code you sent into it to make it handle the encoding better. Although the JS solution you provided will most likely work, It is not exactly the solution I’m looking for. I started working on this because I wanted to use a standard browser on my machine and get away from Explorer since microlimp has stopped support for it.
During the beta test, I sent numerious bug reports to apple concerning the applescript support.