Closing Safari windows using its unique identifier.

I’m trying to close some Safari windows using its id.
None of next works
(assume that there is a window whose id is 5000)

close window id 5000
close window whose id is 5000

Thanks

Model: PowerBook G4 1,33
AppleScript: Versión 2.1.1 (81)
Browser: Safari 417.8
Operating System: Mac OS X (10.4)

Only one post will do. :expressionless:

Hi, sygn.

Your first example does work, provided you ‘tell’ Safari to do it.

tell application "Safari"
	close window id 5000
end tell

Presumably you’ll have used some code in a ‘tell’ block to find out the window’s id in the first place?

Hi, Nigel

I knew that I have to “tell” Safari to make things. Thanks.
The problem was of another kind: the addition 24U Appearance OSAX.osax conflicts with “close window id nnnn”. I’ve removed from its natural location (~/users/me/library/scripting additions") and, voila!!. Now it is working.

The Murphy fact its that I’ve discovered the problem AFTER reinstall the whole Mac OS X, updates, restore preferences, mails, etc. etc !!! :frowning:

Alway the same !!! JAJA.

Hi, sygn.

I’m glad you were able to fix your problem. Thanks for the feedback. Fortunately, terminology conflicts with OSAXen aren’t as common as they once were. I don’t have the 24U Appearance OSAX so I can’t test this, but if ‘close window id’ is all one 24U keyword, you might be able to proof your script against it by breaking it up with parentheses:

tell application "Safari"
	close (window id nnnn)
end tell

Bummer. If it’s any consolation, that’s one of the most effective ways to learn. :wink:

Quite. Why is it that we’re more likely to remember the things we’d rather forget? :lol:

(That’s rhetorical. Obviously.) :wink: