Bring Window to Front

Ok… my apologies in advance for what must be a stupid question. Trust me, whenever I submit those… “oh please help me” posts it is after spending hours looking in my soon-to-be-burned copy of “Applescript: a comprehensive guide…” this forum and googling. I really don’t like looking dumb… but its inevitable at this point.

Here goes:

How does one select a particular window. I’ve got:

tell application "BBEdit"
	activate
	select text window "ilikedogs.html"
	--do something nice
	select text window "ilikecats.html"
	--do something else nice
end tell

I have also tried "select text window with properties {name:“ilikedogs.html”} but don’t get anywhere with that either.

You see I want to refer to the window by name to eliminate any possiblity of confusing the windows with window 1 or window 2. I won’t know how many windows are going to be open or what number they will be.

Thanks guys

Try this:

tell application "BBEdit"
	activate
	set index of window "ilikedogs.html" to 1
	--do something nice
	set index of window "ilikecats.html" to 1
	--do something else nice
end tell

Yes Sir. That seems to bring the file to the fore.

Thanks!

I’m trying to do a similar thing with Microsoft Entourage. I want to be able to bring a specific window to the front. For example, I have a Calendar window open. However, the actual window title is “Calendar * Main Identity”. The only problem is that the asterisk between the word “Calendar” and “Main Identity” is actually a bullet of some sort, so I am getting an error when I run the following script:

tell application "Microsoft Entourage"
	activate
	set index of window "Calendar * Main Identity" to 1
	--do something nice
end tell

Is there a way to bring a window that contains the text “Calendar” to the front. That way I could do away with everything that follows. Thanks.

Unfortunately, that doesn’t work. :frowning:

Anyone else have an idea?

– or --select (first window whose name starts with “Calendar”) – this work here
– or --select (first window whose name contains “Calendar”) --this work here

These methods also work for me using v. 2004

You’re right! This works for me, too. Somehow I missed the code that was commented out. Thanks.