#1 : 22/08-24 13:21 raf
Posts: 12
|
i am trying to run a advance renamer script that will run a saved preset and will take source+destination paths and inject a variable that i created in an ADD method (in script I added "ADD_VAR"
arenc.exe -e "C:\rename-and-copyto.aren" -p "source_path" -o "destination_path" -s -var "ADD_VAR=text" 2 problems: 1. ADD_VAR. I am not sure I've got this correctly. Is there a tag to add a variable? Do i just write <ADD_VAR> in the tag field? When i run it the filename does not appear to get the "text" in the name 2. Filtering. Manual import allows filtering by text patterns, like for instance "pattern*" How can i enable this functionality. From gpt, it seems like i would add method SCRIPT, then add some code like ``` function returnNewName(index, item) { var fileName = item.name.toLowerCase(); if (fileName.startsWith("py")) { return item.newName; // Keep this file for processing } else { return ""; // Skip this file by returning an empty string } }``` but it doesnt work. I have a bunch of files in the source called pytorch, that i want to apply the script to, but not all the rest which do not start with with py*, for instance. Thanks |
#2 : 22/08-24 16:59 Delta Foxtrot
Posts: 285
|
Reply to #1:
Hi Raf, I'm not sure where you got the "-var" switch, but it wasn't from the user manual. https://www.advancedrenamer.com/user_guide/comma ndline You might find the -msk switch useful. I'm really curious where you've been getting your operating instructions for this program. Don't return "" from a script, that just turns your filename into nothing. Also, once you return from a script you don't retain any information, and there's no way to "eliminate" files from within a script, so just do your logic and processing within the script and be done with it. You can return "item.name" to keep the original name, by the way. EDIT: If previous methods have changed the filenames you don't want changed, you can use "return app.parseTags( '<Name>' ) ;" to change it back to the original name. END EDIT If you just want to return the original filename based on something not being present in the orginal name, you can use the {if} clause in version 4 beta. This allows you to bypass processing on a filename by certain criteria. In previous versions (lacking the {if} clause) I used the following method: Use an add or replace (or newname) method at the start of your method list to add a token (any legal character not found in any of your filenames; most of the alt-0xxx codes fill the bill). Only add the token to files you don't want to change. As the last step replace all filenames containing the token with <Name> to name them back to the original filename. Good luck. If you want to get more specific let us know what you really need. DF |
#3 : 22/08-24 20:08 Miguel
Posts: 136
|
Reply to #1:
Hi raf. As Delta Foltrox said i think that you can accomplish this with 4 version of Aren. Use the new conditional method built in the version 4. https://drive.google.com/file/d/1EVxqzsrvoRoLzIK QxXqdNyyxrRqDF3lq/view?usp=drive_link You can download the version 4 beta here https://www.advancedrenamer.com/download#beta Miguel |