Thanks very much. That got me most of the way there. Here is my final
code that seems to be working:

tell application "BBEdit"
        set theSelection to the selection as string
        set myQuery to do shell script "php -r 'echo trim(urlencode(" & "\""
& theSelection & "" & "\"));'"
        open location "https://www.google.com/search?
as_sitesearch=codeigniter.com%2Fuser_guide%2F&q=" & myQuery & "&sa=Go"
end tell

Essentially I only needed change the myquery variable name passed to
PHP to theSelection. Thanks again!

I was trying to find AppleScript encoding examples. I found a couple
long ones but could not get them working. I never would have thought
of using PHP like that. Thanks again!

Scott

On Apr 12, 10:16 am, LuKreme <[email protected]> wrote:
> stirrell squawked out on Thursday 12-Apr-2012@06:13:49
>
> > And despite being a total Applescript newbie, this works for the most
> > part. However, it does have a problem with the greater than sign (>)
> > common in CodeIgniter... ie. load->model. When the greater than sign
> > is included in what I send, I get an error back:
>
> > MacOS Error code: -4960
>
> > This is probably a simple question, but I haven't been able to find an
> > answer. Is there a way to encode characters like that to prevent the
> > error I am getting?
>
> You need to encode the search string that you send to escape the proper 
> things that need escaped.
>
> I know how to do this in php, but I don't in AppleScript.
>
> Something like this should work in AppleScript until someone comes along with 
> an all-AppleScript solution:
>
> tell application "BBEdit"
>         set theSelection to the selection as string
>         set myQuery to do shell script "php -r 'echo trim(urlencode(" & "\"" 
> & myquery & "" & "\"));'"
>         open location "https://www.google.com/search?
> as_sitesearch=codeigniter.com%2Fuser_guide%2F&q=" & myQuery &
> "&sa=Go"
> end tell
>
> You may have to play around with the syntax on the do shell script part, but 
> that should be pretty close.
>
> --
> 'But you ain't part of it, are you?' said Granny conversationally. 'You
> try, but you always find yourself watchin' yourself watchin' people, eh?
> Never quite believin' anything? Thinkin' the wrong thoughts?'

-- 
You received this message because you are subscribed to the 
"BBEdit Talk" discussion group on Google Groups.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
<http://groups.google.com/group/bbedit?hl=en>
If you have a feature request or would like to report a problem, 
please email "[email protected]" rather than posting to the group.
Follow @bbedit on Twitter: <http://www.twitter.com/bbedit>

Reply via email to