Re: How to script URL Access to post radio buttons?
Re: How to script URL Access to post radio buttons?
- Subject: Re: How to script URL Access to post radio buttons?
- From: email@hidden
- Date: Tue, 17 Apr 2001 23:14:15 EDT
Charles,
At this moment the database seems broken, so I cannot verify this, but I
believe the syntax you want is
form data "QUERY00=climber&SAVEDB=ananova"
Otherwise, it looks like you're right on.
You might find you need to URL encode the form data string, or better still,
use the MT Pack CGI command from Tanaka's osax 2.0.
set parsedFormData to {{"QUERY00", "rock climber"}, {"SAVEDB", "ananova"}}
set packedFormData to MT Pack CGI parsedFormData -- Tanaka's osax 2.0
log packedFormData
set theFile to (path to startup disk as string) & "thefile"
set theURL to "
http://www.ananova.com/search/index.html"
tell application "URL Access Scripting"
download theURL to file theFile form data packedFormData replacing yes
with progress
-- all on a single line
end tell
Rock on!
Jeff Baumann
email@hidden
www.linkedresources.com
Elvis Presley - the king of rock 'n' roll.
Jesus Christ - the King who rolled the rock.
In a message dated 4/17/01 3:42:25 PM, Charles Arthur
<email@hidden> wrote:
>
So here I am trying to script a search of a site
>
(http://www.ananova.com/search/index.html) using the word "climber" and
>
searching within the site. (Which is picked by a radio button below the
>
emtpy area for the search string.
>
>
It seems straightforward enough.. at first:
>
>
tell application "URL Access Scripting"
>
download "http://www.ananova.com/search/index.html" to thefile form data
>
"QUERY00=climber" replacing yes with progress --all on a single line
>
-- this arrives with file type "TEXT" creator type "MSIE"
>
end tell
>
>
However this always does a Web search. I want a site search.
>
>
The relevant HTML from the site is:
>
----
>
<table>
>
<form method="post" action="http://www.ananova.com/search/index.html"
>
name="form">
>
<tr><td><input name="QUERY00" value=""
>
size="40"> </td>
>
<td rowspan="2" valign="top"><input type="image" src="" width="58"
>
height="22" name="CMD=search.run" alt="Search" border="0"></td></tr>
>
<tr><td align="left"><input type="radio" name="SAVEDB"
>
value="web">web <input type="radio" name="SAVEDB" value="ananova"
>
checked>Ananova</td></tr></table>
>
<input name="THRESHOLD" value="60" type="hidden"><input type="hidden"
>
name="B" value=""><input type="hidden" name="nav_src"
>
value="LeftColSearchUsed"><input name="ORGANISE_CODED" value="R:date"
>
type="hidden"><input name="DAYSMINUS" value="30" type="hidden"></form>
>
<form method="post" action="/search/index.html" name="form">
>
---
>
>
From gazing at this (and earlier failures) I realised that I needed the
>
"QUERY00=" string. However, I can't work out what to put in the "form data"
>
string to tell it that which radio button should be checked.
>
I've tried "{QUERY00=climber,SAVEDB=ananova}" - no dice. It puts
>
"climber,SAVEDB=ananova} in the search area and searches the Web.
>
I've tried {"QUERY00=climber,SAVEDB=ananova"}. Won't compile. form data is
>
a string.
>
>
So now I'm trying you guys. Any ideas?
>
>
Charles
>
>
----------------------------
>
http://www.ukclimbing.com : 1000+ British crags, 350+ British climbing
>
walls - searchable by distance and anything else you care to think of -
>
with weather forecasts for every one, plus maps, articles, news and
>
features. Plus Britain's busiest climbing discussion boards. And there's
>
even a cool shop attached.