• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Dumb Safari question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Dumb Safari question


  • Subject: Re: Dumb Safari question
  • From: deivy petrescu <email@hidden>
  • Date: Sat, 27 Sep 2008 19:31:53 -0400


On Sep 27, 2008, at 19:15, Mark J. Reed wrote:

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?


If you just created the window, x is 1. Actually creating a widow is the best way to go.
Downloads window I believe does not accept tabs.


For now I'm exploiting the fact that the new window created by "make
new document" winds up as the front window:

You can force that, make new window at front (x=1).


-- 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}

I do not thin that this line works. It did not for me. Create the tab and then set the URL, as suggested in my previous e-mail


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?


Can you elaborate on that? Thanks.


Mark J. Reed <email@hidden>


Deivy
_______________________________________________
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
  • Follow-Ups:
    • Re: Dumb Safari question
      • From: "Mark J. Reed" <email@hidden>
References: 
 >Dumb Safari question (From: "Mark J. Reed" <email@hidden>)
 >Re: Dumb Safari question (From: Michelle Steiner <email@hidden>)
 >Re: Dumb Safari question (From: "Mark J. Reed" <email@hidden>)
 >Re: Dumb Safari question (From: "Mark J. Reed" <email@hidden>)
 >Re: Dumb Safari question (From: Michelle Steiner <email@hidden>)
 >Re: Dumb Safari question (From: "Mark J. Reed" <email@hidden>)
 >Re: Dumb Safari question (From: deivy petrescu <email@hidden>)
 >Fwd: Dumb Safari question (From: "Mark J. Reed" <email@hidden>)

  • Prev by Date: Fwd: Dumb Safari question
  • Next by Date: Re: Dumb Safari question
  • Previous by thread: Fwd: Dumb Safari question
  • Next by thread: Re: Dumb Safari question
  • Index(es):
    • Date
    • Thread