• 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 difficult
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: What makes AppleScript difficult


  • Subject: Re: What makes AppleScript difficult
  • From: Skeeve <email@hidden>
  • Date: Wed, 05 Dec 2007 08:45:16 +0100

Things that I stumbled across and which were (and often still are) an hindrance
for me when using AppleScript.


1) file vs. alias vs. something that should be a file but isn't existing yet
For example: I return a POSIX path from a do shell script.
Converting this to something usable by AppleScript isn't just a
POSIX file the_filename
but
(POSIX file the_filename) as alias
What made it more complex was, that I wanted to use it in a display dialog, so I had
display dialog POSIX file the_filename
and the message was that it couldn't be converted to a string. I needed some time figuring it out.


I still don't know how to conveniently handle filenames of files that don't yet exist

2) Things that work in the GUI but can't be done from Apple'Script (application is to blame)
Example (posted here a few days ago but no answer yet). If you have dead tracks in iTunes (those were files are missing), you can select them and create a playlist of them. Quite handy if you want to check them later.
AppleScript can quite easily find dead tracks (location is missing value) but no way to add them to a playlist! add doesn't work because we have no location and even had we, there is no file so iTunes complains. duplicate doesn't work either as long as there is no file. make new playlist with tracks directly given seems impossible too.


3) Things a Programmer thinks are identical aren't
tell application "Script Editor"
  set ars to a reference to attribute runs of document 1
  repeat with ar in ars
     set x to color 1 of ar
     return item 1 of x -- works
  end repeat
end tell

tell application "Script Editor"
  set ars to a reference to attribute runs of document 1
  repeat with ar in ars
     return item 1 of (color 1 of ar) -- doesn't work
  end repeat
end tell

and these are just 3 out of numerouse hindrances I always stumble across...
_______________________________________________
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 makes AppleScript difficult
      • From: "Gary (Lists)" <email@hidden>
References: 
 >What makes AppleScript difficult (From: Richard Doust <email@hidden>)

  • Prev by Date: Re: Wow, AppleScript is tough!
  • Next by Date: Is shorter better? (Was: Wow, AppleScript is tough!)
  • Previous by thread: Re: What makes AppleScript difficult
  • Next by thread: Re: What makes AppleScript difficult
  • Index(es):
    • Date
    • Thread