Jump to content
Salesforce and other SMB Solutions are coming soon. ×

Closing all windows except the parent


Therese
 Share

Recommended Posts

Hello all

 

I am 'attempting' to complete a script which will eventually open a New Window and tile the two (windows) vertically.

 

But first I need to ensure that there arent a number of windows opened (which are juxtaposed) Ie: filename - 2, filename - 3 etc.

 

So far I've attempted the following script '

 

Loop

Set Variable ($patTest; Value:PatternCount(Get(WindowName);"-")

If

($patTest ≥ "1" )

Close Window [Current File]

 

Exit Loop if ($patTest = "0")

End if

End If

End Loop

 

Of course if Fraught with errors. In particular, if the parent window is the current active window, the script simply Ends Loop and doens't look for any subsequent windows.

 

Anyone got any ideas.

 

Cheers

Link to comment
Share on other sites

Try this (untested):

 

#failsafe for loops during testing 
allow user abort [ on ]
#
set variable [ $ListOfOpenWindows ; WindowNames ( get ( filename ) ) ]
#
If [ valuecount ( $ListOfOpenWindows ) = 1 ]
 Halt script
End if
#
Loop
Exit loop if [ isempty ( $ListOfOpenWindows ) ]
Set variable [ $current ; getvalue ( $ListOfOpenWindows ;  1 ) ] 
Select window [ $current ]
#
If [ $current = "main"// your main window ]
 Move/resize window [ current window ; your settings here ]
Else if [ $current = "sub" // your sub window name ]
 Move/resize window [ current window ; your settings here ]
Else
 Close window [ current window ]
End if
#
Set variable [ $ListOfOpenWindows ; right ( $ListOfOpenWindows ; valuecount ( ListOfOpenWindows - 1 ) ]
End loop

Link to comment
Share on other sites

A more general approach could be to close all the windows, except one.

And that one will be the parent window.

 

Freeze Window

Loop

Exit Loop If[ ValueCount( Substitute ( WindowNames( GetFileName )) ; " " ; "_" )) = 1

Close Window [ Current Window ]

End Loop

Link to comment
Share on other sites

Thinking ahead, you might consider naming your open windows so you know which is which. This is practical if you want to preserve the state of particular windows when rearranging the windows over the computer screen.

Would require you to script window management fully, or make allowances in your window tiling script for user opened windows.

Choices depend on the user interface requirements (which we don't know).

Link to comment
Share on other sites

Thanks for your suggestions.

 

Yes kjoe, naming windows is certainly food for thought. I might have to disable the 'new window' command though a custom menu set will probably be the go.

Link to comment
Share on other sites

Thanks for your suggestions.

 

Yes kjoe, naming windows is certainly food for thought. I might have to disable the 'new window' command though a custom menu set will probably be the go.

Link to comment
Share on other sites

This thread is quite old. Please start a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share



×
×
  • Create New...

Important Information

Terms of Use