The Apple Event commands ‘Send core event’ and ‘Send Finder event’ no longer work on macOS Sierra and are therefore not supported in Omnis Studio 8.0.3; the commands have been moved from the Apple events… group and placed into the Obsolete commands group in the Method Editor. This means that for older versions of macOS (aka OS X) they will continue to work, but you cannot use them in Studio 8.0.3 on macOS Sierra or future versions. However to support these events for Mac end users Studio 8.0.3 provides an Object class that contains a number of methods that run AppleScript to call the same events in macOS.
Apple Events Object
To replace the functionality of the old “Send Finder Event” commands, the Studio 8.0.3 release includes a new Object class called oFinderEvent which contains a number of methods which run AppleScript to execute the equivalent Apple Finder events, such as a Get File Info event or a Duplicate Files event. The AppleScript is run using the Omnis $runapplescript() method from inside each method in the object class.
To use the object class and these methods, you need to create a copy of the new oFinderEvent object class (New Class in the Studio Browser, then choose Object class, then oFinderEvent), and then create an Object variable in the class in which you wish to use the Apple Events (such as a window, menu or toolbar class), setting its subtype to the oFinderEvent object you created.
Calling the Event methods
You can call the methods in the new Apple Events Object in your code, and run the AppleScript as required, using the Omnis command Do YourObjectVar.$methodname() using the appropriate method name, e.g. $getfileinfo(), $duplicatefiles(), $makealiasforfiles(), $openfiles(), $printfiles(), $revealfiles(), $emptytrash(), $restart(), $shutdown(), and $sleep(). Some of the methods can take a file path as the first parameter, or if this is omitted or empty a file selection dialog will open.
For more info about using Apple Events in Studio 8.0.3, and the other new features in this release see the ‘Whats new’ doc, available here:
To try this new version, you can download it and sign up for a 90-day free trial: