Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Safari 3 beta, tab object and AppleScript



At 4:55 PM -0400 6/12/07, Jim DeVona wrote:
>On 6/12/07, Bill Briggs <email@hidden> wrote:
>
>>Well, I see that they added tabs to the object model for Safari, but so far I can't seem to get any syntax to work to make a new tab in an existing window. Anyone else try this yet?
>
>I had noticed that there appeared to be improved scripting support for
>tabs in the Safari 3 beta, but I hadn't tried to create a new tab
>until I read your message. I find I am unable to do so as well. Here
>is a simple test case, to be run when a browser window with a single
>tab is already open:
>
>tell application "Safari"
>tell window 1
> make new tab
>end tell
>end tell
>
>The "make new tab" line generates the following error message: "Safari
>got an error: NSInternalScriptError"
>
>Is this a usage error on my behalf, or is this indeed a bug?

 I got the same thing. Tried all manner of variations on the syntax (make new tab at end of tabs; make new tab at beginning of tabs; etc.). Looks like a bug to me.

 And this is interesting, with a normal window (no visible tabs), one gets

tell application "Safari"
	tell window 1
		set et0 to (exists tab 0)
		set et1 to (exists tab 1)
		set et2 to (exists tab 2)
	end tell
end tell
{et0, et1, et2}
--> {true, true, false}

But if I get the properties of window 1 there are two interesting items in the returned record:

current tab:tab 2 of window id 17411 of application "Safari", index:1

So according to the script there is no tab 2 in existence, but the properties record indicates that the current tab is 2, but yet it's index is 1. I don't have an issue with the fact that there may be a hidden 0th tab in the window object, but I can't make the numbers work in any way that rationalize the above results.

Maybe someone with a bigger brain can clear it up. Or maybe it's a bug. I thought last evenings gin and tonic had worn off by now, but this just isn't making any sense to me.

 - web
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/applescript-users/email@hidden
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

References: 
 >Remove iTune album ? (From: "Rohit Makasana" <email@hidden>)
 >Re: Safari 3 beta, tab object and AppleScript (From: "Jim DeVona" <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.