-2

I am trying, from a sandboxed menubar application, to get the selected (highlighted) text in the current application. I was using accessibility before and traversing the main menu of the application until finding the copy item but unfortunately, I need to sandbox the application and this is no more a valid approach.

I would like to simulate the ⌘ + C keyboard shortcut but so far all my attempts failed.

AP.
  • 5,205
  • 7
  • 50
  • 94

1 Answers1

0

so far all my attempts failed

There is a reason for that...

A core purpose of the sandbox is to provide isolation between applications, to prevent one application from accessing the data of another. So what you are asking is how to break out of the sandbox...

If you are writing accessibility software take a look at How to use Accessibility with sandboxed app? for maybe the smallest glimmer of a hope.

Otherwise your current path is a (hopefully, its a sandbox) dead-end, security has a price, sorry.

CRD
  • 52,522
  • 5
  • 70
  • 86
  • I unfortunately have to say that you are right. I found a way using AppleScript but it does not seems sustainable enough. – AP. Sep 17 '19 at 06:46