appleevents

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

本小妞迷上赌 提交于 2019-12-18 05:21:32
问题 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

Finder update/refresh applescript not working in 10.8

不羁岁月 提交于 2019-12-17 19:54:20
问题 I have been using apple script for updating display for files and folders in finder. This is simplified version of that script: tell application "Finder" tell window 1 to update items end tell I can see that since 10.8 (Mountain Lion) update command is not properly executed or is not executed at all. Until 10.8 everything was working perfectly - Immediately after update command all icons got redrawn. I use this for showing overlay icons. Have any of you encountered same problem? I blame

How to refresh browser view in finder window(mac os 10.5)?

大兔子大兔子 提交于 2019-12-13 08:35:36
问题 I want to refresh all NSTableView in NSBrowserView of finder on mac os 10.5. For refreshing icon view , list view and flow list view, i am using apple script. @"tell application \"Finder\" to update every item in front window" In browser view this script is only refreshing last column. For example , this script is refreshing only third column(icns-copy.m.....). Can anyone please help me out? 回答1: It's only refreshing the last column because every Finder window has exactly one target folder at

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

↘锁芯ラ 提交于 2019-12-12 08:14:07
问题 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? 回答1: Ok, the trick was to not bother trying to compile and execute the Applescript but to simply use the osascript

How do I interprete a record returned as a NSAppleScript result

£可爱£侵袭症+ 提交于 2019-12-11 10:53:24
问题 I run an applescript from an objective-c application using NSAppleScript the executeAndReturnError method. This returns an NSAppleEventDescriptor object containing the result of the script. My script returns an applescript record. How do interpret the record in objective-c? For instance if the returned script record is { name:"Jakob", phone:"12345678" } how do I get the string "Jakob" in the name property? 回答1: Here's a method to convert the record to a dictionary. Note that I didn't try this

AEInstallEventHandler handler not being called on startup

匆匆过客 提交于 2019-12-11 10:24:13
问题 I've installed a Apple Event handler for URL's in my app: OSStatus e = AEInstallEventHandler( kInternetEventClass, kAEGetURL, NewAEEventHandlerUPP(AppleEventProc), (SRefCon)this, false); And that works if my application is running. However if my app is NOT running, clicking a URL in a browser starts the application but no Apple Event is received on my handler. My call to AEInstallEventHandler is during my app's startup phase, before it reaches the message loop. It's not the very first thing I

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

可紊 提交于 2019-12-10 17:05:48
问题 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 timeout is hit, a response is sent to the apple event, and the calling app (e.g., applescript editor) proceeds. In detail, here's what I see. After application:openFile: returns YES, I can see that -[NSAppleEventManager suspendCurrentAppleEvent] is

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

﹥>﹥吖頭↗ 提交于 2019-12-10 04:35:38
问题 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

How to force kill another application in cocoa Mac OS X 10.5

我的梦境 提交于 2019-12-08 08:04:37
问题 I've this task, from my application i need to kill another my application, the problem is that the other application has a Termination Confirm Dialog (there is no critical data to save, only confirmation of user intent to quit). On 10.6+ you will use: bool TerminatedAtLeastOne = false; // For OS X >= 10.6 NSWorkspace has the nifty runningApplications-method. if ([NSRunningApplication respondsToSelector:@selector(runningApplicationsWithBundleIdentifier:)]) { for (NSRunningApplication *app in

Tap AppleEvents being sent to another application

让人想犯罪 __ 提交于 2019-12-08 05:03:30
Is it possible to monitor or tap the stream of Apple Events being sent to a process, in the same way you can tap Quartz Events? I have an application that talks to another application to force it to import files, but it does so in a way that's unavailable through menus or UI scripting, and I'm trying to track down how it does this. Do you need to do this programmatically or is manual/interactive OK? If manual is OK, here are some approaches: Try using AppleScript Editor to record the target app. Try using the techniques listed in Technical Note TN2124: Mac OS X Debugging Magic under Apple