Help! Rsubstr Issues
Either RSubstr has broken some updates ago or i'm using it incorreclty.
AREN version 4.13p but has been happening for a while now, it used to work to my recollection some updates ago but i cant remember how far back or how long ago.
These attempts are to move the file to a new directory
Filename: abcdefg_hijk-lmnop_qrstuv_wxyz.jpg
output: ..\<Substr:1:_>\<RSubstr:_:_>\<Substr:_:_>
result: ..\abcdefg\hijk-lmnop
expect ..\abcdefg\qrstuv\hijk-lmnop
I've also tried
output: ..\<Substr:1:_>\<RSubstr:5:_>\<Substr:_:_>
result : ..\abcdefg\hijk-lmnop
expect: ..\abcdefg\qrstuv\hijk-lmnop
output: ..\<Substr:1:_>\<RSubstr:6:_>\<Substr:_:_>
result : ..\abcdefg\rstuv\hijk-lmnop
expect: ..\abcdefg\qrstuv\hijk-lmnop
Even in the last output, for some reason, the q or the leading character of the string that i'm trying to isolate gets stripped from the output. I thought i understood this but maybe i'm doing something wrong.
AREN version 4.13p but has been happening for a while now, it used to work to my recollection some updates ago but i cant remember how far back or how long ago.
These attempts are to move the file to a new directory
Filename: abcdefg_hijk-lmnop_qrstuv_wxyz.jpg
output: ..\<Substr:1:_>\<RSubstr:_:_>\<Substr:_:_>
result: ..\abcdefg\hijk-lmnop
expect ..\abcdefg\qrstuv\hijk-lmnop
I've also tried
output: ..\<Substr:1:_>\<RSubstr:5:_>\<Substr:_:_>
result : ..\abcdefg\hijk-lmnop
expect: ..\abcdefg\qrstuv\hijk-lmnop
output: ..\<Substr:1:_>\<RSubstr:6:_>\<Substr:_:_>
result : ..\abcdefg\rstuv\hijk-lmnop
expect: ..\abcdefg\qrstuv\hijk-lmnop
Even in the last output, for some reason, the q or the leading character of the string that i'm trying to isolate gets stripped from the output. I thought i understood this but maybe i'm doing something wrong.
Reply to #1:
Hi Amir,
I can't get <Substr> or <RSubstr> to work as advertised either (ref: https://www.advancedrenamer.com/user_guide/v4/tags_advanced )
And I've seen several reports of similar that I'm not sure were addressed by the developer (I could be wrong about that).
However, it's easy to get a Script Renaming method to move the file to folders per your "expected" example.
Here is the code:
//----------------------------------------------------
let nameParts = item.newBasename.split (/_/);
let newSubPath = `${nameParts[0]}\\${nameParts[2]}\\${nameParts[1]}`;
item.newPath = item.path + newSubPath;
//----------------------------------------------------
Upgrade to version 4.20 and paste that into the "function( index, item)" window and apply.
Leave the "Output folder:" blank.
Regards,
Randy
Hi Amir,
I can't get <Substr> or <RSubstr> to work as advertised either (ref: https://www.advancedrenamer.com/user_guide/v4/tags_advanced )
And I've seen several reports of similar that I'm not sure were addressed by the developer (I could be wrong about that).
However, it's easy to get a Script Renaming method to move the file to folders per your "expected" example.
Here is the code:
//----------------------------------------------------
let nameParts = item.newBasename.split (/_/);
let newSubPath = `${nameParts[0]}\\${nameParts[2]}\\${nameParts[1]}`;
item.newPath = item.path + newSubPath;
//----------------------------------------------------
Upgrade to version 4.20 and paste that into the "function( index, item)" window and apply.
Leave the "Output folder:" blank.
Regards,
Randy
Reply to #2:
I've been avoiding learning how to script in Aren for years, and thank you Randy for tossing me into the shallow end of the pool! Can i trouble you for one more thing? I understand what you have shown me already but how would I direct things into the prior directory with the new sub path? Understanding that would pretty much help me with the rest of my sorting needs.
I've been avoiding learning how to script in Aren for years, and thank you Randy for tossing me into the shallow end of the pool! Can i trouble you for one more thing? I understand what you have shown me already but how would I direct things into the prior directory with the new sub path? Understanding that would pretty much help me with the rest of my sorting needs.
Reply to #3:
Oops! I see that you actually specified that and I ignored it for the "meatier" challenge. Sorry. ;P
Anyway, you would change the second line of code to:
let newSubPath = `..\\${nameParts[0]}\\${nameParts[2]}\\${nameParts[1]}`;
Paths work like you'd expect in code strings but you need to "escape" any slashes. Hence "\\" in the string is a single slash in the file path.
Oops! I see that you actually specified that and I ignored it for the "meatier" challenge. Sorry. ;P
Anyway, you would change the second line of code to:
let newSubPath = `..\\${nameParts[0]}\\${nameParts[2]}\\${nameParts[1]}`;
Paths work like you'd expect in code strings but you need to "escape" any slashes. Hence "\\" in the string is a single slash in the file path.
Reply to #1:
Hi Amir,
If the Substr methods don’t work, you can use the <word:> method instead. For example:
Select Copy or Move in batch mode and insert the following into the output folder field:
..\ <word:1>\ <word:4>\ <word:2:2>
This should give you the result you’re looking for.
Miguel
Hi Amir,
If the Substr methods don’t work, you can use the <word:> method instead. For example:
Select Copy or Move in batch mode and insert the following into the output folder field:
..\ <word:1>\ <word:4>\ <word:2:2>
This should give you the result you’re looking for.
Miguel
Reply to #5:
Good call!
But note that it assumes the number of dashes is constant and that the settings are default-ish. (Both might be valid assumptions for the OP)
Good call!
But note that it assumes the number of dashes is constant and that the settings are default-ish. (Both might be valid assumptions for the OP)