Name Mangler makes most renaming tasks as easy as choosing your desired action from a pop-up menu, then configuring a few options for the chosen action. For example, the Change Case action offers the ability to change filenames to lowercase, to uppercase, or to title case.
I currently use Name Mangler for this with some find/replace and Reg Ex stuff. But Name mangler isn't scriptable, and what I would like to do is add a hazel rule that would watch for the folder and automatically run the naming convention without me having to do it manually.
Sorry for the late response. The endless notifications were caused by the macro being triggered every time the newly renamed files were added to the folder it watches. I'm not sure why it didn't behave that way when I tested it before uploading it, but I can verify that I'm seeing the same problem you did now. As you surmised, the easiest way to fix it is to have the macro move the renamed files to a folder other than the one it watches, so if your workflow can work like that, I would certainly recommend it. Doing so also lets us remove the "Move to Desktop Temporarily" step, which was only in place to workaround an implementation in KM's "move file" action that prevents it from overwriting files with the same name (regardless of capitalization).
As for the regex errors, those weren't important, as they were only telling you that the current file name failed to match the regex pattern used to look for text to capitalize, which is not a big deal since not every file renamed in this macro falls under that pattern. The easiest way around this is to configure those actions to no longer show errors for failing to match that pattern, so that's what I've done in this newer version. Let me know how this one works, and if you run into issues with it as well, please be sure to post the modified macro so I can see what might be going wrong.
And it lists the folder I am trying to move items to. If I drag them in individually, it works as expected. I have a folder called Staging for the macro to monitor and a folder called Process for it to move the new files to. Another funny thing is in the Process folder, I can see the file name for the audio file, but it is greyed out.
Hmm. Assuming that kevin in these file paths is the name of an external drive and not the path to your user folder, nothing seems off at first glance (though I did notice that the target folder is designated as 1 To Process rather than just Process as you said in your earlier post). So if the paths aren't the problem, the next thing to try is a semaphore lock, so that the macro executes in sequence rather than parallel, which should (theoretically at least) prevent any file renaming collisions that might be causing an error like this. Try this version out and see if it makes any difference:
Your assumptions are correct on the folder names. And Kevin is an external hard drive - so the Paths are not the problem. I ran this again, with the same issues. It gives me the same error - "because the destination already exists..."
One additional thing is is doing now though is changing the name in the Staging folder, just not moving it. And I am getting the dimmed file names in the Process folder. So it moves the first one, names the others and fails to move them. One at a time still works as expected.
If you need to rename several files at once, this is the application you have always been looking for. Name Mangler is a batch file renamer that supports the following renaming tasks: Find and Replace (including support for regular expressions); Number Sequentially; Change Case; Set Extension; Add Prefix/Suffix; Remove/Insert Characters.
idapython and IDA Pro itself only allow me to enter basic C-ish function names. If I enter disallowed symbols (e.g. the scope resolution operator), they're replaced with underscores. However, if I enter a mangled name by hand (e.g. __ZN9IOService15powerChangeDoneEm), IDA Pro will prettify this for me.
Hence my question: how can I generate mangled names to pass through idapython? Is there a name-mangling library available? Is one available in Python? Is my only hope to tear the mangling functionality out of g++ and work around that?
By necessity this uses regexes twice: one for parsing the date and constructing most of the name, and this for finding and padding the page number. Perhaps the reason why I missed this approach by myself is that in the Python code, the regex search is performed once and the groups placed in this format string:
The name mangling schemes of C++ compilers vary, but they are documented publicly. Why aren't linkers made to decode a mangled symbol from an object file and attempt to find a mangled version via any of the mangling conventions across the other object files/static libraries? If linkers could do this, wouldn't it help alleviate the problem with C++ libraries that they have to be re-compiled by each compiler to have symbols that can be resolved?
The name mangling scheme is only a tiny part of the ABI. Calling conventions, structure padding, vtable contents, sizes and internal layout of non-POD classes, etc. also vary among compilers. Getting past the differences in name mangling doesn't help with that, it just means silencing a link-time diagnostic for a condition (ABI mismatch) that's bound to lead to silent run-time errors (object slicing, bogus parameters, overwriting unrelated data, disagreeing which pieces of an object are to be used for what purpose, and many more).
I think name mangling mismatch is good as having an uniform name mangling or auto detection name mangler/mangler could create havoc by linking objects of different kind which would otherwise be incomparable in regards to calling convention, structure padding and alignment, and others as mentioned in the previous two questions.
Unfortunately, these are all run-time mismatch and a linker could seldom handle these scenarios. Thus thankfully, because of name mangling mismatch, linkers can refrain from linking objects of different ABI.
We recently reduced the size of Visual Studio Code's shipped JavaScript by 20%. That works out to a little over 3.9 MB saved. Sure that's less than some of the individual gifs from our release notes, but that's still nothing to sniff at! Not only does this reduction mean less code you need to download and store on disk, it also improves startup time because less source code has to be scanned before the JavaScript is run. Not too shabby considering we got this reduction without deleting any code and without any major refactorings in our codebase. Instead all it took was a new build step: name mangling.
While debugging our minified source code on vscode.dev last year though, I noticed something surprising: our minified JavaScript still included tons of long identifier names, such as extensionIgnoredRecommendationsService. This surprised me. I assumed esbuild would have already shortened these identifiers. And it turns out esbuild actually does shorten identifiers in some cases through a process called "mangling" (a term JavaScript tools likely borrowed from an only roughly similar process for compiled languages).
Since JavaScript is shipped as source text, reducing the length of identifier names actually decreases the program's size. I know that optimization probably seems more than a little silly if you're coming from a compiled language, but here in the wonderful world of JavaScript we gladly take wins like this wherever we can find them!
Now before you rush out to rename all of your variables to single letters, I want to stress that optimizations like this need to be approached cautiously. If a potential optimization makes your source code less readable or maintainable, or requires significant manual work, it's almost never worth it unless it delivers truly spectacular improvements. Shaving off a few bytes here and there is nice but hardly qualifies as spectacular.
Even though esbuild implements mangling, by default it only mangles names when it is confident that mangling won't change the behavior of the code. After all, having a bundler break your code really stinks. In practice, this means that esbuild mangles local variable names and argument names. This is safe unless your code is doing some truly absurd things (in which case, you likely have far bigger issues than code size to worry about).
Despite this, I couldn't shake the feeling that we must be able to do better in the VS Code codebase. If we couldn't mangle every name, perhaps we could at least find some subset names we safely could.
Looking back over our minified sources, another thing that jumped out at me was how many long names I saw starting with _. By convention, this indicates a private property. Surely private properties can be safely mangled and code outside of the class would be none the wiser, right? And wait, shouldn't esbuild be doing this already for us? Yet I knew that the folks who wrote esbuild are no slouches. If esbuild wasn't mangling private properties, it was almost certainly for good reason.
Hopefully your code isn't doing questionable things like this directly, but carelessly changing property names can potentially bite you in plenty of fun unexpected ways such as with object spreads, serialization, and when distinct classes share common property names.
Next we discovered that esbuild can selectively mangle properties that match a given regular expression. However, this regular expression only matches against the identifier name. While this meant that we couldn't know if the property was declared private in TypeScript, we could try mangling all properties starting with _, which we hoped would only include private and protected properties.
Unfortunately, mangling based just on the names has some serious drawbacks, including requiring that all private properties in our codebase start with _. The VS Code codebase does not follow this naming convention consistently, and there are also a few places where we have public properties that start with _ (typically this is done when a property needs to be accessible externally but shouldn't be treated as API, such as in tests).
aa06259810