Class Choose
Creates and executes AppleScript "Choose from..." dialogs.
The ones that aren't included can be better served by regular PHP scripting.
Methods summary
public
array
|
#
from_list( array $list, array|boolean $options = false )
Creates and executes a "Choose from list" AppleScript dialog
Creates and executes a "Choose from list" AppleScript dialog
Parameters
- $list
- An array of list items
- $options
- An array of options to customize the dialog
Returns
array an array of items chosen
Since
1.0.0
Todo
Inure this to single-quote, double-quotes, and commas
|
public
array
|
#
file( array|boolean $options = false )
Creates and executes a "Choose file(s)" AppleScript dialog
Creates and executes a "Choose file(s)" AppleScript dialog
Parameters
- $options
- An array of options to customize the dialog
Returns
array an array of file path(s)
Since
1.0.0
|
public
array
|
#
filename( array|boolean $options = false )
Creates and executes a "Choose filename" AppleScript dialog
Creates and executes a "Choose filename" AppleScript dialog
Parameters
- $options
- An array of options to customize the dialog
Returns
array an array with the single item being a filename
Since
1.0.0
|
public
array
|
#
folder( array|boolean $options = false )
Creates and executes a "Choose folder(s)" AppleScript dialog
Creates and executes a "Choose folder(s)" AppleScript dialog
Parameters
- $options
- An array of options to customize the dialog
Returns
array an array of folder path(s)
Since
1.0.0
|
private
string
|
#
create( string $start, array $options, array $selections )
Factory function to create "Choose from..." dialogs.
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
- $start
- the start of the script
- $options
- all possible options
- $selections
- the selected options
Returns
string the bash command to run an osascript for a "Choose from..." dialog
Since
1.0.0
|
private
array
|
#
process( string $result, mixed $strip = false, boolean $path = false )
Processes the returned text from an AppleScript interaction
Processes the returned text from an AppleScript interaction
Parameters
- $result
- the text that comes out of the AppleScript interaction
- $strip
- text to strip out of the result
- $path
- whether or not the result is a path
Returns
array the processed response
Since
1.0.0
|
private
string
|
#
to_posix_path( string $path )
Converts to a POSIX path
Parameters
Returns
string the path as POSIX
Since
1.0.0
|
Magic methods summary