Jump to content
Sign in to follow this  
Randy

Opening Script

Recommended Posts

Hello All,

I am in the habit of creating a small database file with no fields and 1 script with the goal of opening a hosted solution. The script is simple:

ToggleWindow (Hide)

Open (database.fp5 xxx.xxx.xxx.xxx)

Close (opening database)

Set this script to run at opening.

This seems to work well, for a time...

I can't seem to figure out what causes the file to fail. When it does fail, opening the script results only in the application opening and a brief attempt to locate the hosted database.

Its a catch-22, because as soon as this file stops working, you can't troubleshoot it because the script runs at start up and when it fails to open the hosted database the opening database closes.

The only clue I have towards solving this dilema is that it seems to begin when the hosted database is unavailable for whatever reason.

Any thoughts or recommendations are greatly appreciated.

Randy

Share this post


Link to post
Share on other sites

"...you can't troubleshoot it because the script runs at start up and when it fails to open the hosted database the opening database closes."

But perhaps you can troubleshoot it.

ToggleWindow (Hide)

Open (database.fp5 xxx.xxx.xxx.xxx)

Pause/Resume Script []

*Comment, Insert to troubleshoot and then remember to remove this line.

Close (opening database)

Share this post


Link to post
Share on other sites

If you turn error handling on at the start of the script then you should be able to make a conditional decision immediately after attempt to open.

Share this post


Link to post
Share on other sites

First of all, to troubleshoot, I suggest you give yourself a 'backdoor'. Two ways of doing this are:

1. Place additional steps at the beginning of the start-up script as follows:

If ["Status(CurrentModifierKeys) = 1"]

Exit Script

EndIf


That way, if you hold the shift key down as the file is launched, the start-up script will exit before it closes the file.

or

2. Add a single step dummy script (eg Go to Layout[ ]) in the file which you can call as an external script from within another file. When a file is opened indirectly in this way, its start-up script doesn't run.

Numerous variations on the above themes should get you a back-door that lets you crack into the file to troubleshoot.

Now on to your underlying problem...

It seems from your description that the problem may stem from a broken path. That is, when the file which is to be opened is not available, FileMaker is updating its reference to the file - in this case to <file missing> and this null parameter is being saved with the file when the script closes it.

I suggest that you explore alternative ways to open the file. Currently you are using the 'Open [ ]' script step. Try using a 'Perform Script' step which points to the start-up script in your main solution file(s) or a 'Set Field' step which sources or targets a field in the main solution file. You will find that these alternative methods are just as effective in opening the desired file(s), but have different characteristics, both in regard to the state in which the target file is opened (eg hidden/minimized or not, whether the start-up script is invoked etc) and also the way in which broken paths are handled on different platforms.

Once you have got a back-door for troubleshooting, I'm confident you'll find a combination of steps which will ensure that your open file continues to function even should the path be broken.

Share this post


Link to post
Share on other sites

If you have error capture on you can trap for error 100 missing file.

If ["Status(Currenterror) = 100"]

ShowMessage (The serve must be down....... Contact techsupport)

QuitApplication.

EndIf

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...

Important Information

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