Fisherman Posted April 4, 2002 Posted April 4, 2002 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.
Fitch Posted April 4, 2002 Posted April 4, 2002 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.
Fitch Posted April 5, 2002 Posted April 5, 2002 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.
Vaughan Posted April 5, 2002 Posted April 5, 2002 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!
Fisherman Posted April 5, 2002 Author Posted April 5, 2002 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 ]
Fisherman Posted April 6, 2002 Author Posted April 6, 2002 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.
andygaunt Posted April 6, 2002 Posted April 6, 2002 Hi, try this sample www.albion.co.uk/sample/opener script.zip hold down CTRL & SHIFT when openinig to halt script. HTH
Fitch Posted April 7, 2002 Posted April 7, 2002 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]
Fisherman Posted April 7, 2002 Author Posted April 7, 2002 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.
Recommended Posts
This topic is 8251 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 accountSign in
Already have an account? Sign in here.
Sign In Now