01-14-2022, 07:19 AM | #796 | |
Grand Sorcerer
Posts: 11,703
Karma: 6658935
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
Code:
globals(pagenum); Code:
pagenum = globals(pagenum); Code:
pagenum = globals(pagenum, foobar); |
|
01-14-2022, 08:58 AM | #797 |
Wizard
Posts: 1,081
Karma: 1948136
Join Date: Aug 2015
Device: Kindle
|
OK, I think I understand what is happening to you now. Since you are still trying to configure an action without having run the chain, the value of pagenum is an empty string (chain variables are only assigned at runtime, even without the runtime option ticked).
So, at this point in time, the value of pagenum (empty string) cannot be used in mathematical operations, and the template evaluator will return an error and you will not be able to save it. To remedy this: Code:
program:
pagenum = ifempty(globals(pagenum), 1)
pagenum = globals(pagenum=1)
Last edited by capink; 01-14-2022 at 10:36 AM. Reason: include chaley's solution |
01-14-2022, 09:03 AM | #798 | |
Grand Sorcerer
Posts: 11,703
Karma: 6658935
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
Code:
globals(pagenum=1) |
|
01-14-2022, 10:34 AM | #799 | |
Wizard
Posts: 1,081
Karma: 1948136
Join Date: Aug 2015
Device: Kindle
|
Quote:
Edit: Chain Variables documentation updated. Last edited by capink; 01-14-2022 at 01:01 PM. |
|
01-14-2022, 05:30 PM | #800 |
Custom User Title
Posts: 8,419
Karma: 59666665
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
That worked. Thank you
|
01-15-2022, 07:19 PM | #801 |
Custom User Title
Posts: 8,419
Karma: 59666665
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
quick question: Does the variable name need to be One_String_Without_Any_Spaces? I tried changing it to "Current Page" and couldn't get that into the template without an error. Current_Page works though.
|
01-15-2022, 08:11 PM | #802 |
Wizard
Posts: 1,081
Karma: 1948136
Join Date: Aug 2015
Device: Kindle
|
Spaces are not allowed in variable names.
|
01-22-2022, 10:51 PM | #803 |
Custom User Title
Posts: 8,419
Karma: 59666665
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Question: How does Action Chains treat Calibre Action dialogs?
Does the chain wait until I press ok/cancel to close the dialog, or proceed running in the background? |
01-23-2022, 06:39 AM | #804 |
Wizard
Posts: 1,081
Karma: 1948136
Join Date: Aug 2015
Device: Kindle
|
It depends on the dialog itself.
Last edited by capink; 01-24-2022 at 12:12 PM. |
01-27-2022, 07:46 PM | #805 |
Custom User Title
Posts: 8,419
Karma: 59666665
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Is it possible to use a module to set a variable?
Context: Mostly as curiosity/to figure out how the code works, I wanted to see if I could make a modification of this chain that, instead of raise chain.UserInterrupt when clicking 'no,' instead sets a specified variable to a specified value on clicking 'yes'. That could then be used in a chain modifier to enable a specific action. Similar to the attached chain, but with a yes/no dialog in place of typing in 'yes' manually. Last edited by ownedbycats; 01-28-2022 at 07:25 AM. |
01-29-2022, 10:24 AM | #806 | |
Wizard
Posts: 1,081
Karma: 1948136
Join Date: Aug 2015
Device: Kindle
|
Quote:
Code:
chain.set_chain_vars({'my_var_name': 'false'}) |
|
01-29-2022, 07:57 PM | #807 |
Custom User Title
Posts: 8,419
Karma: 59666665
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
It works. Thank you.
Just for confirming something I noticed: Are variable values case-sensitive? Last edited by ownedbycats; 01-29-2022 at 09:45 PM. |
01-29-2022, 11:14 PM | #808 |
Custom User Title
Posts: 8,419
Karma: 59666665
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Also, silly question: Where exactly in single-field edit is the "add format from predefined path"? I only see the option to remove formats.
Last edited by ownedbycats; 01-30-2022 at 03:49 AM. |
01-30-2022, 08:09 AM | #809 |
Wizard
Posts: 1,081
Karma: 1948136
Join Date: Aug 2015
Device: Kindle
|
|
01-30-2022, 08:10 AM | #810 | |
Wizard
Posts: 1,081
Karma: 1948136
Join Date: Aug 2015
Device: Kindle
|
Quote:
Last edited by capink; 01-30-2022 at 08:55 AM. |
|
Thread Tools | Search this Thread |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[Editor Plugin] Editor Chains | capink | Plugins | 80 | 03-09-2024 12:30 PM |
Action Chains Resources | capink | Plugins | 54 | 01-29-2024 11:24 PM |
[GUI Plugin] Noosfere_util, a companion plugin to noosfere DB | lrpirlet | Plugins | 2 | 08-18-2022 03:15 PM |
[GUI Plugin] Save Virtual Libraries To Column (GUI) | chaley | Plugins | 14 | 04-04-2021 05:25 AM |