Jim Holcomb Posted December 5, 2009 Posted December 5, 2009 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.
bcooney Posted December 6, 2009 Posted December 6, 2009 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
Vaughan Posted December 6, 2009 Posted December 6, 2009 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.
Jim Holcomb Posted December 6, 2009 Author Posted December 6, 2009 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
Jim Holcomb Posted December 6, 2009 Author Posted December 6, 2009 I can use the SELECT WINDOW but I can't seem to find a way to tell it to select ANY WINDOW EXCEPT "Scr.1"??
mweiss Posted December 6, 2009 Posted December 6, 2009 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?
bcooney Posted December 6, 2009 Posted December 6, 2009 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?
Jim Holcomb Posted December 7, 2009 Author Posted December 7, 2009 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
Jim Holcomb Posted December 7, 2009 Author Posted December 7, 2009 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)??
Vaughan Posted December 7, 2009 Posted December 7, 2009 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.
Jim Holcomb Posted December 7, 2009 Author Posted December 7, 2009 Is there any way in a script to say "go to the next open window?" -Jim H
TheTominator Posted December 7, 2009 Posted December 7, 2009 (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 December 7, 2009 by Guest
comment Posted December 7, 2009 Posted December 7, 2009 Is there any way in a script to say "go to the next open window?" Select Window [ Name: GetValue ( WindowNames ; 2 ) ]
Jim Holcomb Posted December 8, 2009 Author Posted December 8, 2009 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....
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now