I noticed on Mojave decompiling AppleScript files that have been saved in debug-mode doesn’t work anymore (it still works on El Capitan):
$ osadecompile assets/asdbg.scpt 2019-03-03 15:27:24.956 osadecompile[58178:10948949] Error loading /Users/xxx/Library/Components/Script Debugger.component/Contents/MacOS/Script Debugger: dlopen(/Users/xxx/Library/Components/Script Debugger.component/Contents/MacOS/Script Debugger, 0x0106): code signature in (/Users/xxx/Library/Components/Script Debugger.component/Contents/MacOS/Script Debugger) not valid for use in process: mapping process is a platform binary, but mapped file is not osadecompile: assets/asdbg.scpt: Can't connect to scripting system with that ID
This is not a big problem; I just want to check if Mojave’s security changes is the source of this (since nothing shows up in the Privacy > Automation tab in system preferences). Also, I used
OSAScript ObjC to detect the language of an
scpt file. That doesn’t work either, and gives me the same error on AppleScript Debugger files.
I now think of detecting file type by checking the headers of these files, like this:
Will this work? I just guessed from some sample files…