Jump to content
Server Maintenance This Week. ×

Check if DB is open?


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

Recommended Posts

How can I make sure my Database is open before I try to access it via AppleScript?

And if my FileMaker Pro client loses its connection with the FileMaker Server, is there a way I can automatically dismiss the warning that appears and then have FMP try to reconnect?

Link to comment
Share on other sites

As for the first question:

I assume by Applescript you mean a Filemaker script?

DatabaseNames will return the list of databases currently opened on your machine. It will return a list with hard returns (¶) between each database:

Contacts

Menu

Orders

Settings

Use:

PatternCount( DatabaseNames; NameOfDesiredDatabase ) > 0

If it returns > 0 (true) then the database is already open.

Example: PatternCount( DatabaseNames; "Settings" ) > 0 is true using the list above.

Second question:

Hm, wait a tick. Now that I think about it, I'm thinking of the wrong answer for this question. I'll let someone else field this question...

Link to comment
Share on other sites

I actually mean AppleScript.

I have an AppleScript that kicks off FileMaker Pro to run a FileMaker Script...

--hint from http://fmforums.com/forum/showtopic.php?tid/180492/post/new

tell application "FileMaker Pro"

	activate

	do script FileMaker script "SomeScript"

end tell

My thought was that I should probably test that my database is actually open before I go and try to run a script.

Link to comment
Share on other sites

  • 2 weeks later...
  • Newbies

I have a little handler for just such a reason.

-- This subroutine test that the specified database is running

on filemakerTestForRunningDatabase(databaseName)

	tell application "FileMaker Pro"

		if exists database databaseName then

			return

		else

			activate

			display dialog "Please activate database " & databaseName & " and restart this program" buttons {"Cancel"} cancel button 1 default button 1

			tell me to activate

		end if

	end tell

end filemakerTestForRunningDatabase

Hope this helps.

Tim

Link to comment
Share on other sites

This topic is 6379 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.