Jump to content
Server Maintenance This Week. ×

Prevent a script from running in the wrong window


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

Recommended Posts

I have just discovered that with FM 8.5, if you are running a script in a window and you click on a different FM window the script starts running in the other window.

Can some one help me to solve this behaviour?

Edited by Guest
Link to comment
Share on other sites

Any script that lasts some time to finish. Imagine any loop stablishing a field in a table with 2000 records. If you have two windows open, if you are running the script in the first window and accidentally do a click in the second window, the script will start running in the second window.

Freze window

loop

set field X

go to next record

end loop

Refresh window.

Link to comment
Share on other sites

  • 3 weeks later...

Set Variable[ $window ; Get ( WindowName ) ]

Freeze window

loop

set field X

go to next record; exit after last

If[ Get(WindowName) <> $window ]

Select Window[ Name: $window ; CurrentFile]

If[ Get(LastError) <> 0 ]

Show Custom Dialog[ Error ; Window Closed ]

Exit Script[Window closed]'

End If

End If

End If

end loop

Refresh window.

Link to comment
Share on other sites

Thaks for your answer Genks!

That will help but wont ensure you do things in the proper window. You can have two windows with the same name and same fileds, so you wont get any error as far as know.

This wont happen with FM 7 and you dont need to control that error. In my opinion this behaviour is useless and or badly implemented (¿a bug?) ¡How can cause an error just a user clicking in the wrong window?!!

I am a little bit depressed with this issue as I wont be able to move my solution to fm8.5 until I add this error check to every process.

Can someone show me any practical use for this behaviour or something to forbid the user to go to another window while a script is running?

Link to comment
Share on other sites

Fortes:

A bit tricky; FreezeWindow[] doesn't seem to work as well as it used to in the .fp5 days. Best bet would be to implement the kind of check Genx suggested, along with a strict policy of window naming - or even NOT window naming, as FileMaker will append a number when a duplicate window is opened, unless you've specified a name.

You could also (when running a long loop like that) hide other windows and move to a layout showing a message like "Operation in Progress, Do Not Disturb" for the duration of the loop. Once the loop is done, you could return the hidden windows to the user.

Other than that, I'm not sure what can be done.

-Stanley

Link to comment
Share on other sites

Thanks for your suggestions.

I really appreciate your ideas.

Anyway, it looks that this will cost me a lot of hours reviewing my code.

This effort would be worthy just if I could see any benefit on this new behaviour.

Is there any chance that this can be fixed in any new update???

Link to comment
Share on other sites

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