(→Overview: not all canon basic scripts are dumpers) |
|||
Line 9: | Line 9: | ||
# The file "script.req" must exist on the card's root directory, and must only contain the string "for DC_scriptdisk" (works without any trailing newline character) |
# The file "script.req" must exist on the card's root directory, and must only contain the string "for DC_scriptdisk" (works without any trailing newline character) |
||
# The file "extend.m" must exist on the root directory. This file must contain the Canon BASIC script to execute. |
# The file "extend.m" must exist on the root directory. This file must contain the Canon BASIC script to execute. |
||
− | # Start the camera in Play Mode then click the FUNC button |
+ | # Start the camera in Play Mode then click the FUNC button to run the script. |
==CHDK== |
==CHDK== |
Revision as of 03:17, 21 June 2012
This section contains tools to prepare your card for use with the canon script system.
Backup the Data on your SD-Card before you continue. |
Overview
The following are required to run a canon script. The tools below can be used to set this up
- The SD card may be in FAT16 or FAT32 format.
- The SD card must contain the following items:
- The string "SCRIPT" must be at offset 0x1F0 of the first sector (Boot sector).
- The file "script.req" must exist on the card's root directory, and must only contain the string "for DC_scriptdisk" (works without any trailing newline character)
- The file "extend.m" must exist on the root directory. This file must contain the Canon BASIC script to execute.
- Start the camera in Play Mode then click the FUNC button to run the script.
CHDK
The following lua script prepares a script disk on camera. You must have Native function call support compiled in.
--[[
@title prepare script disk
]]
f=io.open("A/SCRIPT.REQ","w")
if not f then
error("file open failed")
end
f:write("for DC_scriptdisk")
f:close()
if call_event_proc("SystemEventInit") == -1 then
call_event_proc("System.Create")
end
call_event_proc("MakeScriptDisk",0)
--
*nix
The following shell script is from Alfredo and Orens original documentation. This should be applicable to most unixish systems, but may need some adjustment for your specific system.
Note: Mac OSX users can prepare cards using my MacBoot app (which does pretty much what the unix script does but somewhat more safely). Download from http://www.zenoshrdlu.com/macboot/macboot.html
This script could damage your system if you tell it to use the wrong device. Make sure you know which device is your SD card, and that the usage of /mnt is compatible with your system. |
#!/bin/bash
#Enable powershot basic scripting on a memory card
if [ $# -ne 1 ] ; then
echo
echo "Usage : ./makeScriptCard.sh [ device ]"
echo
echo " [ device ] is a fat32 / fat16 partition on the memory card"
echo " example : ./makeScriptCard.sh /dev/sdb1"
echo "NOTE: please run as root"
exit 112
fi
#TAG on boot sector
echo -n SCRIPT | dd bs=1 count=6 seek=496 of=$1
#mount card
umount /mnt
mount $1 /mnt
#create script request file
echo "for DC_scriptdisk" > /mnt/script.req
#Example script
echo 'private sub sayHello()
a=LCDMsg_Create()
LCDMsg_SetStr(a,"Hello World!")
end sub
private sub Initialize()
UI.CreatePublic()
sayHello()
end sub
'>/mnt/extend.m
#Done !
echo "Please check /mnt for files extend.m and script.req"
Windows
EOScard
The EOScard utility can be used to prepare the cards boot sector with the "SCRIPT" string.
- Start EOSCard, select your SD card drive
- Check [x] SCRIPT in the Strings section, uncheck all other options there
- Press "Save" to write the boot sector
- You'll get a feedback information in the status bar
- Close EOSCard
- Create the "script.req" file and save your script like described in Canon_Basic/Card_Setup#Overview
- Remove the SD card using the "safely remove hardware" icon from the taskbar
Disk editor
On Windows a Disk Editor can be used to write the string "SCRIPT" onto the SD-Card.
→Double check the drive / drive letter to avoid killing your hard disk drive(s) !
HxD
- Download HxD - Freeware Hex Editor and Disk Editor
- Start HxD with administrator rights
- Choose the first partition on your SD card and uncheck "Writeprotected"
- Edit you SD card following Canon_Basic#Format_of_the_SD_card, then create the "script.req" file and save your script like described in Canon_Basic/Card_Setup#Overview