Re: Open URL in Safari with Post params
Re: Open URL in Safari with Post params
- Subject: Re: Open URL in Safari with Post params
- From: Thomas Fischer <email@hidden>
- Date: Fri, 11 Nov 2011 11:15:25 +0100
Hi Simon,
I wouldn't know how to do this directly, but you can download a file and open it in Safari, I don't know if this helps:
set myTarget to (POSIX file (POSIX path of (path to temporary items) & "test.html"))
tell application "URL Access Scripting"
set myFile to download "http://www.mathguide.de/cgi-bin/ssgfi/suche.pl" to myTarget form data "db=math&tag=FIN&words=lincoln&dsp=title"
end tell
tell application "Safari" to open myFile
Best
Thomas
Am 10.11.2011 um 22:17 schrieb Simon Forster:
>
> No. That's using GET rather than POST. In theory GET's used when state isn't changed while POST may well change state somewhere.
>
> Anyway, different.
>
> S
>
> On 10 Nov 2011, at 18:57, Emmanuel LEVY wrote:
>
>> You mean, as in:
>>
>> open location "https://www.somewhere.net?firstname=fred&lastname=bert" ?
>>
>> Emmanuel
>>
>> On Nov 10, 2011, at 6:21 PM, Simon Forster wrote:
>>
>>>
>>> Hi
>>>
>>> Hoping someone can help me. I'd like to open a URL in Safari and submit some post params at the same time. I can achieve the end result quite easily using Safari's `do JavaScript` functionality:
>>>
>>> tell application "Safari"
>>> activate
>>> tell window 1 to set current tab to make new tab
>>> do JavaScript "location = 'https://www.somwhere.net/';
>>> onload = function() {
>>> document.forms[0].item1.value = 'fred';
>>> document.forms[0].item2.value = 'bert';
>>> document.forms[0].submit();
>>> }" in document 1
>>> end tell
>>>
>>> But being an impatient blighter I find that waiting for the the first page to load is a waste of time. Why not go straight to the page I want, submitting the post parameters as I go - but I can't find the syntax.
>>>
>>> TIA for an pointers.
>>>
>>> Simon _______________________________________________
>>> Do not post admin requests to the list. They will be ignored.
>>> AppleScript-Users mailing list (email@hidden)
>>> Help/Unsubscribe/Update your Subscription:
>>> Archives: http://lists.apple.com/archives/applescript-users
>>>
>>> This email sent to email@hidden
>>
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> AppleScript-Users mailing list (email@hidden)
>> Help/Unsubscribe/Update your Subscription:
>> Archives: http://lists.apple.com/archives/applescript-users
>>
>> This email sent to email@hidden
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> AppleScript-Users mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
> Archives: http://lists.apple.com/archives/applescript-users
>
> This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden