|
|
#1 |
|
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,393
Karma: 80947541
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Template: Incrementing a padded number by one
Using a template in Action Chain's "single field edit", how would I go about making this sort of change?
OEBPS/file0011.xhtml#kobo.194.1 ==> OEBPS/file0012.xhtml#kobo.1.1 OEBPS/file0999.xhtml#kobo.123.456 ==> OEBPS/file1000.xhtml#kobo.1.1 (I can strip off the #kobo.1.1 if it makes things simpler.) Context for what I'm trying to do. ![]()
Last edited by ownedbycats; 03-09-2021 at 07:38 PM. |
|
|
|
|
|
#2 |
|
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,529
Karma: 8075744
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Code:
program:
input = 'OEBPS/file0011.xhtml#kobo.194.1';
a = re(input, '^OEBPS/file(\d{4})(\.xhtml.*$)', '\1');
strcat('OEBPS/file', format_number(add(a, 1), '04d'), '.xhtml#kobo.1.1')
|
|
|
|
| Advert | |
|
|
|
|
#3 |
|
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,393
Karma: 80947541
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Hmm, putting that in the template tester results in file0012 for everything.
EDIT: I remembered what to do after checking the reference again. i changed it to input = field('#kobobookmark') and that works. ![]() Thank you! Last edited by ownedbycats; 03-09-2021 at 09:24 PM. |
|
|
|
![]() |
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Incrementing a column for selected books | tranquilo2 | Library Management | 7 | 08-24-2020 12:48 PM |
| Rename template for "number of pages" | r728626 | Calibre | 20 | 03-09-2019 02:50 AM |
| Is there a way to have an incrementing playcount | JohnMeloche | Library Management | 4 | 10-13-2014 11:45 AM |
| Mainframe in a padded, zipper, case | knc1 | Kindle Developer's Corner | 1 | 08-25-2013 12:22 PM |
| Version not incrementing | rbruceporter | Calibre | 11 | 11-27-2010 05:39 PM |