Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: Copy text to the clipboard
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Copy text to the clipboard




On 5 Dec 2005, at 17:12, John R. wrote:

kai wrote:
John, you don't appear to have mentioned which OS version you're
running. If it's Tiger (or possibly even Panther), have you tried the
approach that both Luther and I suggested in this thread - and that
Chris Nebel also mentioned in the recent "frontmost application" thread?


path to frontmost application

Thanks, that's easy and works fine to get the app. (I use Tiger)

What I really want is to copy the current selection from that app. System Events is not working for me. Same results even if I convert from a path string to the process name alone. What am I doing wrong?

set myapp to (path to frontmost application as string) -- NOTE: only works as scpt (not as app)
set myapp to find text ":([^.:]+)\\." in myapp using "\\1" with regexp and string result -- Convert path to name.
tell application myapp to activate
tell application "System Events"
tell process myapp
keystroke "c" using command down
end tell
end tell
tell application myapp
set mytext to the clipboard
display dialog mytext & return & myapp
end tell

Either of my earlier suggestions (scpt or app) work fine for me (10.4.3):


http://lists.apple.com/archives/applescript-users/2005/Dec/msg00033.html

What happened when you tried them?

---
kai


_______________________________________________ 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
References: 
 >Re: Copy text to the clipboard (From: "John R." <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.