MACSCRPT Archives

November 2006

MACSCRPT@LISTSERV.DARTMOUTH.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Bill Steele <[log in to unmask]>
Reply To:
Macintosh Scripting Systems <[log in to unmask]>
Date:
Mon, 13 Nov 2006 10:35:42 -0500
Content-Type:
text/plain
Parts/Attachments:
text/plain (58 lines)
>I'm trying to write an Applescript as glue for soem HyperTalk scripting. I
>run OS 9 on this computer for specific reasons. I'm trying to find the
>equivelant of
>
>tell application "Internet Explorer"
>         (GetWindowInfo -1)
>         display dialog item 1 of result
>end tell
>
>
>to work for Netscape/Mozilla. The above script always returns the URL of the
>topmost IE window, but the best I can do with Netscape is
>
>tell application "Netscape"
>     display dialog URL of front window as string
>end tell
>
>The problem is, it isn't necessarily the front window! Why? If I have 5
>windows open it may or may not return the URL of the active window (instead
>giving the URL of an open but inactive window. I've studied the Dictionary
>for Netscape but I don't fully understand the syntax of Applescript.
>
>Can anyone help? I'm sure it's simple.

Don't have Netscape, but in Mozilla...

If what you want is always the frontmost window, it's window 1

tell application "Mozilla"
	tell window 1
		set winStuff to properties
	end tell
end tell
set winStuff to winStuff as list
set theURL to item 3 of winStuff


Otherwise:

tell application "Mozilla"
	repeat with i from 1 to (count of windows)
		set oneWin to name of window i
		if oneWin contains "What you're looking for" then
			set winStuff to properties of window i
			set winStuff to winStuff as list
			set theURL to item 3 of winStuff
			exit repeat
		end if
	end repeat
end tell

  "URL of window i" doesn't work for me in Mozilla.  The Mozilla 
dictionary supplies no classes.
-- 

Bill Steele
[log in to unmask]

ATOM RSS1 RSS2