Fwd: Dumb Safari question
Fwd: Dumb Safari question
- Subject: Fwd: Dumb Safari question
- From: "Mark J. Reed" <email@hidden>
- Date: Sat, 27 Sep 2008 19:15:19 -0400
Accidentally replied onlyto deivy...
---------- Forwarded message ----------
From: Mark J. Reed <email@hidden>
Date: Sat, Sep 27, 2008 at 7:14 PM
Subject: Re: Dumb Safari question
To: deivy petrescu <email@hidden>
On Sat, Sep 27, 2008 at 1:15 PM, deivy petrescu <email@hidden> wrote:
>
> On Sep 27, 2008, at 8:09, Mark J. Reed wrote:
> I'm looking for the X in
>>
>> tell X to make new tab
>>
>> which has to be a window object.
> Hi Mark.
>
> X is window.
as I said above. Check.
> Check tabs and you will see that tabs are contained by window.
> You can have window that have no documents associated with them.
> windows and documents are contained by the application, not by each other.
All of which is exactly my problem. I want to create tabs in the
specific window that I get when I ask it to create a new document.
The problem is, the return value of "make new document" doesn't seem
to be much help in getting at the window that it just created. (If I
could get "make new window" to work instead, I'd use that.)
> tell window x
Right - *what* do I put in place of that x?
For now I'm exploiting the fact that the new window created by "make
new document" winds up as the front window:
-- begin script
property username : missing value
property pass : missing value
if username is the missing value then
set username to text returned of (display dialog "Enter
del.icio.us username:" default answer "")
end if
if pass is the missing value then
set pass to text returned of (display dialog "Enter password:"
default answer "")
end if
set urlPrefix to "https://" & username & ":" & pass & "@api.del.icio.us/v1"
set tagsUrl to urlPrefix & "/tags/all"
set postsUrl to urlPrefix & "/posts/all?tag="
set tags to paragraphs of (do shell script "/usr/bin/curl --silent '"
& tagsUrl & "' | sed -ne 's/.*tag=\"\\([^\"]*\\)\".*/\\1/p' | sort
-f")
set theTag to choose from list tags with prompt "Select tag to open"
set urls to paragraphs of (do shell script "/usr/bin/curl --silent '"
& postsUrl & theTag & "' | sed -ne 's/^.*<post
href=\"\\([^\"]*\\)\".*$/\\1/p'")
tell application "Safari"
make new document
tell front window
repeat with i from 1 to count (urls)
set theUrl to item i of urls
if i = 1 then
set URL of tab 1 to theUrl
else
make new tab with properties {URL:theUrl}
end if
end repeat
end tell
end tell
--end script
Incidentally, since Script Editor doesn't seem to do the persistent
properties thing anymore, what's the best way to get those property
values to stick around?
--
Mark J. Reed <email@hidden>
--
Mark J. Reed <email@hidden>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden