Changing window title

Everywhere in this Forum that I have looked, the following appears right:

set title of window theWindow to theFileName

but it produces a dialog reading "cannot set window ‘IB Title here’ to 'theFileName.

Both theWindow and theFileName are strings, with theWindow the title of this window in IB.

???

Hi John,

theWindow must be the name of the window, which is specified in the AppleScript tab of the Inspector

Stefan

The title and the name via IB are identical.

What’s curious is the error message “cannot set window ‘IB Title here’ to ‘theFileName’” … but shouldn’t it say “cannot set title of window ‘IB Title here’ to ‘theFileName’”

Is the line within an other tell block, which changes the reference?

Thanks, bunches, Stefan … about your tell block insight

I found out that when you change the title of a window, (window object)window origTitle becomes (window object)window newTitle.

My version of the StudioReference.pdf shows no property name of a window object, only a property title of a window object. Somehow, this doesn’t seem right, because the window object should be window itsName, not window itsTitle. It just seems that the window’s title should be fluid and the window’s name fixed via IB, like the window id.

Anyway, this just does not sit right … any more insight on this issue?

the name (reference in scripts) of a window is not identical with the title of the window.

The title is specified in the Window Atributes tab of the Inspector in IB
The name is specified in the AppleScript tab of the Inspector in IB

The reference in the script (e.g. tell window “main”) is always the name of the window

Every window contains the property name and the property title, although it’s not described (explicitly) in the documentation

AppleScript Studio Terminology Reference:

Thanks Stefan and Bruce …

open(close) window windowName, not windowTitle, solved many problems I was having.

This opened alot of doors to have multiple windows. In my case, no matter how many windows I open, my window name never changes, but the window title and its associated file name do and are both equal to the name of the file I open, e.g., an Excel spreadsheet.

If the name of the window object in IB is “untitled” and if I change this name, apparently the name in the app’s resources changes, so if I try to open a new window “untitled”, it’s no longer there because it’s been re-named. So the only parms I change are the window’s title and its associated file name. This approach works beautifully.

Thanks again.