April 29, 200322 yr 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?
April 30, 200322 yr Author 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?
April 30, 200322 yr What will be the advantage of doing that through AppleScript? You can do it as FM script step.
April 30, 200322 yr 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.
April 30, 200322 yr 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.
May 1, 200322 yr Author 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.
May 1, 200322 yr Author "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
Create an account or sign in to comment