Apple Events in Omnis Studio 8.0.3

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:
http://www.omnis.net/products/studio/whatsnew.jsp

To try this new version, you can download it and sign up for a 90-day free trial:
http://www.omnis.net/download/index.jsp

1 Comment
  1. Profile photo of Clément Dourlens
    Clément Dourlens 4 months ago

    Hi all,

    Apple just bring out new features with macOS Sierra (iOS 10.3)
    and just replaced their File system based on HFS+ with a new one APFS.

    https://www.backblaze.com/blog/apfs-apple-file-system/

    Best regards,

Leave a reply

© Omnis Software Ltd 2017 - Help with setup and design by Ädelfors Consult ABSweden Disclaimer: Omnis Software disclaims any responsibility for or liability related to Software, or any content or advice, obtained through this site. IN NO EVENT WILL OMNIS SOFTWARE BE LIABLE FOR ANY INDIRECT, PUNITIVE, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES HOWEVER THEY MAY ARISE AND EVEN IF OMNIS SOFTWARE HAS BEEN PREVIOUSLY ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

Log in with your credentials

or    

Forgot your details?

Create Account