Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 7879 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

I'm trying to write an AppleScript that will set multi-user or single-user for a bunch of FMP files dragged onto it.

I've got it to prompt for the password, and prompt for multi or single user, and then for each of the files it runs the following command:

set multiuser of database DBName to multiuser

where "DBName" is the filename of the database and "multiuser" is either TRUE of FALSE.

However this command doesn't seem to do anything - not even an error. What am I doing wrong?

How do I AppleScript the setting of multi-user for an FMP database?

Posted

Okay, so it does actually give an error. The subroutine which performs this command was within a "try...on error...end try" structure, so I hadn't seen any error until I commented out the "try" stuff.

The error is:

"Object is not an element of property of this class"

So I guess that I'm guessing that my "DBName" is not of the right database class.

How do I get an FMP database class from a database name?

Posted

tell application "FileMaker Pro"

tell database 1

if multiuser = false then

set multiuser to true

else

set multiuser to false

end if

end tell

end tell

+add a repeat loop for all databases dropped on the applet.

Posted

database 1 is just the frontmost database. You will need to open each database in your drop script and close them after changing the multiuser status.

Posted

Well if I did it using ScriptMaker, I'd still have to use AppleScript to call the FMP ScriptMaker script then wouldn't I?

I'm trying to automate the procedure for a large number of FMP files. That's the point.

Posted

"database 1"

I'd rather use the database name (in case the user brought up some other database while the script was runnin, for example), to make sure I'm using the right database, but I guess the number would have worked.

I got it working using the name eventually. Pain in the bum though. AppleScript really sucks as a laguage. I ended up doing the following for each file after opening it (where DB is the file itself, and multi is either TRUE or FALSE):

tell application "Finder" to set DBName to (name of DB)

tell application "FileMaker Pro"

set dbase to (database DBName of window DBName)

try

set multiuser of dbase to multi

on error

display dialog "ERROR: A problem occurred while trying to set the shared mode for '" & DBName & "'."

end try

end tell

This topic is 7879 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.