• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
how can I copy from another app?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

how can I copy from another app?


  • Subject: how can I copy from another app?
  • From: Jim Thomason <email@hidden>
  • Date: Wed, 04 May 2011 16:46:04 -0500

I know this has been asked a bajillion times before, yet here we are.

So it turns out that my simple little applescript to copy in from
another app was ineffective. Lots more digging around led me to create
this:

tell application "Xcode"
	activate
	tell application "System Events"
		tell application process "Xcode"
			set frontmost to true
			keystroke "c" using command down
		end tell
	end tell
	display dialog (the clipboard)
	set foo to path to frontmost application
	display dialog foo
end tell

which is currently hardwired to Xcode and has a couple of dialogs for
debugging purposes. Yes, yes, I know that blissfully assuming that
command-C performs a copy operation is less than ideal. Best option
I've seen so far.

Here's the annoying bit - this works just fine when run from the
Script Editor. But when I run it within my app by firing it off via an
NSAppleScript call, it fails and copies no text. I even tried saving
it as a separate script and invoking it via osascript and had no luck.
Again, that works just fine on the command line calling it directly,
but not from within the app.

I'm utterly stumped. Is there something simple I'm missing? An option
to turn on?

Is there some other approach I should try instead?

-Jim....
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • RE: how can I copy from another app?
      • From: Shawn Bakhtiar <email@hidden>
  • Prev by Date: Re: [NSMenu _enableItem} crash
  • Next by Date: RE: how can I copy from another app?
  • Previous by thread: Re: [NSMenu _enableItem} crash
  • Next by thread: RE: how can I copy from another app?
  • Index(es):
    • Date
    • Thread