• 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: What makes AppleScript easy
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: What makes AppleScript easy


  • Subject: Re: What makes AppleScript easy
  • From: Ed Stockly <email@hidden>
  • Date: Wed, 5 Dec 2007 23:48:37 -0800


>>cat flie_that_exists > file_that_doesn\'t_exist

>>>It works fine and simply creates the file. It has a name that you just gave it and doesn't complain that you didn't create it first. It's an example of why AppleScript is so hard for experienced programmers to understand.

Because it doesn't just create new files willy-nilly whenever you try to reference a file?

In appleScript to make a new file at some location you actually have to use a command like:

make new file at someLocation

Maybe that's difficult for programmers to grasp, but it sure makes sense to appleScripters.

One thing that may be causing confusion is that alias is not the native applescript file reference. Alias is an added convenience of the language that gives AppleScript more flexibility and function.

The fact that alias errors when an item doesn't exist gives a quick and easy test to determine if a file does exist. Plus the alias class uses the systems alias manager which means if one of those pesky users moves or renames a file it may not crash a script.


An 'alias', which implies (by its name) a reference to something else, must,
therefore, exist before you can call it an 'alias'.



>>>>The alias does not exist until the alias command crates it. That was around in the geek world before Apple or Macintosh existed. It is hard for experienced programmers to accept the redefinition when there is the long standing link concept. What's more, Apple has never released the real definition of an alias resource or a Finder alias file. It's magic that sometimes doesn't work, especially when cutting CD-ROM's. OS 7 introduced the File-ID which was assigned to a new file and never changed until a disk was reformatted. That was the basis for an alias but there is a lot more and Apple doesn't tell.


Gee, so I guess using the alias class isn't nearly as easy or convenient as I thought it was all these years.


>>>>Does that mean that a string like "Mac HD:Documents:sometinbgnew.txt" is NOT something that might exist in a few microseconds?


That exists only as a string.

You may add the term 'file' to the beginning and it becomes a file reference that can be used to read, write, create, delete, move or copy a file or a folder. And you can try to coerce it to an alias. If it doesn't reference an existing file, the coercion will fail. That is the nature of the appleScript alias. Virtually unchanged since system 7.

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
  • Prev by Date: Re: What makes AppleScript difficult
  • Next by Date: Re: What makes AppleScript difficult
  • Previous by thread: Re: AppleScript4programmers
  • Next by thread: Re: programmatically get path to iDisk
  • Index(es):
    • Date
    • Thread