Jump to content

Get names of rearmost windows?


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

Recommended Posts

Not sure this is the right forum for this question, but since the answer may require Scriptmaker, here goes.

Let's say there are 4 windows open simultaneously in my solution. How can I get the names of the 3rd and 4th windows (where the 1st window is the frontmost and the 4th window is the one behind all the others?)

Hope that makes sense. Many thanks--

Link to comment
Share on other sites

You can identify all the window names using WindowNames, and you can identify the front-most window name using Get(WindowName), but there's not a built-in function to identify open windows by their level.

Link to comment
Share on other sites

The WindowNames function returns the names of open windows, from frontmost stacking order to rearmost, followed by the names of hidden windows. You can use the GetValue() function to parse the output of the WindowNames function into each window name. For example:


GetValue ( WindowNames; 3 ) & ¶ &

GetValue ( WindowNames; 4 )



will return the third and fourth window names, assuming there are that many windows open. If you want the last two in the list you would use:



GetValue ( WindowNames; ValueCount ( WindowNames ) ) & ¶ &

GetValue ( WindowNames; ValueCount ( WindowNames ) - 1 )

I'm not aware of any function that will distinguish between visible windows and hidden windows so the above may return the names of open, but hidden, windows.

Link to comment
Share on other sites

Hi Corn,

Please adjust your skill level to Expert, or Certified (which ever is applicable), because you my fried, are no Novice.

Nice to have you participating on the Forum, the Forum will be even better because of it.

Lee

Link to comment
Share on other sites

Many thanks for your responses, everyone. I want to take this a step further now: I want to use a global calc field to get a listing of all open or hidden windows whose WindowName contains the word "fee". How might I accomplish this?

Link to comment
Share on other sites

Hi

no global calculation can give an accurate list of window names...the calc must be unstored.

A way to obtain what you want is to have two calc fields , both with unstored result:

1) wn = calc field with calc:

WindowNames

2) result = repeating calc field with calc:

Let(

value = GetValue ( Extend ( wn ) ; Get ( CalculationRepetitionNumber ) );

Case(

PatternCount ( value ; "fee" ) ; value ;

""

)

)

Link to comment
Share on other sites

Thanks for your reply. I should mention that the word 'fee' is only a portion of the WindowName. The actual wn might be something like 'Fee | pl.5510'

So is it possible to change this line...

PatternCount ( value ; "fee" ) ; value ;

...to something like this:

PatternCount ( value ; contains the word 'fee' ) ; value ;

Obviously the syntax is wrong because I don't know how to do it correctly.

I should also mention that if my goal can be accomplished using scripts instead of calc fields, that would be fine too.

Thanks again, everyone, for your suggestions. Greatly appreciated.

Link to comment
Share on other sites

Ah - - I found a small error in my formula. You are correct, it works!

Now, because it's a repeating field, in repetitions one through five I'm seeing

Is there any way I can display the data from the repeating calc field on a layout without the blank repetitions showing?

Link to comment
Share on other sites

I should also mention that if my goal can be accomplished using scripts instead of calc fields, that would be fine too.

If you want to set a field ( YourEvenGlobalField ) with a script:

Set field [ YourEvenGlobalField ; "" ]

Set Variable [$count ; value: 1]

Loop

Set Variable [$value ; value: GetValue ( WindowNames ; $count ) ]

If [ PatternCount ( $value ; "fee" ) ]

Set field [ YourEvenGlobalField ; If ( not IsEmpty ( YourEvenGlobalField ) ; YourEvenGlobalField & ¶ & $value ; $value ) ]

End If

Set Variable [ $count ; value: $count + 1 ]

Exit Loop If [ $count > ValueCount ( WindowNames ) ]

End Loop

Link to comment
Share on other sites

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