Batch Renamer

A GUI for renaming objects en masse. Looks a bit like the Rename dialog.

See also the code snippet by chozo.

When 'Wildcards' is checked, ? matches one character and * matches one or more characters. In the 'prefix', 'suffix' and 'replace with' fields, # represents a number. Use multiple # characters to set minimum number of digits. To insert a string by key from a wavenote, use the syntax {key[,keySepStr[,listSepStr[,matchCase]]]}, where the optional parameters correspond to those used in StringByKey. String parameters do not have to be quoted. DisplayHelpTopic "StringByKey" for details.

Clicking the column title for current names resorts the names alphanumerically, and you can click in the leftmost column and drag to reorder names.

Project Details

Current Project Release

Batch Renamer IGOR.8.00.x-1.91

Release File: Batch
Version: IGOR.8.00.x-1.91
Version Date: Mon, 03/22/2021 - 02:32 am
Version Major: 1
Version Patch Level: 91
OS Compatibility: Windows Mac-Intel
Release Notes:

Fixes bug that incorrectly resized panel on some screens.

View All Releases

Wow, you have done it already! Excellent job, and with much better code than I could ever write. Here are some features I would find useful:

  • A (don't) match case (for replacement) checkbox
  • A way to reorder the rename list (should template renaming be possible)
  • A template option to give waves consecutive names (e.g., "data###" will give data001, data002 ... etc.)

Really awesome would be to have the option to name waves by some information from the wave's notes, but I have no idea how to implement this. Maybe have a field to give information for a StringByKey search inside the notes?

I also should look more into saving package preferences for my projects...

Thanks, chozo, though I don't believe for a second that the code is any nicer than yours.

This was mostly cobbled together from bits of code I had written for other projects. The tricksy thing is list filtering. The WM wave selector widget has filtering built in, so it's easy to add a setvar to filter the list, but that only fires after you hit enter. If you want the list to respond as you type it gets significantly more complex.

The panel allows you to rename folders and objects within those folders in one action, so reordering the rename list has to be done with care. Maybe I could add column sorting in the listbox. I have code for that - it took me a while to figure out how to do it properly.

I have a feeling that colored text doesn't play nicely with listboxes on Windows, right? Windows uses a really dark blue for selected cells, and changes the text color only for default colored text.

I wonder whether case sensitivity might lead to confusion for users, since Igor is ambivalent about case in object names.

Even if cobbled together, it looks really nice already. Right, case-sensitivity is not so important in Igor, but I thought when replacing parts of names it might be useful to target the letter case to, for example, just replace the second 'd' in "Data_d20" or something. This is how the list-box looks on Win:

The colors are not super pretty (especially with the sub-pixel 'halo' around curved numbers thanks to sub-pixel dithering here on Win10), but everything is readable enough. Also you see that the Prefix and 1 time checkboxes may need a bit of alignment (the prefix controls about 10 units to the left and the time checkbox about 5 units to the right seems good).

Damn, that removes the possibility to complain about missing features in one fell swoop. Excellent work! This is more than most other GUIs are able to provide other than hardcore batch rename utilities. Now the only thing that I have left is to nitpick about the UI. ;) Two things: I noticed that copy-paste always pastes into the filter bar and never into other fields and: The entry fields are quite a bit too tiny to go all out on regEx. :)

I forgot to mention that clicking the column heading for current names resorts the names alphanumerically, and you can click in the first column and drag to reorder. I haven't checked on a pc yet, but I can well imagine that the control layout is ugly. The copy paste bug is fixed.

>  I haven't checked on a pc yet, but I can well imagine that the control layout is ugly.

Yes. This could be taken as but one in the host of examples to demonstrate why Windows needs to fix its UI to copy the elegance in macOS or WaveMetrics needs to use electron to re-code Igor for consistency in UI design on all platforms. :-)

Hi Tony, thank you for the great update! Now the controls look very nice on windows. However, there is still a bug left: The panel keeps inflating when closed and reopened on Windows. Obviously, there is a problem when translating points to pixels (96 dpi on windows), i.e., all panel coordinates get inflated by 1.3333 each time. I get the same problem all the time in the reverse direction (i.e., my tools tend to get too small on Mac). Often a MoveWindow command is the culprit (I really watch out for this command now). Anyway, here is the fix which prevents this:

// resize to restore window size
Variable factor = PanelResolution("BatchRenamerPanel")/ScreenResolution
MoveWindow /W=BatchRenamerPanel*factor,*factor,*factor,*factor

I think there is a mismatch somewhere in the manual. I suspect the notion that the /W=(left,top,right,bottom) in the NewPanel command is in 'points' is just wrong. If I count the pixels I find that this rather sets the size in pixels, which explains the discrepancy to MoveWindow, which set the size really in 'points'. Note that the /W=(left,top,right,bottom) flag for Display seems to be really in points as stated in the manual. Talk about confusing units!

Does this fix it? turns out that MoveWindow isn't needed, ResizeControls takes care of positioning the controls regardless of the coordinates used in NewPanel.



In reply to by chozo

>Now the controls look very nice on windows.

by luck rather than design. keeping setvars and checkboxes on separate lines helps.

I've come across the movewindow madness somewhere before, but forgot all about it.

In the end, the only real solution is to test everything on both Windows and Mac. I now tend to test everything on both win/mac and in both Igor 9 and Igor 6.3 if I change something in panels. Quite tedious, but there is often some small detail which is off.




Igor Pro 8

Learn More

Igor XOP Toolkit

Learn More

Igor NIDAQ Tools MX

Learn More