Questions tagged [appleevents]

An Apple event is a type of interprocess message that can specify complex operations and data.

An Apple event is a type of interprocess message that can specify complex operations and data. Apple events allow you to gather all the data necessary to accomplish a high level task into a single package that can be passed across process boundaries, evaluated, and returned with results. The Mac OS uses Apple events to communicate with applications. Apple events are also an essential part of the AppleScript scripting system, which allows users to automate actions using scriptable applications—applications that can respond to a variety of Apple events by performing operations or supplying data.

84 questions
28
votes
1 answer

AppleEvents: received mach msg which wasn't complex type as expected in getMemoryReference

I am on Xcode 9.2, OSX, Objective-C. Since OSX High Sierra Update, i get a lot of error messages logged like this: AppleEvents: received mach msg which wasn't complex type as expected in getMemoryReference. I have two XPC Services handling apple…
Pat_Morita
  • 3,355
  • 3
  • 25
  • 36
14
votes
3 answers

Set position of window with AppleScript

I'm trying to set the position of the Messages.app chat window using AppleScript. tell application "System Events" set position of window 1 of application "Messages" to {100, 100} end tell With this code I get an error: error "Messages got an…
DrummerB
  • 39,814
  • 12
  • 105
  • 142
7
votes
2 answers

Does Ruby offer a mechanism for responding to Apple Events on OS X?

I'm working on a desktop application for OS X using Ruby-Tk, and I would like to provide an Apple Events interface for the application. This means that the application would define a dictionary of AppleScript commands that it would respond to…
Kevin Walzer
  • 538
  • 4
  • 14
7
votes
3 answers

"because it is not SIP-protected" - Apple event error in macOS Mojave

I have a properly sandboxed application in macOS, Objective-C that talks to third party applications by Apple Events (e.g. Adobe InDesign). In macOS Mojave everything breaks cause Apple's new SIP…
Pat_Morita
  • 3,355
  • 3
  • 25
  • 36
6
votes
3 answers

How do I get the window id and tab number of a Terminal window using AppleScript via the ScriptingBridge?

I can open a Terminal tab using the following AppleScript: tell application "Terminal" set myTab to do script "exec sleep 1" get myTab end tell This returns a string like: tab 1 of window id 3263 of application "Terminal". This is great, I…
Gavin Brock
  • 5,027
  • 1
  • 30
  • 33
5
votes
2 answers

How can I execute a simple Applescript from a C++ program?

I would like to execute the Applescript command tell application "Finder" to open POSIX file */path/to/somefilename* from a C++ program. It looks like I might want to use OSACompileExecute, but I haven't been able to find an example of how to use…
SSteve
  • 10,550
  • 5
  • 46
  • 72
5
votes
2 answers

AppleScript reference objects - help me understand them

Why do these even exist? It seems absurd. Like with most dynamic languages, AppleScript types seem to be either immutable primitive types like integers and reals which are going to be handed around by value and don't make any sense to use with a…
Ted Middleton
  • 6,859
  • 10
  • 51
  • 71
5
votes
1 answer

Way to listen in on all Apple Events?

I'm looking for a way to listen in to all Apple Events send by any program to any other program. There was an app, AEMonitor, that used to do this but it is abandonware as of now. Is there a known way to do this via cocoa, carbon, etc? Any help MUCH…
Andrew J. Freyer
  • 591
  • 2
  • 12
  • 38
5
votes
1 answer

Replying to an Apple Event in Cocoa

I'm registering an Apple Event handler using NSAppleEventManager: [[NSAppleEventManager sharedAppleEventManager] setEventHandler:self andSelector:@selector(handleGetURLEvent:withReplyEvent:) forEventClass:kInternetEventClass…
Peter Hosey
  • 95,783
  • 15
  • 211
  • 370
5
votes
3 answers

How to Extract AppleScript Data from a NSAppleEventDescriptor in Cocoa and Parse it

What I'm doing is executing an AppleScript inside of Cocoa. It returns some data as a NSAppleEventDescriptor, which NSLog() prints like so:
Dave
4
votes
1 answer

Subscribing to Apple events in Qt

Following the the code linked from here: Trap click event on dock icon using Qt on Mac, I tried to call the following method directly in my QApplication's constructor to receive notification of dock icon click events: [[NSAppleEventManager…
Jake Petroules
  • 23,472
  • 35
  • 144
  • 225
4
votes
1 answer

How can I know the Apple Event Access Groups used by an application?

Apples' Sandobox is supposed to use Apple Event Access Groups, which allow applications to communicate with each other, as described in the WWDC video "Session 206 Secure Automation Techniques In OS X" However, what is not mentioned (and I could…
LMP32
  • 43
  • 3
4
votes
1 answer

Correct handler in AppleScript to respond to the "open" Unix command for a custom URL handling applet

I'm trying to write a simple AppleScript application that handles sftp:// and sshfs:// URLs on my Mac. Based on a good guide on how to create a custom URL handler app in AppleScript, I wrote a small app as follows and it works well when I click on…
netj
  • 111
  • 4
  • 4
4
votes
0 answers

Very slow to open a file with application:openFile: after returning

My application implements the NSApplicationDelegate method -application:openFile: in its app delegate. There seems to be a problem new to OS 10.8 where after receiving the apple event to open a file, five seconds pass before some kind of internal…
George
  • 4,189
  • 2
  • 24
  • 23
3
votes
1 answer

Applescript: Safari Can't Save Web Page (AppleEvent Handler Fails Error)

I want safari to download and save a web page using apple automator. With a Safari window open, I run the following script in AppleScript Editor: tell application "Safari" set URL of document 1 to "http://www.python.org" delay 6 get…
PatentDeathSquad
  • 543
  • 2
  • 7
  • 16
1
2 3 4 5 6