Jump to content

Check if file is closed before importing from another database


argwallace

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

Recommended Posts

Greetings!

 

I have what I hope is a very easy problem to solve. I have a runtime that imports data from another runtime file. Everything works fine as long as the other file is closed. I have had users who have run the import while the other file is open and the script completes but obviously nothing gets imported because the other file is currently locked. Before running the import script, I would like to test to see if the other file is closed. Is there an easy way to do this? Some calculation that I can test against? etc.

 

Any thoughts would be helpful!!

 

Thanks!

 

Stephen

Link to comment
Share on other sites

I haven't used runtimes in ages. If it really works they way you describe (and it makes sense that's how it would behave), then there's not much you can do within Filemaker itself. However, you could use AppleScript to check if the other application is running and/or quit it.

Link to comment
Share on other sites

In my current import scripts, they will run normally but just won't import any data. I'm trying to catch this before it runs the import so I can give a warning. I am not too versed in Applescript though I have used it somewhat. I'd be open to doing that. Any ideas?

Link to comment
Share on other sites

[croak ... layers of rust cracking ... groan]

 

Well, normally you would test for application's running status as:

tell application "System Events" to set appStatus to exists (processes where name is "YourAppName")

However, I have just now tested this with a runtime, and it seems that the name of the process of every runtime is "Runtime" - so try testing the bundle identifier instead. Here's the entire AppleScript as you would use it in Filemaker:

tell application "System Events" to set appStatus to exists (processes where bundle identifier is "com.filemaker.client.runtime.MyRuntime")
set cell "gRegister" to appStatus

where "MyRuntime" is the name of the runtime application you want to check, and gRegister is a global field to receive the result (and it must be on the current layout).

 

 

Caveat: I haven't really tested this with two runtimes.

Link to comment
Share on other sites

  • 2 weeks later...

I also found that error code 803 would trigger when trying to import records from a runtime that is open. So in the end I was able to capture this error and proceed accordingly. In other parts of the program, I do use AppleScript and it has worked well thus far. Thanks again!

Link to comment
Share on other sites

I also found that error code 803 would trigger when trying to import records from a runtime that is open. So in the end I was able to capture this error and proceed accordingly.

 

Ha! Good for you! And thank you, this is a good lesson for me: I should have thought of this, runtime or no runtime.   :doah:

Link to comment
Share on other sites

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