Chdk Commands; Button-Related Commands - Canon Camera Hackers Manual

Camera hackers manual berthold daum
Table of Contents

Advertisement

112
C H A P T E R 5
Scripting
5.5

CHDK commands

In sections 5.3 and 5.4, we looked at the language features of uBasic and
Lua. None of these language features are able to invoke specific camera
functions. For that purpose, the CHDK implementations of uBasic and Lua
provide extra commands enriching both languages. The names of the com-
mands are the same in both languages. The main difference is that in Lua,
parameters are enclosed in parentheses and separated by commas,
whereas the CHDK command is implemented as a function. In uBasic, the
parameters are simply listed behind the command name and separated by
blanks. While values can be returned through parameters in uBasic, Lua
only allows returning values as a function result. For example:
is_key r "right"
r = is_key("right") Lua
Some commands return Boolean values (true or false). Unlike Lua, uBasic
does not have a Boolean datatype. Those values are therefore returned to
uBasic as 0 (false) or 1 (true).

5.5.1 Button-related commands:

press "button-name"
press("button-name")
A button is pressed and held down. Normally, this command is followed later by a
release command for the same button name.
release "button-name"
release("button-name")
A button is released. If the button was not pressed, the command does not have any
effect.
click "button-name"
click("button-name")
A button is pressed and immediately released.
shoot
shoot()
Similar to click "shoot_full". In contrast to the click command, the shoot com-
mand will, however, perform all the automatic actions such as focusing, exposure
control, and flash setup before releasing the shutter.
uBasic
uBasic
Lua
uBasic
Lua
uBasic
Lua
uBasic
Lua

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Powershot sx10 is

Table of Contents