I am using OS X JavaScript for Automation (JXA) and I want to be able to capture an Apple event with an open location.
Per http://www.macosxautomation.com/applescript/linktrigger/ , I configured a client URL handler. How to make an equivalent
on open location this_URL
...
end open location
with jxa? I tried all of the following, but could not get them to execute:
app = Application.currentApplication();
app.includeStandardAdditions = true;
function run() {
app.displayDialog(JSON.stringify(arguments));
}
function openLocation() {
app.displayDialog(JSON.stringify(arguments));
}
function openDocuments() {
app.displayDialog(JSON.stringify(arguments));
}
function onOpenLocation() {
app.displayDialog(JSON.stringify(arguments));
}
Apple JXA docs (https://developer.apple.com/library/mac/releasenotes/InterapplicationCommunication/RN-JavaScriptForAutomation/Articles/OSX10-10.html#//apple_ref/doc/uid/TP40014508-CH109-SW15) , . script , , . URL.
, AppleScript, JXA, , , .
Cookbook JXA (https://github.com/dtinth/JXA-Cookbook).