CHDK Wiki
(→‎How to run a script: corrected recent change about file name extension interpretation)
 
(17 intermediate revisions by 8 users not shown)
Line 1: Line 1:
 
CHDK includes a slightly modified version of the [http://www.sics.se/~adam/ubasic/ uBASIC interpreter written by Adam Dunkels], which itself is a tiny version of [[wikipedia:BASIC | BASIC]] (Beginner's All-purpose Symbolic Instruction Code). CHDK allows users to automate their cameras by running "scripts", small and simple programs written in a short-hand version of BASIC. There are scripts for exposure bracketing, focus bracketing, intervalometer and many more.
  +
 
==How to run a script==
 
[[Image:Script.jpg|right|thumb|170px| The Script Menu]]
 
[[Image:Script.jpg|right|thumb|170px| The Script Menu]]
 
[[Image:Script.gif|right|thumb|170px| Running a Script - ''Exposure Bracketing'']]
 
[[Image:Script.gif|right|thumb|170px| Running a Script - ''Exposure Bracketing'']]
 
* Download or write your own script and save it to the ''CHDK/SCRIPTS/'' folder of your SD card. (File name is not important, but the extension must be .LUA or .lua for Lua scripts. Files with any other extension will be treated as uBASIC scripts.)
 
 
* Enter the [[CHDK_firmware_usage#Script_menu|script menu]], load the script, adjust the parameters to your liking and exit the menu.
The CHDK allows you to automate your camera by running "scripts", small and simple programs written in a short-hand version of BASIC. There are scripts for exposure bracketing, focus bracketing, intervalometer and many more.
 
 
* While still in [[CHDK_firmware_usage#.3CALT.3E_mode|<ALT>]] mode just press the {{button|shutter}} button and the script will start. A [[CHDK_firmware_usage#Script_mini-console|mini console]] will be displayed while the script is running.
 
 
* NB: Set the ''Review'' parameter in the NORMAL camera menu to "off", other options such as "x sec" or "hold" will interfere with the execution of scripts.
==How to run a script==
 
 
* A running script can be''' stopped''' by simply pressing the {{button|shutter}} button again, or '''paused''' by exiting <ALT> mode. If paused the script will resume right where it left off when re-entering <ALT> mode.
* Download or write your own script and place it in the ''CHDK/SCRIPTS/'' folder of your SD-card, (name and extention are not important).
 
* Enter the [[CHDK_firmware_usage#Script_menu|script menu]], load the script, adjust the parameters to your liking and leave the menu.
 
* While still in [[CHDK_firmware_usage#.3CALT.3E_mode|<ALT>]] mode just press the {{button|shutter}} button and the script will start. A [[CHDK_firmware_usage#Script_mini-console|mini console]] will be displayed while you run the script.
 
* Note:<strike>It's best to&nbsp; </strike>set the ''Review'' parameter in the NORMAL camera menu to "off", other options like "x sec" or "hold" <strike>can</strike> will interfere with the execution of scripts.
 
* You may interrupt a running script by just pressing the {{button|shutter}} button again. Or pause a running script by exiting &lt;ALT&gt; mode, if paused the script will resume right where it left off when re-entering &lt;ALT&gt; mode.
 
   
 
<div align="right">([[FAQ#Q._What_can_I_use_exposure.2Ffocus_bracketing_for.3F|What's that? → ]])</div>
 
<div align="right">([[FAQ#Q._What_can_I_use_exposure.2Ffocus_bracketing_for.3F|What's that? → ]])</div>
   
'''You can download pre-made scripts here:'''
+
'''You can download ready made scripts here:'''
----
 
 
   
 
* [[uBASIC/Scripts|'''User Written Scripts''']] (please feel free to contribute)
 
* [[uBASIC/Scripts|'''User Written Scripts''']] (please feel free to contribute)
   
  +
*
* [http://tools.assembla.com/chdk/browser/branches/grand/script Sample Scripts]
 
 
----
 
 
 
 
*:[[Talk:uBASIC/Scripts|User Written Scripts - Discussion]] ... Posts about: Writing your own scripts, comments about scripts on this page: problems, bugs, improvements, help converting them to other cameras, etc.
 
*:[[Talk:uBASIC/Scripts|User Written Scripts - Discussion]] ... Posts about: Writing your own scripts, comments about scripts on this page: problems, bugs, improvements, help converting them to other cameras, etc.
 
*'''<u>Links to Other Scripts Found on the Net!</u>'''
 
*'''<u>Links to Other Scripts Found on the Net!</u>'''
:If you have found any interesting scripts for CHDK out there in net-land, please share their links here. If enough are added or found we'll add another page or list them with the other user-written scripts here in CHKD-Wikiland.
+
:If you find any interesting scripts for CHDK out there in net-land, please share their links here. If enough are added or found we'll add another page or list them with the other user-written scripts here in CHKD-Wikiland.
 
:[waycool_script link placeholder]
 
:[waycool_script link placeholder]
   
 
==Links==
 
==Links==
 
'''If you want to modify existing scripts or write your own, you'll find more information here:'''
   
  +
===uBasic===
'''If you want to modify existing scripts or write your own:'''
 
  +
Some basic articles:
  +
 
* [[uBASIC/uBASIC syntax|uBASIC Syntax]]
 
* [[uBASIC/TutorialScratchpad|Scripting Tutorial]], including a description of available uBasic script commands.
 
* [[uBASIC/TutorialScratchpad|Scripting Tutorial]], including a description of available uBasic script commands.
 
 
::[[Talk:uBASIC/TutorialScratchpad|Scripting Tutorial Discussion]] ... Posts about help with scripting syntax, unique uBASIC problems found, tutorial sections that need help, etc.
 
::[[Talk:uBASIC/TutorialScratchpad|Scripting Tutorial Discussion]] ... Posts about help with scripting syntax, unique uBASIC problems found, tutorial sections that need help, etc.
   
  +
* [[CHDK_firmware_usage/MoreBest#New_uBASIC_and_LUA_Scripting_Commands.21|New uBasic &amp; Lua scripting commands]], descriptions of newly introduced scripting commands
* [[uBASIC/uBASIC syntax|uBASIC Syntax]]
 
  +
 
* [[uBASIC Syntax Highlighting for BBEdit]]
 
* [[uBASIC Syntax Highlighting for BBEdit]]
   
  +
===Lua===
* [[LUA]] {{new!}} LUA scripting language, syntax &amp; command reference...
 
  +
* [[Lua]]: what is ''Lua'' ? --> introduction to the Lua scripting language, links, samples...
  +
* [[Lua/Lua_Reference|Lua scripting - new and changed commands]] - describes additional and/or changed scripting commands for the Lua scripting language
  +
  +
  +
{{tagb|→}} See also the '''[[CHDK_Scripting_Cross_Reference_Page|Scripting Cross Reference Page]]''' for the complete list of CHDK scripting commands for Lua and uBasic.
   
 
----
 
----
 
[[Category:uBASIC|uBASIC]]
 
[[Category:uBASIC|uBASIC]]
  +
[[Category:Development]]

Latest revision as of 01:10, 7 December 2012

CHDK includes a slightly modified version of the uBASIC interpreter written by Adam Dunkels, which itself is a tiny version of BASIC (Beginner's All-purpose Symbolic Instruction Code). CHDK allows users to automate their cameras by running "scripts", small and simple programs written in a short-hand version of BASIC. There are scripts for exposure bracketing, focus bracketing, intervalometer and many more.

How to run a script

Script

The Script Menu

Script

Running a Script - Exposure Bracketing

  • Download or write your own script and save it to the CHDK/SCRIPTS/ folder of your SD card. (File name is not important, but the extension must be .LUA or .lua for Lua scripts. Files with any other extension will be treated as uBASIC scripts.)
  • Enter the script menu, load the script, adjust the parameters to your liking and exit the menu.
  • While still in <ALT> mode just press the shutter button and the script will start. A mini console will be displayed while the script is running.
  • NB: Set the Review parameter in the NORMAL camera menu to "off", other options such as "x sec" or "hold" will interfere with the execution of scripts.
  • A running script can be stopped by simply pressing the shutter button again, or paused by exiting <ALT> mode. If paused the script will resume right where it left off when re-entering <ALT> mode.

You can download ready made scripts here:

  • User Written Scripts - Discussion ... Posts about: Writing your own scripts, comments about scripts on this page: problems, bugs, improvements, help converting them to other cameras, etc.
  • Links to Other Scripts Found on the Net!
If you find any interesting scripts for CHDK out there in net-land, please share their links here. If enough are added or found we'll add another page or list them with the other user-written scripts here in CHKD-Wikiland.
[waycool_script link placeholder]

Links

If you want to modify existing scripts or write your own, you'll find more information here:

uBasic

Some basic articles:

Scripting Tutorial Discussion ... Posts about help with scripting syntax, unique uBASIC problems found, tutorial sections that need help, etc.

Lua


See also the Scripting Cross Reference Page for the complete list of CHDK scripting commands for Lua and uBasic.