Re: Safari "do javascript" busted?
Re: Safari "do javascript" busted?
- Subject: Re: Safari "do javascript" busted?
- From: Richard Brosnahan <email@hidden>
- Date: Mon, 25 Apr 2005 15:07:17 -0400
Thanks Darren,
I did nearly what you said, but I had to add a couple lines to deal
with clobbering the clipboard. As you know, there are some advantages
to not borrowing the clipboard. It's also better to ask the application
directly for the data rather than dealing with UI commands. UI commands
are not all that reliable.
The fix you suggested works fine, so I'll deal.
Thx again
--
Richard Brosnahan
Editor in Chief
Broz News
http://broznews.org
Forever is composed of nows.
Emily Dickinson, poet
On Apr 25, 2005, at 2:30 PM, email@hidden
wrote:
Hi Richard-
A bit behind in reading the digest version of the list, but I didn't D
see any responses to your query so I thought I'd chime in.
I've also had issue with "getSelection()" with Safari 1.3. It flat-out
doesn't work. Don't know if syntax has changed or not, perhaps others
who know more have the answer.
My solution was to alter my script with the following (removing the
entire do JavaScript section) not sure it'll work in your situation,
but here goes:
tell application "Safari"
activate
--set clipText to (do JavaScript "getSelection()" in document 1) as
string
tell application "System Events" to keystroke "c" using {command down}
delay 0.5
set clipText to (the clipboard) as text
end tell
You would simply replace "clipText" with "pTheStory". Unfortunately,
if you have stuff on the clipboard, it'll be replaced whereas that
wasn't an issue with "do JavaScript". Haven't seen a lot of chatter on
this topic anywhere. Then again, I've not dug too deeply. Hope it
gets resolved soon, and I hope this is helpful to you.
--
Best,
Darren
MacSurfer
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden