• 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's in a standard library? [Re: Forward movement vs Tilting at windmills]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: what's in a standard library? [Re: Forward movement vs Tilting at windmills]


  • Subject: Re: what's in a standard library? [Re: Forward movement vs Tilting at windmills]
  • From: "Stockly, Ed" <email@hidden>
  • Date: Mon, 28 Nov 2016 21:51:56 +0000
  • Thread-topic: what's in a standard library? [Re: Forward movement vs Tilting at windmills]

My thinking is that if something is to be distributed by Apple as an appleScript, then it should be written as an easily read and editable appleScript or should be locked. That's how Shane distributes his libraries, and others I've seen. (Of course the source scripts could be made available too.)

My thinking is also that if apple were to distribute a "Standard Library" it would be a collection of well-written AppleScripts that are easily understood and edited and serve as an example for novice to experienced appleScripters of good AppleScripting, and how to build their own libraries.

I certainly don't see Apple distributing Has' libraries as a standard library.  Aside from the fact that he has repeatedly and gratuitously insulted the intelligence of everyone at Apple would who's green light would be needed, right or wrong this collection is not appropriate as a standard.

Much of the commands in the libraries duplicate what's already in Scripting Additions; system events; the Finder; etc. (Maybe slightly better, maybe slightly differently, maybe the differences aren't significant)

Some of them seem geared toward a specific purposes and not really appropriate for general use (nothing wrong with that, but probably not appropriate for a standard library). 

If you like these libraries and find them useful, then by all means use them.

I might do the same (along with other libraries). Although I have workarounds that I've written myself over the years for a lot of these, once I get comfortable with a reliable way to install libraries on whatever client machines may be running them, I may use some of them.  

Ed



From: RJay Hansen <email@hidden>
Date: Monday, November 28, 2016 at 12:38 PM
To: has <email@hidden>, Los Angeles Times Los Angeles Times <email@hidden>
Cc: AppleScript Digest <email@hidden>
Subject: Re: what's in a standard library? [Re: Forward movement vs Tilting at windmills]

Ed, 

You definitely shouldn’t let the readability of these libraries keep you from using them. As Hamish points out, the libraries each have an SDEF so you can view how to use them via Show Dictionary. They have better usage examples than most AppleScript Dictionaries provide in my experience. 

I just got around to downloading them and installing them last week and have already found a use for one of them. Specifically the Lists library provides an easy way to delete items from a list. I never opened the library to see what was written in there. I just viewed its dictionary which told me:

To delete a range of items from the list, use the from item and/or to item parameters:

delete from list {1, 2, 3, 4, 5} from item 2 to item 4 → {1, 5}

delete from list {1, 2, 3, 4, 5} to item 3 → {4, 5}

I did have to play with it just a bit to get it to work. As in:

set myList to {1, 2, 3, 4, 5, 6}

set myList to delete from list myList to item 3

myList —> {4, 5, 6}

Seriously, if I can figure out how to use them it should be no problem for you to. 

RJay


On Nov 23, 2016, at 5:03 PM, has <email@hidden> wrote:

On 23/11/2016 19:58, Stockly, Ed wrote:

It seems you wish to replace AppleScript with something different that's more suited to programmers and developers without regard to language.


SwiftAutomation is NOT an AppleScript replacement. It is an AppleScript ALTERNATIVE, marketed specifically to a major, highly influential audience—programmers—that AppleScript 1. does not and _cannot_ serve (as 25 years of programmer hatred of the language has proven), and 2. cannot survive without (cos who d'you think writes all the scriptable apps that make AS useful to you?).

SwiftAutomation has one goal: To make *automating Mac applications* easy and attractive to programmers. They will _still_ hate AppleScript, but that doesn't matter, because they will LOVE scriptable apps, and they will both use them and create them, which benefits BOTH THEM AND YOU.

Please tell me if that explanation is clear to you or not? If not, which part? Teach me, so I can do a better job of communicating to everyone in future, and I will be immensely grateful to you (and no doubt everyone else too!).

...

I've seen these before, and I wouldn't want them on my  system, and if Apple ever decided to offer a standard library it
wouldn't be this.It seems you've disregarded the English-like syntax in Scripts that AppleScript has used from the start, and that has always been a selling point.

Eh, are you sure you're looking at the right libraries? The libraries I've linked all use SDEFs to provide human-readable command syntax and allow you to import library commands globally using AppleScript's `use script "NAME"` statement. Examples:


  uppercase text "foø bår" → "FOØ BÅR"


  split text "Bob,Joe,Mary,Sue" at "," → {"Bob", "Joe", "Mary", "Sue"}


  format date (date "Thursday, 7 January 2016 at 01:41:34") ¬

       using {medium date format, medium time format} ¬

       for locale "fr_FR" time zone "Africa/Addis_Ababa"

  → "7 janv. 2016 à 04:41:34"


  sort list {2, 7, 4, 1, 9, 4} → {1, 2, 4, 4, 7, 9}

  split path "/Users/jsmith/Documents/ReadMe.txt" at file extension
  → {"/Users/jsmith/Documents/ReadMe", "txt"}


Occasionally it's not flawless English, e.g.:

  split path (POSIX file "/Users/jsmith/Documents/ReadMe.txt") at all components
  → {"/", "Users", "jsmith", "Documents", "ReadMe.txt"}

would read better as:

  split path (POSIX file "/Users/jsmith/Documents/ReadMe.txt") at each component
  → {"/", "Users", "jsmith", "Documents", "ReadMe.txt"}


or it has to fall back to traditional user-defined identifiers when it reaches the limits of what library SDEFs can do, e.g.

  set obj to dictionary collection

  -- add some key-value pairs
  obj's addItem("red", {255, 0, 0})
  obj's addItem("yellow", {255, 255, 0})
  obj's addItem("green", {0, 255, 0})
  obj's addItem("blue", {0, 0, 255})

  -- get the value that is currently stored under the key "green"
  log obj's getItem("green") --> {0, 255, 0}

or the order of the parameters makes the diction a little odd, e.g.:

  delete from list {1, 2, 3, 4, 5} item 1→ {2, 3, 4, 5}

rather than:

  delete item 1 from list {1, 2, 3, 4, 5}


but you actually sit down and design half a dozen dictionaries that can be imported globally into an AppleScript without serious risk of conflicting either with each other, or with all the other AppleScript-, application-, and osax-defined keyworks also imported into that script, and then you get back to me and tell me why I had to do it one way and not the other. Hell, I'm the guy who pointed out how many potential keyword conflicts and other problems library SDEFs would caused, and even I got schooled when they caused several more problems on top that not even I knew existed—and I've been studying AS dictionaries, learning precisely how they work, and what their benefits and flaws are for more than a decade.

So show me a better set of standard libraries that YOU propose for inclusion in 10.13, over even just make helpful patches to the ones we've got, or shut-up. 'Cos you've had three damn years to step up and do the job right, to help both yourself and your community, and you've not done squat—'cept moan when someone else does.

Frankly, I think someone's ego's feeling a little upset that his spot at the top of the hill is not perfectly secure. Don't you worry, I have no interest in usurping your king-hood; I have other goals. I am, however, trying to save your damned hill from iOS-led extinction the best way I know how, so if you've any better ideas on how to keep Apple from quietly dumping it completely a few years from now, I'm sure everyone here is all hears—certainly me most of all.


has

_______________________________________________
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

 _______________________________________________
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: what's in a standard library? [Re: Forward movement vs Tilting at windmills]
      • From: Stan Cleveland <email@hidden>
References: 
 >what's in a standard library? [Re: Forward movement vs Tilting at windmills] (From: has <email@hidden>)
 >Re: what's in a standard library? [Re: Forward movement vs Tilting at windmills] (From: "Stockly, Ed" <email@hidden>)
 >Re: what's in a standard library? [Re: Forward movement vs Tilting at windmills] (From: has <email@hidden>)
 >Re: what's in a standard library? [Re: Forward movement vs Tilting at windmills] (From: RJay Hansen <email@hidden>)

  • Prev by Date: Re: what's in a standard library? [Re: Forward movement vs Tilting at windmills]
  • Next by Date: Re: what's in a standard library? [Re: Forward movement vs Tilting at windmills]
  • Previous by thread: Re: what's in a standard library? [Re: Forward movement vs Tilting at windmills]
  • Next by thread: Re: what's in a standard library? [Re: Forward movement vs Tilting at windmills]
  • Index(es):
    • Date
    • Thread