Mode specific default script (video and still) - Feature Requests - CHDK Forum

Mode specific default script (video and still)

  • 4 Replies
  • 1847 Views
Mode specific default script (video and still)
« on: 02 / April / 2013, 05:01:30 »
Advertisements
I was wondering if it would be possible to have a default script for still image related modes, and a default script for video modes.

for example, suppose you have a motion detection or HDR script that you like to use with still images, but for video mode, you manage to find a script that allows for manual focusing or something.

I was thinking that it would be awesome if the still image and video mode can have separate default scripts.

*

Offline msl

  • *****
  • 1269
  • A720 IS, SX220 HS 1.01a
    • CHDK-DE links
Re: Mode specific default script (video and still)
« Reply #1 on: 02 / April / 2013, 06:11:23 »
It's possible. You have two options.

First:
The default script reads the shooting mode and starts depending on the mode an action.

Second:
The script reads the shooting mode and calls depending on the mode another script.

msl
CHDK-DE:  CHDK-DE links

Re: Mode specific default script (video and still)
« Reply #2 on: 02 / April / 2013, 06:40:29 »
I was wondering if it would be possible to have a default script for still image related modes, and a default script for video modes.

for example, suppose you have a motion detection or HDR script that you like to use with still images, but for video mode, you manage to find a script that allows for manual focusing or something.

I was thinking that it would be awesome if the still image and video mode can have separate default scripts.
As msl suggested, the most straightforward way to do this is to detect the current shooting mode in a script and do something different as required. 

You could also take a look at the CHDK User Menu in the 1.2.0 version.  While not quite what you would suggested,  it does allow you to add a short list of your favorite scripts to a menu that will display as soon as you go into <ALT> mode.

Also,  tsvstar did a lot of work on his custom branch of CHDK during the UI 2.0 discussion last summer.  The thread starts at this post but he basically added functionality that IIRC invoked certain scripts to run automatically when the camera changed modes.  There was a lot more to his build - including the ability to select different camera setups for different users and a more advanced user menu.  Ultimately,  I think his branch became quite complex and somewhat specialized to his specific needs so his changes never found their way into the main trunk.   At sometime I think it would be good to go back and look at some parts of what he did again.

The script reads the shooting mode and calls depending on the mode another script.
@msl : how does a uBASIC script launch another script?  (or Lua for that matter - although I assume its easier in Lua,  I just haven't looked)
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline msl

  • *****
  • 1269
  • A720 IS, SX220 HS 1.01a
    • CHDK-DE links
Re: Mode specific default script (video and still)
« Reply #3 on: 02 / April / 2013, 07:28:14 »
@ww: If any is uBASIC only usable for the first solution. But Lua is for such tasks always the better solution.

The second solution (loadfile(<path>) ()) also has a side effect. We can save RAM. But you have to think hard about how to organize the script parameters.

msl
CHDK-DE:  CHDK-DE links


Re: Mode specific default script (video and still)
« Reply #4 on: 02 / April / 2013, 08:22:44 »
If any is uBASIC only usable for the first solution.
That's too bad - we might have done something simple & interesting by replacing the DEFAULT.BAS file on the SD card with code that would load different scripts depending on the camera mode at startup or cold reload of CHDK.

Quote
But Lua is for such tasks always the better solution. The second solution (loadfile(<path>) ()) also has a side effect. We can save RAM. But you have to think hard about how to organize the script parameters.
Well,  as I understand it,  loadfile() will pull in functions from the specified file.  That's very useful but not quite the same as Chain loading in BASIC for example.  You don't get to run a different file,  you just get new additions loaded with your current file.

The drawback here is that your loader program is not independent of the other programs you might want to run.  Changes to one need to also be made in the other.   Not a big deal but not as simple as one program unloading and the next program loading by filename.
Ported :   A1200    SD940   G10    Powershot N    G16

 

Related Topics