Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Close document script that stops doc closing

Featured Replies

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

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

  • 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

Just posted something that doesn't work. I should have known better.

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

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

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.

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.

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

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.