appleevents

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

家住魔仙堡 提交于 2019-12-05 07:49:00
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 ( https://developer.apple.com/library/archive/documentation/Security/Conceptual/System_Integrity_Protection_Guide/Introduction/Introduction.html ) doesn't allow the communication. I didn't find any solution yet. Any help appreciated. This is the error message: skipped scripting addition "/Library/ScriptingAdditions/Adobe Unit Types.osax" because it is not SIP-protected. This is a pretty good summary

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

北城以北 提交于 2019-12-03 17:36:38
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 it. I keep finding examples of how to use the OSACompile Terminal command. Can someone provide an example or a link to an example? Ok, the trick was to not bother trying to compile and execute the Applescript but to simply use the osascript system command: sprintf(cmd, "osascript -e 'tell app \"Finder\" to open POSIX file \"%s/%s\"'", getcwd(path,

Using AppleScript with Apple Events in macOS - Script not working

余生颓废 提交于 2019-12-02 08:11:06
问题 We need to use a AppleScript to create an outgoing email message in macOS. The script works fine in the Script Editor. Using the code recommended by DTS https://forums.developer.apple.com/message/301006#301006 no results, warnings or errors. Same result with sample script from the forum. Need Swift and Apple Events expertise here. Thanks! import Foundation import Carbon class EmailDoc: NSObject { var script: NSAppleScript = { let script = NSAppleScript(source: """ set theSubject to "Some

Application exit event

狂风中的少年 提交于 2019-12-02 05:24:50
问题 I am developing an application in cocoa .My application shows a pop up sheet initially .Now i need to know which event is fired when we try to exit the application by right clicking and selecting "exit" on the icon in dock,because i cant exit the appication because of the popup sheet ..looking for a solution 回答1: Your app is sent a quit Apple Event when the Quit item is selected in the Dock menu. If you want to intercept this you will need to install a custom Apple Event Handler for this

AppleScript from Java on Mac OS X 10.6?

Deadly 提交于 2019-12-01 11:12:37
To call AppleScript from Python, I use the "appscript" bridge: http://appscript.sourceforge.net/ What can I use to call AppleScript from Java on Mac OS X 10.6+? Here's an approach that works for me for Java on Mac OS X 10.6+. This example script fetches the creation date of the current folder: import javax.script.ScriptEngine; import javax.script.ScriptEngineManager; import javax.script.ScriptException; import java.io.File; import java.util.Date; import java.util.GregorianCalendar; public class ScratchSpace { public static void main(String[] args) throws ScriptException { System.out.println(

How to relaunch finder application

匆匆过客 提交于 2019-12-01 01:13:55
I am using following applescript to relaunch finder application. osascript -e "tell application \"Finder\"" -e "delay 1" -e "try" -e "quit" -e "delay 1" -e "activate" -e "end try" -e "end tell" But sometimes this script is not relaunching finder application(only quiting finder application). i am not getting any error in console. http://www.cocoabuilder.com/archive/cocoa/113654-nsapplescript-buggy.html Can anyone please help me out? Here's an applescript way. You cannot rely on a specific delay time as you've seen. Therefore we manually wait for the Finder to quit by checking if it's in the

How to relaunch finder application

左心房为你撑大大i 提交于 2019-11-30 20:09:49
问题 I am using following applescript to relaunch finder application. osascript -e "tell application \"Finder\"" -e "delay 1" -e "try" -e "quit" -e "delay 1" -e "activate" -e "end try" -e "end tell" But sometimes this script is not relaunching finder application(only quiting finder application). i am not getting any error in console. http://www.cocoabuilder.com/archive/cocoa/113654-nsapplescript-buggy.html Can anyone please help me out? 回答1: Here's an applescript way. You cannot rely on a specific

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

北慕城南 提交于 2019-11-29 08:03:09
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 find no reference to it in Xcode 5.x documentation) is how can I find out which Apple Event Access Groups are defined for a specific application. For example, if I want my App to communicate with Pages (or Photoshop, or Firefox, etc.), how can I find documentation about its Apple Event Access Groups? Where are they defined, and what tool can I use to

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

99封情书 提交于 2019-11-29 07:30:51
What I'm doing is executing an AppleScript inside of Cocoa. It returns some data as a NSAppleEventDescriptor , which NSLog() prints like so: <NSAppleEventDescriptor: 'obj '{ 'form':'name', 'want':'dskp', 'seld':'utxt'("69671872"), 'from':'null'() }> I want to take that data and turn it into a NSDictionary or NSArray , or something useful so I can extract stuff from it (specifically I'm after the field holding the "69671872" number). It appears to be an array of some sort, but my knowledge with Apple Events is fairly limited. Any idea on how to do this? Here's the source creating the above data

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

[亡魂溺海] 提交于 2019-11-28 22:22:52
问题 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 events for me, both of them report this. Any clue what this is? I found a discussion in the Apple developer forums but they are not any further: https://forums.developer.apple.com/thread/88126 ANY help or pointer in the right direction appreciated.