Scripting

ExpanDrive, as of version 1.1, now supports AppleScript. Using AppleScript you can add, edit, remove, connect, and eject drives in ExpanDrive. Here's a quick sample script that showcases what ExpanDrive can do with AppleScript. We'll go into more detail further down the page.

tell application "ExpanDrive"
    count drives
    connect drive 2
    get isConnected of drive 2
    connect (every drive whose server is "sftp.magnetk.com")
    connect (every drive whose )
    set username of drive 1 to "someoneElse"
    eject every drive
    make new drive at end with properties {server:"sftp.newServer.com", username:"QFlacus"}
end tell

Drives

You can access the drives you have configured in ExpanDrive either by their position in the Drive Manager, or by their attributes.

To get a drive object by it's index in the array. For example,

drive 1

will give you a reference to the first object in the Drive Manager.

You can also get a list of drive objects by asking for their attributes. For example,

every drive whose server contains "serverName"

will give you a list of all the drives who have 'serverName' in their 'server' attribute.

Attributes

* server

* username

* port

* isConnected (read only)

* url (read only)

Commands

The

connect

and

eject

commands can be applied to either a single drive or a list of drives.

expandrive/scripting.txt · Last modified: 2008/04/15 16:14 (external edit)