macos – How one can osacompile a script containing `inform Software` and NSAppleScriptEnabled with out activating it


How do I compile the next script with out really activating the appliance in the course of the compilation?

inform software "/Purposes/VLC.app" to activate

If I do e.g. this, it is not going to solely create a launcher bundle, but additionally activate VLC.app throughout compilation:

osacompile  -o foo.app -e 'inform software "/Purposes/VLC.app" to activate'

This launches VLC instantly, even in case you do not contact foo.app.

I performed round with the Data.plist in VLC.app and I discovered that the offending flag is that this one:

    <key>NSAppleScriptEnabled</key>
    <true/>

If the goal app bundle specifies that, it’ll launch on compilation. I can solely assume osacompile does some form of inspection on the bundle, sees that flag, then one way or the other has to activate the app to examine its applescript assist?

VLC is only a place holder right here, I am attempting to programmatically create launchers for arbitrary functions. My present work-around is do shell script "open "/Purposes/VLC.app"". It really works for activating (the run hook), however not for different hooks, e.g.

on open names
  inform software ... to open names
finish open

That additionally opens the goal app on compilation if it declares assist for apple script.

My query is: how do I keep away from that, and simply create a pure launcher script with out osacompile really launching the app?

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *