Getting an -4960 error on FMDBAS bundle when trying to run script using osascript

Hi,

I wrote a script that I (eventually) want to run using launchd.
In this script I use the SQLite Lib to create and use an in-memory database.
Running it in scriptdebugger or by double clicking the created .app works fine.

When I try running it from the commandline using osascript I get an error:

Desktop % osascript database-test.app                                                                   
database-test.app: execution error: The bundle “FMDBAS” couldn’t be loaded. (-4960)

Anyone has an idea how I can solve this?

I’m running MacOS Catalina 10.15.6

Thanks, René

Unfortunately you can’t load non-Apple frameworks using osascript.

Thanks for your answer.
So I won’t be able to run my script through launchd either I guess.

Back to the drawingboard… :thinking:

You will if you save it as an applet.

OK. I have some progress, but getting another error now.

I created a new script using the applet template.
I added SQLite Lib2.scptd to the Resources
Saved the script to update-calendar.app
Running it from SD or finder works without a problem.
Running it using osascript:

Desktop % osascript update_calendar.app/
update_calendar.app/: execution error: FMDatabase doesn’t understand the “databaseWithFileOrPathAS_” message. (-1708)

I tried 3 options for the database “in file” parameter: missing value, empty string and a on-disk database. All work as long as I don’t try to run the app using osascript.

Have you got any ideas how to solve this?

You don’t need to use osascript with an applet. Try open instead.

I tried using open, but where not able to pass any arguments to the applet.

Since then I’ve solved my problem via another way, but would still be interested into how I should pass arguments to an applescript applet…

Thanks!

I’m not sure if it can be done without ASObjC, but this works:

use AppleScript version "2.4" -- Yosemite (10.10) or later
use framework "Foundation"
use framework "AppKit"
use scripting additions

set theArgs to current application's NSProcessInfo's processInfo()'s arguments() as list
display dialog last item of theArgs

With:

open -a /Users/shane/Desktop/Applet_test.app --args hello