Skip to main content

Josh VH's Library tagged mac   View Popular

03 Jan 07

AppleScript Shell Programming

    • Features



      • Interactive execution of AppleScript commands

      • Handles multi-line commands (e.g. 'tell') by going into a mode - current mode is
        indicated by the prompt

      • Subroutines (starting with "on" or "to")
        and script objects (starting with "script") are persistent
        and thus are available for use in any subsequent interactive command

      • Can be used as the "
        shebang
        " interpreter for stand-alone scripts that run non-interactively.
        The "shebang" line for such scripts would be: #!/usr/bin/env ash

        (assuming that the 'ash' script is in your PATH)

        You can also execute files of AppleScript commands by supplying the filenames
        on the command-line when you invoke 'ash'.

      • The "-source" command can be used to execute the commands in a file
        (like the 'source' command in 'tcsh' and 'bash')
        This is especially useful for bringing in subroutine definitions.

      • The "-echo" command can be used to output the values of AppleScript
        expressions - this is especially useful for debugging. For example:
            tell application "Finder"
        set theSelection to selection
        set n to number of items in theSelection
        -echo "number of items selected: " & n
        repeat with i from 1 to n
        -echo "item " & i & " is " & (item i of theSelection as alias)
        end repeat
        end tell


      • The "-abbrev" command allows creation of abbreviations for commonly
        used phrases

      • The "-show" command displays the current AppleScript

      • The "-editor" command sends the current AppleScript to Apple's "Script Editor"

      • The "-rerun" command reruns the most recently executed AppleScript

      • The "-batch" command allows a bunch of AppleScript commands to be batched
        up for later execution

      • The "-read" command can be used to read from the keyboard into an AppleScript
        variable.

      • The "-cd", "-pwd", "-ls" commands operate like the standard shell commands.

      • The "-!" escape can be used to run an arbitrary Unix command.

      • The "-createMan" command generates a 'man page' file for 'ash'.

      • You can use the "-oneoff" command-line option to have 'ash' automatically exit
        after running one (interactively supplied) AppleScript command.

      • You can enable a "trace facility" for the execution of your AppleScripts via
        the "-trace" option. In trace mode, the execution pauses after each AppleScript
        statement and displays the result from the previously executed statement.

      • More detailed usage information is available via the "-help" command.

Turn your Mac into an imaging microscope - The Unofficial Apple Weblog (TUAW)

  • Did you have a toy microscope when you were a kid? Ever think of hooking it up to a Mac? PT at Make has done just that on the cheap. He got an old Intel Play QX microscope on eBay for about $20, installed miXscope imaging software on an iBook, and set out - joshvh on 2006-12-30

Mouseposé

  • Highlights where your mouse is with a keystroke, like expose. - joshvh on 2006-12-30

iBackup

  • iBackup is a simple to use backup/restore utility for scheduled backups of files, folders, applications and your system preferences like the dock, deskop picture, time settings, firewall, bluetooth and system applications like AddressBook, Mail, Stickies, - joshvh on 2006-12-30

Kula - endo

  • Badass RSS Reader... - joshvh on 2006-12-30

YouTube - Don't Get Your Mac Jacked - iAlertU

  • Funniest/Coolest shit ive ever seen for a MacBook Pro....must watch! - joshvh on 2006-12-30

My Journey to Macintosh

  • Good blog about an advanced user switching to OSX from using windows since 3.0 - joshvh on 2006-12-30

rooVid - One video. Many destinations.

  • rooVid Lite allows you to create profiles that contain the details for how you want the exported video formatted. Creating profiles is easy. Select from our pre-defined options or create a custom profile giving you all the options for exporting a QuickTim - joshvh on 2006-12-30
1 - 20 of 49 Next › Last »
Showing 20 items per page

Diigo is about better ways to research, share and collaborate on information. Learn more »

Join Diigo