Jump to content

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

Recommended Posts

After folllowing the advice of some wise folks on this board, I have created a small, lean opener file that pops up a custom error message if the requested database is not found on the server. It also lets a user know if FileMaker Pro is not configured for TCP/IP (my network's protocol) and allows them to open Application Preferences to fix it.

There are some elements to this file that you might want to change, as this is tailored for my network, but it's completely open.

I'm also interested in ways I can improve this file, so please post feedback!

ClientOpen.hqx

Link to comment
Share on other sites

  • 2 months later...

A couple of comments, since you asked for feedback:

- "Click to try again" IMO would be more intuitive if you actually provided something to click on. I'd recommend just replacing that text with a button that is labeled "Try again." Users know that buttons are supposed to be clicked.

- Along the same lines, when opening fails and you use Show Message, when there is only one option, the button should be "OK" rather than "Cancel."

- I've had problems with windows failing to refresh as expected in OS X. You can fix this by following your Refresh command with Omit Record, then Show Omitted. Weird, but it works.

- I'm pretty sure your If [status(CurrentError) ? 0] won't do anything, because it's not part of the first Error trapping step. Put Else before it and move the End If above it down to below the last End If. Or, if you don't like nested Ifs -- and who does? -- you can just set a global field to the Status(CurrentError) right after the error trap. Then make all your If statements refer to the value of this global.

- Avoid Clear when possible. Use Set Field [message, ""]

- It's handy to be able to bypass the script when you're developing. You could add If [status(CurrentModifierKeys) = 1]... Halt Script ... so you can open the file with the Shift key and it won't try to find the network.

That's about it -- nice job!

Link to comment
Share on other sites

Thanks for the feedback! I implemented most of it. I tried the file out on a 10.2 OS X iMac, and you're right; it didn't refresh like I expected. But when I tried putting in Omit Record and Show Omitted right after the Refresh Window step, but it didn't seem to totally fix the issue. I left it out for now.

The second If statement with the error code of "not 0" was meant as a failsafe of any other error that might happen. I believe the first If statement will not screw this up, as there is no Else step for it. The Script Debugger checks the If statement, so it works.

I actually don't know how to trigger an error for this, so I can't even test it.

BTW, if anyone's wondering why I want to control missing file errors...

The majority of times when a hosted file is missing, the Open dialog box defaults right on the FM Open.fp5, wherever it may sit on the local drive. I have noticed people simply are not interested in reading error messages, and the impulse is to click on OK or hit Enter immediately. By doing this, it screws up the Open File script step by replacing the correct hosted file with "FM Open.fp5". The next time the user uses the opener file, nothing happens because of the circular reference. tongue.gif

Link to comment
Share on other sites

You are totally right to trap for errors in your opener files. Broken openers are always a tech support nightmare.

What I mean about your second If statement is not that the first one will screw it up -- it's that the second If will always be ignored, that's just the way FileMaker works. Status(CurrentError) is only relevant for the step immediately following the error. Try this experiment, make a script that does the following:

Turn error capture on

Do something that generates an error, e.g. a Find for some nonsense text

If [status(CurrentError) <> 0]

...Show Message ["error one"]

End If

If [status(CurrentError) <> 0]

...Show Message ["error two"]

End If

OK. You will never see "error two." See what I mean? The status of the current error went bye-bye after the first If statement ended.

Link to comment
Share on other sites

Hey, that's right! I was actually trying to put comments in the script before the If statements... I couldn't get it to trigger at all, so I took out the comments. I don't know why I didn't notice that before. Thanks for the help!

Link to comment
Share on other sites

I've had problem on window refresh under macosx.

The button doesn't change to "working" while fm searches the served file.

I could fix it with:

Enter Preview Mode[]

Enter Browse Mode[]

after the Exit Record script steps.

---

Problem 2: when i open the opener the annoying "date format" dialog pops up.

It would be good to find a way to avoid it.

----

Paolo.

Link to comment
Share on other sites

×
×
  • Create New...

Important Information

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