Is it possible to autostart a script from another script? - Script Writing - CHDK Forum

Is it possible to autostart a script from another script?

  • 3 Replies
  • 2052 Views
*

Offline Mlapse

  • *****
  • 584
  • S95 S110
Is it possible to autostart a script from another script?
« on: 20 / January / 2020, 16:49:32 »
Advertisements
I hope the title says it all.
but what i was wondering
when i start a script via the shoot button.
can i load and autostart another script that is sitting in my scripts folder?
so without having to push the shoot button again?
as a result the active script is changed (when the if statement is true) and running

and if the answer is yes, how would be the best way to go about this?
frustration is a key ingredient in progress

*

Offline reyalp

  • ******
  • 14117
Re: Is it possible to autostart a script from another script?
« Reply #1 on: 20 / January / 2020, 18:04:17 »
Short answer:
No. There's no mechanism in CHDK to start a script from another script as if it were selected in the script menu and the shutter button pressed.

Longer answer:
In Lua, you can run Lua code that resides in another file in various ways. Generally, to run another standalone script, you'd want to use the same pattern as running a camera side script from PTP, as described on https://chdk.fandom.com/wiki/Lua/PTP_Scripting
You'd need to provide "glue" to set any menu parameters, or code the second script to get settings in some other way.

You should be able to set the selected script with set_config_value, but you'd have to press shutter again to run the next script. You can also assign scripts in the user menu, but this again just selects the script and opens the script options.
Don't forget what the H stands for.

*

Offline Mlapse

  • *****
  • 584
  • S95 S110
Re: Is it possible to autostart a script from another script?
« Reply #2 on: 21 / January / 2020, 02:25:46 »
Short answer:
No.

Thanks reyalp, i already looked into the long version you described. was just wondering if i could use a different method for my purpose...but as expected......alas.
« Last Edit: 21 / January / 2020, 02:31:28 by Mlapse »
frustration is a key ingredient in progress

*

Offline Caefix

  • *****
  • 947
  • Sorry, busy deleting test shots...
Re: Is it possible to autostart a script from another script?
« Reply #3 on: 21 / January / 2020, 10:59:42 »
There is a very long answer, but it´s an adventure written in Lua... :blink: :o
https://forum.chdk-treff.de/viewtopic.php?f=7&t=3540&start=15#p31804
All lifetime is a loan from eternity.


 

Related Topics


SimplePortal 2.3.6 © 2008-2014, SimplePortal