Using osadecompile to get plain text AppleScript runs certain actions from the script I've been using this solution to decompile AppleScript files before adding them to a Git repository. It basically creates a filter using osacompile and osadecompile to convert between plain text source and a compiled AppleScript.

I noticed however, that some applications referenced in the scripts are unexpectedly starting on git add and the culprit is osadecompile.

Example:

When I run osadecompile script.scpt against the following script, a Firefox starts up:

tell application "Firefox"
    open location "https://apple.stackexchange.com"
end tell


It doesn't open the location specified, however the Firefox process gets started and remains running.

Questions:


Is there anything I can do to avoid this?
What exactly is happening here? Does the script run in background (other actions  from the scripts - like say "something" do not seem to run)?
I am not sure what the technical reason for this is, but accessing the AppleScript dictionary of some applications seems to require opening them. When I try opening the AppleScript dictionary of Firefox through Script Editor, Firefox will also be opened. When I try opening the dictionary of Keynote v5.3 (iWork'09 version), the app is opened, while when I try this with Keynote v7.0.5, the app is not opened. As Script Editor exhibits the same behavior, I am not sure there's any way to avoid this with osadecompile.

I did not read the Apple Developer documentation on AppleScript in detail, but I noticed this sentence which also suggests some applications need to be opened to access their AppleScript dictionary while some don’t:


  An aete is useful in 10.4 and earlier, in both Carbon and Cocoa applications, to provide a dictionary that scripting languages can use without launching the application.