Page 1 of 1

Rename Tool in PowerSwitch - Can I do this?

Posted: Wed Feb 01, 2012 2:22 pm
by mwinker
In one of my flows, I'd like to add the "Die Number" after the the jobname.



Conveniently, the design department names the color used for the die with the die number. Example: foil x2299



If I make a path to [Stats.Colorants] the colorants are indexed with semi-colon separators. (leftside expression)



Can I add something like a reg-exp to the search to grab that entire name of the first instance colorant that includes the word "foil" and add it to the end of the filename.

So my file might read "AB12345-foil x2299"



I've been messing with this a bit but the reg-exps are new to me.



It would be easy if it always showed up as the 3rd colorant indexed but I don't want to count on that. [Stats.Colorants:Index=3]



Am I going at this the right way or do I need to explore the script route?



Thanks,

Mike

Rename Tool in PowerSwitch - Can I do this?

Posted: Wed Feb 01, 2012 4:49 pm
by dkelly
The regular expression "^[w]+" will match the first word, eg. "foil".

Rename Tool in PowerSwitch - Can I do this?

Posted: Thu Feb 02, 2012 2:21 pm
by mwinker
Thanks Dwight, I'm not sure how to use that though. When I put it in the "search" field and update the variable like:



[Stats.Colorants:Search="^[w]+"]



It isolates the first word of each colorant in the list, so I'd still want to isolate and capture "foil x2299" from the list of colorants. And just in case "foil" isn't the first word in the colorant, I'd want to be able to grab that instead.



If I need to, I could search each indexed colorant as a separate "action" of the rename tool. So, Action 1 would search for the word foil in index position 1and would deliver the Full name of that colorant only if "foil" were present in the name. Like looking for a "True or False" condition, and if the condition is "True" then that variable is used for the rename. How I get that expression, I don't know.



Am I approaching this right by trying to get this with a reg-exp?



Thank You,

Mike

Rename Tool in PowerSwitch - Can I do this?

Posted: Thu Feb 02, 2012 2:26 pm
by mwinker
Hmmm. Thinking on what I said in that last post…

It's a bit more convoluted but, If I split paths for each of the indexed colorants with the true or false arguments going into a rename tool on each path, (I'd probably only need 3 or 4 at this point in the flow) I could accomplish this.



More Coffee!

Rename Tool in PowerSwitch - Can I do this?

Posted: Thu Feb 02, 2012 3:09 pm
by rzacherl
Hi Mike,



try this one:



[^;]*foil[^;]*





Best,



Robert

Rename Tool in PowerSwitch - Can I do this?

Posted: Thu Feb 02, 2012 4:08 pm
by mwinker
That's working!



and if I go and edit the string so that there's no separator, I don't get a row of ;;;;;; first.



-[Stats.Colorants:Separator="",Case="upper,Search=[^;]*FOIL[^;]*"]



so that adds to my filename: -X2299 COMBO FOIL



Thanks Robert and Dwight



Mike



Oh yeah, I changed to upper case, too.