The FooDoo Lounge

Handle it!

Fast, reliable and compact handlers to use directly in your own scripts. Unless otherwise noted, they should work under any version of AppleScript. Most of them are small and highly generalised. I write more complex functions using these as building blocks.

Too Bad icon

To use them, just select and copy as required. The lines may wrap, but they should compile OK when copied out of most modern browsers. Be aware that Safari (still, at V1.2) tends to do exceedingly stupid things with spaces, so you will be much better off using another browser to copy handlers. Most other browsers seem fine in this regard. Turn off stylesheets in older browsers if neccessary to copy the handlers out and compile them directly.

If you are not sure how to use handlers, check this page for an introduction, an example of putting inline code into a handler and tips on how to call them. Please also read my Terms & Conditions before using these.

Many of these handlers (and more) are available as a free library called baseLib. There is a brief introduction to it here and the docs can be found here.

File I/O

  1. Read a file
  2. Create or overwrite a file
  3. Create or append to a file
  4. Read a chunk from the beginning of a file

Short Date Strings

  1. ISO: yyyy-mm-dd
  2. Alphanumeric: ddMonyyyy
  3. Alphanumeric: yyyyMondd
  4. UK/AU Numeric: dd-mm-yyyy
  5. US Numeric: mm-dd-yyyy
  6. Get a month number - the French Vanilla method
  7. Get a file name friendly time string

Numerics

  1. Convert a number in bytes to a readable string
  2. Convert a time in seconds to days-hours-minutes-seconds
  3. x!
  4. Round and truncate a number
  5. Round and truncate to 2 decimal places

Basic List Handling

  1. Add to a list
  2. Delete from a list

File Stuff

  1. Return an item's name and path
  2. Does the item exist?
  3. Find Files Whose Name Contains...
  4. Split the extension from a file name

Other Stuff

  1. Convert an AS list to a string
  2. Convert a delimited string to an AS list
  3. Convert an AS list to a string that looks like a list
  4. Multiple Find and replace
  5. Check for minimum AppleScript version
  6. Check for minimum system version
  7. Initialise and set the text item delimiters

Finder

  1. Convert a list of Class Types to a list of strings

Palm Desktop

  1. Get a formatted name, company and address
  2. Get a contact's name & email address
  3. Also see this info page for info on scripting PD 2.x-4.0

 

The FooDoo Lounge is Copyright © Richard Morton 2002-2005

|| url: http://www.foodoo.sunreal.com.au/code/index.html
|| created: 27-May-04, 11:43 AM; updated: 21-Jan-05, 1:45 PM
|| size: 13951 bytes