Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Sigil

Notices

Reply
 
Thread Tools Search this Thread
Old 11-20-2025, 09:07 AM   #1
ElMiko
Fanatic
ElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileRead
 
ElMiko's Avatar
 
Posts: 511
Karma: 65460
Join Date: Jun 2011
Device: Kindle
Automate list not executing search/replace

I'm revising old CSS, and am trying to use the Automate List to replace old css with the new. One such example is replacing:

Code:
hr {
	border: 0;
	background-color: #000000;
	height: 4px;
	width: 85%;
	}
with

Code:
hr {
	border: 0;
	background-color: #000000;
	height: 4px;
	width: 85%;
	}
hr.hrsep {
	border: 0;
	background-color: #000000;
	height: 1px;
	width: 4em;
	margin-top: 0.75em;
	margin-bottom: 0.75em;
	}
If I do a "Current File" search for the first term, I get the match as desired, but if I try to automate it, it returns no matches (and therefore makes no replacements).

But other similar searches DO work... for example replacing

Code:
.calibre {[\s.\w\p{P}]+?
	}
with

Code:
.calibre {
	display: block;
	font-family: serif;
	font-size: 1em;
	line-height: 1.1;
	margin-bottom: 0;
	margin-left: 2pt;
	margin-right: 2pt;
	margin-top: 0;
	padding-left: 0;
	padding-right: 0;
	page-break-before: always;
	text-align: justify;
	}
p {
	display: block;
	margin-top: 0;
	margin-bottom: 0;
	margin-left: 0;
	margin-right: 0;
	line-height: 1.15em;
	}
Any ideas?

Last edited by ElMiko; 11-20-2025 at 09:14 AM.
ElMiko is offline   Reply With Quote
Old 11-20-2025, 10:30 AM   #2
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 9,089
Karma: 6379704
Join Date: Nov 2009
Device: many
The automate function runs specific named saved searches. So please show the exact named source in a screencap from your Saved Searches Editor including all the control fields, and of course the exact find and replace fields as well. Then show the automation log, and finally your automation list itself.

Have you tried using all css or selected CSS files in your controls?

If your control target is "current file", then the wrap control should probably be set as well given starting cursor position in the current file matters if that is determined by something earlier in the automation list.

But depending on your find field value, and because it is really an append you are doing and not a replace (the find target will always exist even after a replace) you may need to worry about an infinite loop.

Have you tried modifying the replace so that it modifies the code the find looks for to eliminate a loop? Or are you not using wrap? If not, how are you positioning the cursor in current file mode before running the automation list? Does your automation list run a saved search group or just a single saved search?

Using "selected css" as the target (or "all css") would probably be better than current file as they always starts each file at the top automatically for sequential named searches.

Last edited by KevinH; 11-20-2025 at 12:06 PM.
KevinH is offline   Reply With Quote
Old 11-20-2025, 11:09 AM   #3
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 9,089
Karma: 6379704
Join Date: Nov 2009
Device: many
And as with any bug report, adding a simplified epub example file, a file including the sample searches (they can be exported in the Saved Search Editor), and your automation list would really help so that others can try to recreate what you are seeing.

FWIW, I never use the "current file" mode for searches in an automate list as current file mode needs proper cursor positioning and wrap mode to work reliably so just running a search manually, and running the saved search directly is probably a better idea and manually watching for the wrap overlap condition to occur. That is why I suggested the "All CSS" or "Selected CSS" mode above.
KevinH is offline   Reply With Quote
Old 11-20-2025, 11:55 AM   #4
ElMiko
Fanatic
ElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileRead
 
ElMiko's Avatar
 
Posts: 511
Karma: 65460
Join Date: Jun 2011
Device: Kindle
When I'm back at the computer tonight, I'll build a mock up file, and upload it along with the screenshots as well as the ini file for the group of searches and the automated list file.

Is there anything else that I should attach?
ElMiko is offline   Reply With Quote
Old 11-20-2025, 12:13 PM   #5
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 9,089
Karma: 6379704
Join Date: Nov 2009
Device: many
You can also export just selected saved searches using the SavedSearches context pop up menu. There is no need to send an entire ini file.

So epub with css file and a single html file, saved searches you use in automation list exported (as above), and a simplified automation list should be enough.

But as I said, first I would try changing the saved search itself to use Selected CSS mode or All CSS files mode and *NOT* the Current File mode as the current file mode does not keep state (ie it is like the old stateless search) and in automation modes you need to use searches that keep state (which is the whole reason the change to search to keep state was made in the first place) especially when you are appending and not replacing with find and replace.

Last edited by KevinH; 11-20-2025 at 02:25 PM.
KevinH is offline   Reply With Quote
Old 11-20-2025, 09:27 PM   #6
ElMiko
Fanatic
ElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileRead
 
ElMiko's Avatar
 
Posts: 511
Karma: 65460
Join Date: Jun 2011
Device: Kindle
Alright, here goes.

I tried the "All CSS" setting, and it didn't work. In fact, it return NO results unless I ran the automated list in the css file in question. As you can see in image AL_03, when it ran the list in a file other than the css file, despite having selected "All CSS", it ran the list as "All HTML", bizarrely.

The other attached images are:

AL_01: which shows that as a standalone search (i.e. not automated), the "CSS - hr" search does work (in "current file" mode or the key board shortcut for searching within the current file).

AL_02: which is the log for the automated list when it is run with "Current file" selected and the css file open. The same result is displayed if you run it with "All CSS" (or its ilk), but ONLY if you have that file open in the viewing tab. Otherwise, as I said above, it yields NO matches.

A couple of additional notes:

1) You will see that in AL_02, the second-to-last search—"CSS - copyright"—similarly had no matches or replacements. It is like the "CSS - hr" search in that it too will match when the search is run discreetly and in "Current file", but will fail when it's run as part of the automated list.

2) I have tried running the "CSS - hr" search (automated) with the following search term instead:

Code:
hr {[\s.\w\p{P}]+?
	}
... similar in structure to some of the other searches in the automated list, but alas it doesn't work in this case either! (although, it does work when run as a discreet search in "current file" mode.)

3) I've attached the ini file (see note #4) for the group of searches in the automated list. Only the first, "manual CSS candidates", is irrelevant to the automation.

4) MobileReads doesn't like ini files, apparently, so I changed it to "CSSReplacements.txt"

Please let me know if I've forgotten something, or some additional info is needed!
Attached Thumbnails
Click image for larger version

Name:	AL_01.jpg
Views:	11
Size:	493.1 KB
ID:	219346   Click image for larger version

Name:	AL_02.jpg
Views:	10
Size:	345.8 KB
ID:	219347   Click image for larger version

Name:	AL_03.jpg
Views:	9
Size:	371.4 KB
ID:	219348  
Attached Files
File Type: epub Test title - Unknown.epub (16.7 KB, 2 views)
File Type: txt CSSReplacements.txt (4.4 KB, 5 views)
File Type: txt automate01.txt (735 Bytes, 3 views)

Last edited by ElMiko; 11-20-2025 at 09:35 PM.
ElMiko is offline   Reply With Quote
Old 11-20-2025, 10:25 PM   #7
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 9,089
Karma: 6379704
Join Date: Nov 2009
Device: many
Your replacements file shows that your hr css search was done with the control value AH as target:

Code:
14\Name=CSS Replacements/CSS - hr
14\Find="hr {\n\tborder: 0;\n\tbackground-color: #000000;\n\theight: 4px;\n\twidth: 85%;\n\t}"
14\Replace="hr {\n\tborder: 0;\n\tbackground-color: #000000;\n\theight: 4px;\n\twidth: 85%;\n\t}\nhr.hrsep {\n\tborder: 0;\n\tbackground-color: #000000;\n\theight: 1px;\n\twidth: 4em;\n\tmargin-top: 0.75em;\n\tmargin-bottom: 0.75em;\n\t}"
14\Controls=RX WR DN AH
The target set to AH means all html files. The target should have been AC for all css files.

Please edit that search in your Search Editor and edit the Controls field and snap a screen shot of your target. Perhaps that Controls widget is broken somehow? If you select "All CSS" files the AC control should be set in your saved search not the AH.

What appears after double clicking in that control field in the saved search editor and setting the target to All CSS files then clicking outside the controls to save it?

Last edited by KevinH; 11-20-2025 at 10:36 PM.
KevinH is offline   Reply With Quote
Old 11-20-2025, 10:48 PM   #8
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 9,089
Karma: 6379704
Join Date: Nov 2009
Device: many
Furthermore once I edited it to select ALL CSS as the target ("AC") and run your automate list I get the following:

Quote:
RunSavedSearchReplaceAll CSS Replacements/CSS - hr running
Loaded: CSS - hr
Replacements made: 1
Replacements made: 1

Automation List Completed

As I said earlier. using "Currrent File" searches in an automation list is generally not a good idea unless you are sure you have set the initial cursor position properly (and that may be impossible in a automation list where the search is not done first) and are replacing the find field text (not just appending) so that only one pass is made even with wrap turned on.
KevinH is offline   Reply With Quote
Old 11-20-2025, 10:57 PM   #9
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 9,089
Karma: 6379704
Join Date: Nov 2009
Device: many
In fact when I use the Fill controls to "fix" your set of controls to use ALL CSS instead of Current File or All HTML, and run it I get the following log file:

Quote:
RunSavedSearchReplaceAll CSS Replacements/CSS - calibre (body) and p running
Loaded: CSS - calibre (body) and p
Replacements made: 1
Replacements made: 1

RunSavedSearchReplaceAll CSS Replacements/CSS - remove base p running
Loaded: CSS - remove base p
No replacements made
No replacements made

RunSavedSearchReplaceAll CSS Replacements/CSS - remove duplicate p running
Loaded: CSS - remove duplicate p
No replacements made
No replacements made

RunSavedSearchReplaceAll CSS Replacements/CSS - calibre1 (basic para) running
Loaded: CSS - calibre1 (basic para)
Replacements made: 1
Replacements made: 1

RunSavedSearchReplaceAll CSS Replacements/CSS - blockquote running
Loaded: CSS - blockquote
Replacements made: 1
Replacements made: 1

RunSavedSearchReplaceAll CSS Replacements/CSS - none running
Loaded: CSS - none
Replacements made: 1
Replacements made: 1

RunSavedSearchReplaceAll CSS Replacements/CSS - noneX running
Loaded: CSS - noneX
No replacements made
No replacements made

RunSavedSearchReplaceAll CSS Replacements/CSS - noheading running
Loaded: CSS - noheading
Replacements made: 1
Replacements made: 1

RunSavedSearchReplaceAll CSS Replacements/CSS - hindent and hindentX running
Loaded: CSS - hindent and hindentX
Replacements made: 1
Replacements made: 1

RunSavedSearchReplaceAll CSS Replacements/CSS - drop running
Loaded: CSS - drop
No replacements made
No replacements made

RunSavedSearchReplaceAll CSS Replacements/CSS - copyright running
Loaded: CSS - copyright
No replacements made
No replacements made

RunSavedSearchReplaceAll CSS Replacements/CSS - hr running
Loaded: CSS - hr
Replacements made: 1
Replacements made: 1

Automation List Completed
So everything appears to be work as expected. If you only want to run on a single css file instead of all of them then use "Tabbed CSS Files" or "Selected CSS files" as your target and make sure you have selected or opened in a tab the css file you want before running the automate list.

All appears to work.
KevinH is offline   Reply With Quote
Old 11-20-2025, 11:03 PM   #10
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 9,089
Karma: 6379704
Join Date: Nov 2009
Device: many
And, even if you leave it as "Current File" and after fixing the hr entry to use Current File too, it all seems to work as expected if you have open the styleesheets.css and turn on wrap and position the cursor near the top before launching the automate list.

It gives the following:

Quote:
...

RunSavedSearchReplaceAll CSS Replacements/CSS - hr running
Loaded: CSS - hr
Replacements made: 1
Replacements made: 1

Automation List Completed
So I can not recreate what you earlier reported even using just Current File mode.

Perhaps the issue is tied to Windows somehow. As on a Mac I can not recreate what you are seeing.

Last edited by KevinH; 11-20-2025 at 11:10 PM.
KevinH is offline   Reply With Quote
Old 11-20-2025, 11:15 PM   #11
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 9,089
Karma: 6379704
Join Date: Nov 2009
Device: many
And fwiw, if you make a single search group to hold your searches, you can launch the entire search group in the search editor without any automation list at all in a single click.
KevinH is offline   Reply With Quote
Old 11-20-2025, 11:21 PM   #12
ElMiko
Fanatic
ElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileRead
 
ElMiko's Avatar
 
Posts: 511
Karma: 65460
Join Date: Jun 2011
Device: Kindle
Oh my God. Okay. I had no idea what that column even meant. Part of the issue is that the majority of my searches have that column blank because Imported them from v 0.7.2....

This is HUGE. It also explains why it the automated list ended up running on "all HTML" for that last search...

Last edited by ElMiko; 11-20-2025 at 11:58 PM.
ElMiko is offline   Reply With Quote
Old Yesterday, 09:53 AM   #13
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 9,089
Karma: 6379704
Join Date: Nov 2009
Device: many
Yes, when we changed search to keep its state and stop having to "watch for overlap nonsense", it made Saved Searches much more powerful. So we greatly extended the target list of files that a regex search could target again making it more useful for automation and regular usage.

So the number of settings we needed to save became larger when the search target list was expanded, so we added a "controls" field to the saved searches (and added a ui to set it all) to make saving and restoring theses targets/settings shorthand possible.

That way the saved searches fully saved everything a user may have in their find and replace settings.
KevinH is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
More than 3 Automate List functions ElMiko Sigil 14 06-16-2025 09:48 PM
Search and Replace from a List moldy Editor 37 03-27-2024 09:07 PM
Automate a page split... Find & Replace doesn't work for this LostOnTheLine Sigil 24 11-28-2022 01:55 PM
Automate list and S&R jmurphy Sigil 10 11-02-2022 08:47 AM
Regex in search problems (NOT Search&Replace; the search bar) lairdb Calibre 3 03-15-2017 08:10 PM


All times are GMT -4. The time now is 02:13 PM.


MobileRead.com is a privately owned, operated and funded community.