appleevents

AppleEvent: how to debug `eventDidFail`?

心已入冬 提交于 2020-01-25 12:20:06
问题 I am getting this error from SIMBL in the console: 05.09.11 17:00:09,165 SIMBL Agent: eventDidFail:'tvea' error:Error Domain=NSOSStatusErrorDomain Code=-1708 "The operation couldn’t be completed. (OSStatus error -1708.)" (the AppleEvent was not handled by any handler ) UserInfo=0x400e485c0 {ErrorNumber=-1708} userInfo:{ ErrorNumber = "-1708"; } I am trying to debug this; but as I haven't really worked with AppleEvent that much yet, I'm not really sure how to interpret that. I think the

Translate into Apple Events AppleScript

北慕城南 提交于 2020-01-06 08:26:29
问题 I have an very simple applescript: tell application "Opera" get URL of active tab of window 1 end tell I want to see Apple Events underlying. So I have launched it with these two environment variables enabled: export AEDebugSends=1; export AEDebugReceives=1 Now I am getting this output: osascript browser.scpt {core,getd target='psn '[Opera] {----={form=prop,want=prop,seld=URL ,from={form=prop,want=prop,seld=acTa,from={form=indx,want=cwin,seld=1,from=NULL-impl}}}} attr:{csig=65536 returnID

get url event on app open in objective c (Mac OSX)

筅森魡賤 提交于 2019-12-30 10:47:25
问题 I'm writing a very lightweight app for OSX 10.6+ which will respond to a user clicking on a URL, pass that URL to another application via TCP and then exit. So far it has registered fine to launch when a user clicks the custom url scheme. However the event seems to get lost if the app is not already running. So the users clicks the link, the app loads, but nothing happens. Once the app is running, if the user clicks the link then it grabs the event and processes it as normal. What do I need

AppleScript Email Attachment not working in handler

荒凉一梦 提交于 2019-12-24 08:09:41
问题 We have a working AppleScript that creates an email with an attachment and it works fine in the Script Editor. However, we cannot get the attachment to work in the handler used in our macOS app. Difficult to find doc and figure out the difference between activate and send commands. Thanks for any help you can provide. Here is the AppleScript set recipientAddress to "joe@joe.com" set recipientName to "Joe" set theSubject to "Estimate" set theContent to "This is your Estimate. Please call with

How to send and receive NSAppleEventDescriptor when using NSWorkspace to open URLs between apps?

放肆的年华 提交于 2019-12-24 07:29:14
问题 NSWorkspace has the method open(_:withAppBundleIdentifier: [...] ) : Opens one or more files from an array of URLs. func open(_ urls: [URL], withAppBundleIdentifier bundleIdentifier: String?, options: NSWorkspace.LaunchOptions = [], additionalEventParamDescriptor descriptor: NSAppleEventDescriptor?, launchIdentifiers identifiers:) -> Bool The NSApplicationDelegate of the app you want to open has corresponding methods that are called to open the URL(s) you provide: func application(_ sender:

How to send and receive NSAppleEventDescriptor when using NSWorkspace to open URLs between apps?

倾然丶 夕夏残阳落幕 提交于 2019-12-24 07:29:12
问题 NSWorkspace has the method open(_:withAppBundleIdentifier: [...] ) : Opens one or more files from an array of URLs. func open(_ urls: [URL], withAppBundleIdentifier bundleIdentifier: String?, options: NSWorkspace.LaunchOptions = [], additionalEventParamDescriptor descriptor: NSAppleEventDescriptor?, launchIdentifiers identifiers:) -> Bool The NSApplicationDelegate of the app you want to open has corresponding methods that are called to open the URL(s) you provide: func application(_ sender:

Programmatically enter text into any application

試著忘記壹切 提交于 2019-12-24 02:35:09
问题 Is there a proof-of-concept Objective-C executable that enters some text into an application and then clicks the mouse, using Apple events and not AppleScript? e.g. the AppleScript equivalent of tell application "System Events" tell process "Safari" keystroke "Hello World" click end tell end tell It should work on Mac OS X 10.9, preferably be future oriented (backwards compatibility doesn't matter). The context is that I will be calling the Objective-C code from another language. I'm saying

How to send a “Cmd-C” keystroke to the active application in objective-c, or tell the application to do a copy operation?

若如初见. 提交于 2019-12-23 05:23:34
问题 Getting the active application is not a problem, I already have this implemented. What I want to know is how to send a "Cmd-C" key combination to the active application so it puts the selected text in the clipboard (general pasteboard). Or even better: how to tell the active application to do a copy operation without sending the keystroke, or without highlighting the "Edit" menu when the copy operation is triggered. I can't use NSAppleScript (10.2) because this specific class must be as

Tap AppleEvents being sent to another application

南楼画角 提交于 2019-12-23 03:47:08
问题 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. 回答1: 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

AppleScript from Java on Mac OS X 10.6?

心不动则不痛 提交于 2019-12-19 10:16:55
问题 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+? 回答1: 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;