Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

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

Recommended Posts

Posted

I need a script that will allow me to close all active or visible windows EXCEPT the one that contains LAYOUT "XXX". The isssue is the script may be started from that layour or another (depending on usage at the time).

If is starts on ano other layout that "xxx" no problem. But, in I am on Layout "xxx," how can a select "any other window" in order to close it???

Any thoughts woule be apprecieted.

Posted

Welcome to the forum, Holcomb.jim.

It would be helpful to have more details. I will tell you that designing a multi-window FM solution does require quite a bit more work for the developer. Scripts in menus do not have a context--and so as a developer you are required to obtain the proper context for the user before the script executes. Also, two windows of the same record can result in a record lock situation.

So, your script must have the user be on Layout XXX (that context) before it is run? You intend to close all other windows on the user when they select this script? Isn't that a bit annoying to the user?

To answer your immediate question, here's a demo that closes any "extra" windows, except the one titled, "Keep Open." There's a utility script to create extra windows.

KeepOpen.fp7.zip

Posted

One way might be to change the script so that when it runs it puts the name of the current window into a global variable. This global can be accessed later so that all windows except that window get closed.

I'd be interested in knowing why this needs to be done.

Posted

I am trying to create a script that will do this:

If current window contains layout “Scr.1”

Go to next open window

Close window

Loop until all but window containing are closed, except window containing “Scr.1”

Else

Close window

Go to next open window

EndIf

Posted

Couldn't you just use the Get(LayoutName) function?

Cycle through all windows, as you described above; in each window, If (Get(LayoutName) ≠ "Scr.1") then close window.

On the other hand if two or more windows have the same layout in it, this will keep them all open. What do you want to happen in that case?

Posted

Perhaps you need to title all your windows so that you can directly manage them?

Seriously, why are you even delving into a multi-window solution?

Posted

The problem is the script can go to a window and do nothing if contains Layout "Scr.1". That's no problem. But, how do I get it to seek and find any other windows and close them?

The answer seems to be to just have it go from window to window-right and ask the question: is this "Sct.1"? Simply put, how do you get from window to window?

-Jim H

Posted

I have an account file and want one window for current balances of all accounts and another window for editing and so on. That would be fine, except that when reports are run it could be in either window. Thus, to RESET things, I want to heve the current balances & editing back open (just opening a layout changes the found set and I don't want to do that)??

Posted

There are a couple of solutions to your problem.

The simplest is to only allow the scripts to be run from buttons on the appropriate layouts. This will require disabling them in the script menu, which is as simple as unchecking them in ScriptMaker.

The advanced method is to create custom menus for each layout that controls what commands and scripts people can activate.

Posted (edited)

Is there any way in a script to say "go to the next open window?" -Jim H

No, not directly.

The Select Window script step requires that you provide a specific window name (other than the "Current Window" option).

If you want to methodically go through all of your open windows, you need to figure out how to lock down the user interface to keep control over window creation and window naming so that you can keep an list of all of your window names.

You can then use this list to cycle through all of the names in a script.

If you want to go outside of FileMaker, this type of window selection could be done using a custom written plug-in or calling some external code such as AppleScript on the Mac or whatever makes sense under Windows.

Edited by Guest
Posted

That works. I will use an If with a loop statement to ask if the current window is "Scr.1"

If yes, run

Select Window [Name:GetValue(WindowNames;2)]

In no

Close window

Much thanks....

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