MACSCRPT Archives

July 2007

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:
Brian Johnson <[log in to unmask]>
Reply To:
Macintosh Scripting Systems <[log in to unmask]>
Date:
Thu, 5 Jul 2007 20:01:26 -0700
Content-Type:
TEXT/PLAIN
Parts/Attachments:
TEXT/PLAIN (36 lines)
> From:    Bill Steele <[log in to unmask]>
> Subject: URL Access Scripting syntax
> 
> Every example I see goes like this:
> 
> set filepath to "disk:folder:filename"
> tell application "URL Access Scripting"
> 	activate
> 	download "http://blahdiblah.html" to filepath
> end tell
> 
> I think I've even done it that way, although I can't find an example
> in my library.

I began development of an app called "theArchivist" before OS-X, and then 
ported it from Dialog Director to Project Builder/XCode and Interface Builder. 
I vaguely remember occasional problems with UAS, but the current version (which 
I just rebuilt in XCode 2.0) still works great and the core URL Access 
reference is this ... (the long line'll prob'ly wrap)

 	tell application "URL Access Scripting"
 	   set x to download this_url to file (local_filepath) replacing yes without progress and unpacking
 	end tell

"local_filepath" is a text string giving the (HFS-style) path to which the 
file from "this_url" (a fully qualified URL as a text string) is to be 
stored. Also, the tell is inside a "with timeout ..." block, which is in a 
try that handles 404 failures, etc.

It is important that the local_path (all parts but the file) exists before you 
do this. Aside from that, UAS seems to work fine (for me, YMMV. UAS doesn't 
have a golden reputation -- as hinted by the other responses so far, but I 
found it before I found curl, so there you have it...)

   -Brian Johnson, Dept of Architecture, University of Washington, Seattle

ATOM RSS1 RSS2