![]() |
#1 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,970
Karma: 75337983
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 06:38 PM. |
![]() |
![]() |
![]() |
#2 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,443
Karma: 8012886
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: 10,970
Karma: 75337983
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 08:24 PM. |
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Incrementing a column for selected books | tranquilo2 | Library Management | 7 | 08-24-2020 11:48 AM |
Rename template for "number of pages" | r728626 | Calibre | 20 | 03-09-2019 01:50 AM |
Is there a way to have an incrementing playcount | JohnMeloche | Library Management | 4 | 10-13-2014 10:45 AM |
Mainframe in a padded, zipper, case | knc1 | Kindle Developer's Corner | 1 | 08-25-2013 11:22 AM |
Version not incrementing | rbruceporter | Calibre | 11 | 11-27-2010 04:39 PM |