Re: Get selected text from non-cocoa application
Re: Get selected text from non-cocoa application
- Subject: Re: Get selected text from non-cocoa application
- From: Joe <email@hidden>
- Date: Mon, 21 Sep 2009 11:04:43 -0700
At 10:53 PM +0530 9/21/09, Rounak Jain wrote:
>ThisService can take text from front application and process it.
>(http://macscripter.net/viewtopic.php?pid=106211#p106211)
>But it does not seem to work on non-cocoa applications like Firefox. I tried to write a script like
>on process(input)
>set input to......
>on error e
>tell app "System events" to keystroke "c" using command down
>........
>but that does not work.
>Maybe, because the error occurs in the first line "on process(input)" and the script does not proceed.
>Does anyone know about an alternative way to get text from front
>application so as to process it?
>Thanks
Here is an applet script that I use with Firefox. HTH
Joe
tell application "Firefox"
activate
end tell
tell application "System Events" to keystroke "c" using {command down}
tell me to activate
set selecTxt to the clipboard as text
tell application "Firefox" to activate
set dat to (current date) as text
set clipFil to (path to desktop folder as text) & "Firefox Clips.txt"
try
close access file clipFil
end try
set filRef to open for access file clipFil with write permission
write (dat & return & selecTxt & return & "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" & return & return) to filRef starting at eof
close access filRef
_______________________________________________
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