Re: getting a file by URL ?
Re: getting a file by URL ?
> the point is that it is not clear what a "URL" is on the Mac or for AppleScript, if it isn't defined someplace – and I didn't find it.
> And since at least Safari, Mozilla, Opera and TextWrangler are scriptable, there may arise some confusion.
> It seems, that the Opera and IE version doesn't always work (without System Events):
Look in the Standard Additions dictionary:
url
URL (noun)A Uniform Resource Locator or Uniform Resource ID (URI) (defined in StandardAdditions.osax)
properties
Property Access Type Description
host get Internet address the host specified by this URL
name get unicode text a name given to this URL, usually the name of the page it refers to
password get unicode text the password by which to access this URL
path get unicode text the location of the target on the host
properties get/set record property that allows getting and setting of multiple properties
scheme get esch the access scheme
user name get unicode text the user name by which to access this URL
where used
The URL class is used in the following ways:
result of choose URL command
URL property of the web page class/record
Under 'scheme' you may notice the following:
esch (enumeration)(defined in StandardAdditions.osax)
afp URL
AppleTalk URL
directory server URL
file URL (obsolete)
ftp URL
gopher URL
http URL
launch URL
mail server URL
mail URL
mailbox access URL
mailbox URL
message URL
multi URL
network file system URL
news URL
nntp URL
remote application URL
secure http URL
secure news URL
streaming multimedia URL
telnet URL
unknown URL ????
That said, it might help if you were to offer the big picture of what you're trying to do.
If we knew where these URLs were coming from, how they were being generated and how you intend to handle them in your script, we may be able to point you in the right direction.
I've got a feeling you may be approaching this from the wrong direction.
> There actually seems to be a difference between the implementation of POSIX in "System Events" and "StandardAdditons" respectively, which is something Apple could have avoided (as with files being different things in System Events and Finder).
AppleScript has been around since system 7 on the mac and has been incrementally updated over the years. The scripting implementation of the elements that you mention evolved at different time and with a different purpose. It's pretty remarkable that scripts written for System 7-9x still run on Snow Leopard, but that's one reason they aren't totally consistent.
There's a reason things are different in System Events than in Finder. Finder is the heart of the Mac GUI and integral to the operating system. Apple is reluctant to make big changes to it's operation in order to facilitate scripting. System Events is the solution. It's purpose is to facilitate scripting without the overhead of the Finder.
>>> set myFile to POSIX file "file:///Users/Thomas/Desktop/Test.txt"
>>> log "myFile: " & myFile
>>> --> (*myFile: Macintosh HD:Users:Thomas:Desktop:Test.txt*)
>>> get POSIX path of myFile
>>> How can myFile in the last line have the value "file:///localhost/Users/Thomas/Desktop/Test.txt"?
>>
>> It doesn't.
>
> I claim it does, as this is what the Apple Event tells me:
>
> 'core'\'getd'{'----':obj '{ 'form':'prop','want':'prop', 'seld':'posx', 'from':'furl'("file:///localhost/Users/Thomas/Desktop/Test.txt") }, &'csig':'65536 }
What you're looking at is not the value of the variable but how the stored data is represented internally. This my be adding to the confusion.
HTH,
ES
_______________________________________________
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