After I updated to Mojave, I can no longer use the automator service I've previously been using with the alert below.
Do you see any problem with my code or is this the problem of the newest macOS?
Script
on run {input, parameters} set pathList to {} repeat with itemNum from 1 to count of input tell application "System Events" copy POSIX path of (container of (item itemNum of input)) to end of pathList end tell end repeat return pathList end run
In Mac OS X, scripting of system functionality of this kind has been moved to a faceless background application called System Events (located in the CoreServices folder, along with the Finder).
However, iOS and iPadOS have no support for AppleScript, and Apple is clearly heading in a trend of switching many apps over to Catalyst (and strongly encouraging 3rd party apps to do the same).
System Events is a faceless background app provided by Apple that gives AppleScript access to certain system functions and attributes. For example, we can use the app to change the desktop picture, control the user interface of other applications, change the screen saver, navigate the file system hierarchy, and more.
This is definitely a part of Mojave's new security framework. In terminal
try
osascript -e 'tell application "Finder"' -e 'set _b to bounds of window of desktop' -e 'end tell'
and you may receive:
36:42: execution error: Not authorized to send Apple events to Finder. (-1743)
What is supposed to happen on the first execution is the Finder opens a dialog box informing you that terminal
is requesting permission to send events to the Finder. If you allow it, then terminal
will get added to the Automation page in System Preferences > Security & Privacy > Automation
:
There's two issues that I see at the moment:
Others have written up more extensive information about this:
Hopefully this gets worked out before Mojave ships as it seriously impacts automation capabilities on macOS.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With