Activating/scheduling multiple scripts - General Discussion and Assistance - CHDK Forum

Activating/scheduling multiple scripts

  • 3 Replies
  • 3250 Views
Activating/scheduling multiple scripts
« on: 27 / October / 2017, 05:07:57 »
Advertisements
For a repetitive task (without ptp connection) it is required to execute a short script (script1) and after that script has finished wait approximately 3 seconds prior to executing a second short script (script2) before repeating the cycle.

If at all possible, could it be (relatively) straightforward to have a keyboard button assigned to both load and start script1 and a second button assigned to do that for script2? (or the same button pressed once to load/execute script1 & pressed twice to load/execute script2)

Even better would be an on camera scheduler that, after setup, was assigned to a button which loaded/started script1 and done that for script2 a set period later.

Wishful thinking only?

*

Offline reyalp

  • ******
  • 14079
Re: Activating/scheduling multiple scripts
« Reply #1 on: 27 / October / 2017, 13:31:41 »
For a repetitive task (without ptp connection) it is required to execute a short script (script1) and after that script has finished wait approximately 3 seconds prior to executing a second short script (script2) before repeating the cycle.
CHDK currently does not provide a way to do this.

Is there any reason you can't combine the scripts?

In Lua, you can load / run other Lua files, although you will have to handle setting menu parameters yourself. See some discussion around: https://chdk.setepontos.com/index.php?topic=6231.msg134974#msg134974

It occurs to me it should be relatively simple to make a Lua script that reads the script header and/or loads saved CHDK script parameters. This would make running menu scripts a lot simpler.

edit:
You might be able to do something tricky using set_config_value to set the selected script (so script A runs, sets the current script to script B, next time you press the shutter in alt B runs...), but IMO combining the scripts would generally be a much better plan.
« Last Edit: 27 / October / 2017, 13:40:52 by reyalp »
Don't forget what the H stands for.

Re: Activating/scheduling multiple scripts
« Reply #2 on: 28 / October / 2017, 05:19:11 »
Some good ideas.

but IMO combining the scripts would generally be a much better plan.

Probably - i'll have another look.

Thanks.

Re: Activating/scheduling multiple scripts
« Reply #3 on: 28 / October / 2017, 11:39:27 »
Something that I briefly looked at but haven't finished is adding the ability to specify a separate "startup" script.  Something that can run each time the camera starts that still leaves the ability to select different "currently selected" scripts like we have now.



One more roundtuit on "the list".


Edit : Yes, there is a scripting only way to accomplish this. Technically I could add a call to get_autostart( ) to every one of my scripts, see if the script was running on startup vs normally, and insert startup code into every script.  Brute force and not something I'd want to maintain.
« Last Edit: 28 / October / 2017, 11:43:23 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16


 

Related Topics