Re: Google and SOAP vs. AppleScript
Re: Google and SOAP vs. AppleScript
- Subject: Re: Google and SOAP vs. AppleScript
- From: email@hidden
- Date: Fri, 19 Apr 2002 10:12:58 EDT
Neat little script. It even worked the first time OMM.
May I make a gentle plea for postability? This single line in your script:
set thePhrase to text returned of [NO BREAK]
(display dialog "Google phrase request:" default answer [NO BREAK]
"type a word or phrase" default button "OK")
could have been prepared as follows:
set phraseReq to "Google phrase request:"
set defResp to "type a word or phrase"
display dialog phraseReq default answer defResp default button "OK"
set thePhrase to text returned of the result
This encourages modular technique and avoids any chance of mail server
manglings. Additionally, it allows a simple copy/paste from email to Script
Editor of Choice without editing, and it saves the poster time too, while
decreasing the chance of introducing error. I have rarely seen a situation
where code cannot be broken into shorter lines suitable for posting while
increasing readability and code management.
Thank you.
Jeff Baumann
email@hidden
www.linkedresources.com
In a message dated 4/19/02 3:22:47 AM, iMP wrote:
>
Lately there's been a lot of talk elsewhere about Google searches
>
with SOAP. Here's the basics of what I've been doing for a while with
>
AS and IE:
>
>
-- start script -- watch line breaks
>
set thePrefix to "http://www.google.com/search?hl=en&q=""
>
set theSuffix to """
>
>
set thePhrase to text returned of [NO BREAK]
>
(display dialog "Google phrase request:" default answer [NO BREAK]
>
"type a word or phrase" default button "OK")
>
>
set googleRequest to (thePrefix & thePhrase & theSuffix)
>
>
tell application "Internet Explorer"
>
Activate
>
GetURL googleRequest
>
end tell
>
-- end script
>
>
A nice thing is that IE will encode the spaces for you. Also, you
>
could remove the """s and type in a combo request with quotes, for
>
example:
>
>
"scripting.com" how about we bomb mecca and call it even
>
>
(Even though you get quotes in the URL, they're fixed in google.)
>
>
So in essence all you do is figure out what string is required for a
>
more advanced search you like to perform and script accordingly. I
>
made two apps and put them in my Apple Menu; one for a whole phrase,
>
one for custom search entry. That way I can get to them from any
>
application.
>
>
iMP
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.