\AlphredChoose

Creates and executes AppleScript "Choose from.

.." dialogs.

The ones that aren't included can be better served by regular PHP scripting.

Summary

Methods
Properties
Constants
from_list()
file()
filename()
folder()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
create()
process()
to_posix_path()
No private properties found
N/A

Methods

from_list()

from_list(array  $list, array|boolean  $options = false) : array

Creates and executes a "Choose from list" AppleScript dialog

Parameters

array $list

An array of list items

array|boolean $options

An array of options to customize the dialog

Returns

array —

an array of items chosen

file()

file(array|boolean  $options = false) : array

Creates and executes a "Choose file(s)" AppleScript dialog

Parameters

array|boolean $options

An array of options to customize the dialog

Returns

array —

an array of file path(s)

filename()

filename(array|boolean  $options = false) : array

Creates and executes a "Choose filename" AppleScript dialog

Parameters

array|boolean $options

An array of options to customize the dialog

Returns

array —

an array with the single item being a filename

folder()

folder(array|boolean  $options = false) : array

Creates and executes a "Choose folder(s)" AppleScript dialog

Parameters

array|boolean $options

An array of options to customize the dialog

Returns

array —

an array of folder path(s)

create()

create(string  $start, array  $options, array  $selections) : string

Factory function to create "Choose from.

.." dialogs.

This function will take a few arrays and magically create the AppleScript code necessary for osascript to run a "Choose from..." dialog.

Parameters

string $start

the start of the script

array $options

all possible options

array $selections

the selected options

Returns

string —

the bash command to run an osascript for a "Choose from..." dialog

process()

process(string  $result, mixed  $strip = false, boolean  $path = false) : array

Processes the returned text from an AppleScript interaction

Parameters

string $result

the text that comes out of the AppleScript interaction

mixed $strip

text to strip out of the result

boolean $path

whether or not the result is a path

Returns

array —

the processed response

to_posix_path()

to_posix_path(string  $path) : string

Converts to a POSIX path

Parameters

string $path

the path

Returns

string —

the path as POSIX