Jump to content
Server Maintenance This Week. ×

Opener Script not working


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

Recommended Posts

I am having a problem with a script that I am writing as a start-up for some databases.

What I am trying to do is make an "Opener" file that will sit on the users desktop and when they double click on it it will 1. ask for the password (same as IEP), then 2. open the IEP databases and then 3. close itself.

The script would be set to run at Startup for the DB.

Here is the script

:

If["Status (17)"] Status(CurrentModifierKey)

Halt Script

End If

Allow User Abort [Off]

Set Error Capture [On]

Open ["Start.fp5 (*)"] "*"=network

Set Field ["LastErrorGlobal","Status(0)"] Status(CurrentError)

If ["LastErrorGlobal <>0"] "<>" is not equal to

Show Message["Sorry, database not found."]

End If

Close ["IEP_Startup"]

When I double click on the "Startup_IEP" DB, it opens FMP, and give me the enter Password dialog box. I put in the password and it just brings up the blank record in the Startup_IEP DB and doesn't go to the "Start.fp5" file in the Server.

In the Global field should, I put in the error codes to store them, i.e., 0= No error, 100= File Missing

Can you help me figure out what I'm doing wrong?

The passwords are correct.

Link to comment
Share on other sites

You can troubleshoot a complicated script by inserting Pause Script steps and then running the script to see where it fails. But for a short script like this, I'd just make a copy of it, then delete all the steps but Open(). Then you'll know if it's a network problem. If it works, I'd make another copy of the script and remove the first IF group. Etc.

Link to comment
Share on other sites

So you already know the problem. So try a different Status(CurrentModifierKey) test -- how 'bout 5, that's Ctl-Shift on both Mac and Windows.

Link to comment
Share on other sites

A quick discovery I made with modifier keys: FMP 5.0v3 MacOS responds to modifier keys even when FMP is in the background!

I made a little file to generate prime numbers 9just for grins) which just sits there in a loop crunching. As a defense mechanism I put in a Exit Loop (and beep) if the CapsLock was down. I'd start it up and let it run in the background while I did other work.

Well imagine my surprise when I'd be typing in my e-mail program, press the CapsLock key and the computer would beep! A quick check of FMP shows it has seen the modifier key and responded while in the background.

If anybody wants a copy of the primes database. let me know here on the forum. It's pretty crude but it works!

Link to comment
Share on other sites

Fitch,

Instead of the initial "If" statement I had originally had a 3 second pause and everything worked great after I clicked the continue button. So I think it is hanging up in the If statement.

I don't want the users to be able to quit the script, which they can do if I set it to pause.

[ April 04, 2002, 12:54 PM: Message edited by: pieces ]

Link to comment
Share on other sites

Thanks for the tips.

However, it still isn't working. I tried 1, 4, and 5 as the modifier keys. I tried "exit script" instead of "halt script", both seem to work.

Its not that the Status(CurrentModifier Key) isn't working, its that the script halts even if I don't hold down the modifier key(s).

I'm using FMP 5.5 on a Macintosh.

Link to comment
Share on other sites

Could it be... I had assumed that when you wrote:

If["Status (17)"] Status(CurrentModifierKey),

it was just a shorthand/from memory sort of way to describe your script. But if that's the actual way your script looks, then you should change it to this:

If [status (CurrentModifierKeys) = 5]

Link to comment
Share on other sites

Fitch,

You hit my thick old head right on the mark.

I was putting a number where it reads "CurrentModifierKey" Duh!

I guess basic algebra skills don't cut it when writing a script. I'll have to get the Scriptology book I've seen referenced here.

Thanks for everyones help.

Link to comment
Share on other sites

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