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

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

Recommended Posts

Posted

I have several scripts that open certain database tables in a new window for users. I name these windows "$TableName" & ":" & "$RecordName" for usability. Unfortunately, I have another script that relies on the fact that each window has a unique name, but this is obviously not the case. Is there any way I can get a unique ID or something for the window, rather than referring to it by its name?

 

I know there is a Get (WindowName), but is there something equivalent to what a Get(WindowID) function would do? Is there a way I can use Get (UUID) here?

 

Let me know if more information is required. Thanks.

Posted

There isn't a function like you're looking for. You could possibly name your window with a Get ( UUID ) function, perhaps on a second line after the table and record, but I don't know how that would work on Windows.

 

Do you ever need two windows with the same name or is that a fluke? Probably better would be to ensure that each window name is unique. When you script starts, have it check the list of open windows and close it or rename it if it's going to be the same name as the new one.

Posted

Creating windows with the same names is not a fluke; when a user opens the same table (say, "Table1") on the same record (say, "Record_0001") in a new window twice, I get two "Table1 : Record_0001" windows. I'd like to name the windows to describe the window content, so some might be the same.

 

My solution was to just tack on a Get(UUID) to the end of the name, so the name is unique, but still descriptive to the user. It's not the cleanest solution, but it works. I was just hoping I could somehow "hide" the ugly UUID from the user so it wouldn't become confusing. If that's not possible, that's okay.

 

I tried giving the window a List as a name, including the table and record name as one element, then the UUID as the second. Unfortunately, the UUID still shows up on the window title.

 

I am wondering, though, how filemaker itself differentiates windows with the same name? There must be some sort of unique window id somewhere.

Posted

"I am wondering, though, how filemaker itself differentiates windows with the same name? There must be some sort of unique window id somewhere."

 

What makes you think that? What operations does FileMaker perform that require it to identify a particular window?

Posted

Well, I guess it just seems odd that these unique objects do not have unique identifiers. But I guess it only cares about a window that is selected.

 

Interestingly, there is a Select Window[name] script command. When names are not unique, this script step just seems to select the topmost window with the matching name. So maybe Filemaker doesn't care about unique names at all? That just seems odd.

Posted

"I am wondering, though, how filemaker itself differentiates windows with the same name? There must be some sort of unique window id somewhere."

 

If a window "Contacts" is open already, then you open another window with the same name, FM will add a number identifier to the new window (i.e. "Contacts - 2").  I don't believe it's possible to have windows with exactly the same name open at the same time.

Posted

"I am wondering, though, how filemaker itself differentiates windows with the same name? There must be some sort of unique window id somewhere."

 

If a window "Contacts" is open already, then you open another window with the same name, FM will add a number identifier to the new window (i.e. "Contacts - 2").  I don't believe it's possible to have windows with exactly the same name open at the same time.

It is possible if you use a script to create new windows. There is a "New Window" script step that allows one to enter a name for the window. If plaintext or certain variables are used in the file name and the script is run more than once, you can have windows with the same name.

 

This must just be something that was overlooked, as it is not relevant in most contexts. Unfortunately, my problem requires unique window names. I did find a workaround, albeit a messy one.

Posted

Wouldn't it make more sense to check to see if that window already exists, and if it does, bring it to the front rather than open a second window of the same thing?  Unless there's a reason why someone would want two of those open.

 

You could do this with Select Window[Name] and Error Capture.  Set the error as a variable and then If [ get(LastError)] = 0 the window is already present.

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