October 31, 200223 yr I want to attach a script to run when a document is closed. Is there a way to format it in such a way that if a user either chooses close from the menu or just closes the window, the script will run, include a If statment to check something, and if the If statement is not met, the file will not close? LR
October 31, 200223 yr Hi: When you say document, do you mean FM file? If so, then go to Edit/Preferences/Document and find the section "when closing "file": and choose your script. I presume you already have the script made up. Ken
October 31, 200223 yr Author I know how to attach a "Closing" script in prefs. It is the script part I am wondering about. Basically, if a person closes the document, the script would include a If statement: "Amount"<1 What I am after is if I can add something so that if Amount is less than 1, the document will not close. LR
November 1, 200223 yr When you make a button that performs a close, you can prevent the closing of course with that if statement. As far as I know, when you close the window, there is no way back. Just thinking aloud, never tried it, but it might be possible to use the close-down script to open an other file, and in the start-up script of that script open the main file again.. I may talk nonsense, then forgive me. If not, thank me.. Harryk
November 1, 200223 yr Yea, that's a problem. Once the window is closed, there is nothing a script can do to stop it. Not even an open script step. Ken
November 1, 200223 yr I understand what it is you're trying to achieve. I believe the best way to go is to provide your own 'exit' buttons which run through the tests and alerts before they make the call to quit/exit/close. For a more seamless and professional solution to this, you would want to think about MenuContol or SecureFM plug-ins to steer users more comprehensively towards the scripts you provide rather than the default FM options and commands. But when all is said and done, you must still provide users with a means to force exit. Giving them an option to have the file remain open is fine, but forcing it is not, because you can't predict all circumstances (eg someone may have to shut down in a hurry for a thousand and one reasons) and the last thing you want to force anyone to do is a ctrl-alt-delete or reach for the power button! If you're taking the more gentle approach, then techniques to steer users towards your own 'exit' buttons should suffice for most cases.
November 1, 200223 yr I agree. I *hate* Dreamweaver 4. Clicking on the window close box closes the current document but opens a new blank one. You have to choose exit fromthe File menu to quit. Macromedia must assume that no person in their right mind would ever want to stop using DW, so they ensure you cannot ever get out of it easily. With my solutions I set them up so that closing one file closes all the other related files, and opening one file opens them all.
November 5, 200223 yr In our experience, you should try and avoid having actions performed on closing w/o disabling the upper-right-corner-X. We had a client whose program was not issuing the correct reports because we'd configured several actions to occur on exit, but these were not triggered by the X, which is how the client was quitting the App (DESPITE TELLING US SHE WAS GOING TO FILE > EXIT... ARRRG USERS!). SO. I echo Ray, here: check out the plugins available, or set up your data entry to perform the checks you want on field-exit/data-submission.
Create an account or sign in to comment