AppleScript Support
Supported Properties
The following properties are supported (on the application object) by Car-100 Control:
Name | Read Only | Description |
---|---|---|
car is connected | Yes | This property will be true if the car has connected to Car-100 Control. This does not (on it's own) imply that the car is ready to drive. |
car is charging | Yes | This property will be true if the car is charging. If the car is charging it cannot be driven. Any changes to driving properties will not do anything. |
car direction | No | This is the forwards/backwards direction of the car. Valid values are:
|
car stearing | No | This is the left/rigth direction of the car. Valid values are:
|
Note that the size of the positive and negative numbers has no effect. -1 will turn left as hard as -1000.
Example Script
This example script shows how to wait till the car is ready to drive then drives in a pre-defined pattern. To use the script open Script Editor (in /Applications/AppleScript/ by default) and copy and paste the text.
tell application "Car-100 Control"
-- Get the initial connected and charging states
set connected to car is connected
set charging to car is charging
-- As long as the car is either not connected or charging wait
repeat while (not connected) or charging
delay 2
set connected to car is connected
set charging to car is charging
end repeat
-- Gives you a chance to put the car down once you have disconnected it from the phone.
delay 2
--- Drive forwards and right.
set car stearing to 1
set car direction to 1
delay 2
-- Drive backwards and left.
set car stearing to -1
set car direction to -1
delay 2
-- Stop.
set car direction to 0
set car stearing to 0
end tell