Rename Tool in PowerSwitch - Can I do this?

Post Reply
mwinker
Member
Posts: 37
Joined: Wed Dec 22, 2010 2:36 am

Rename Tool in PowerSwitch - Can I do this?

Post 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
dkelly
TOP CONTRIBUTOR
Posts: 628
Joined: Mon Nov 29, 2010 8:45 pm
Location: Alpharetta GA USA
Contact:

Rename Tool in PowerSwitch - Can I do this?

Post by dkelly »

The regular expression "^[w]+" will match the first word, eg. "foil".
mwinker
Member
Posts: 37
Joined: Wed Dec 22, 2010 2:36 am

Rename Tool in PowerSwitch - Can I do this?

Post 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
mwinker
Member
Posts: 37
Joined: Wed Dec 22, 2010 2:36 am

Rename Tool in PowerSwitch - Can I do this?

Post 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!
rzacherl
Member
Posts: 36
Joined: Mon Mar 21, 2011 3:29 pm

Rename Tool in PowerSwitch - Can I do this?

Post by rzacherl »

Hi Mike,



try this one:



[^;]*foil[^;]*





Best,



Robert
mwinker
Member
Posts: 37
Joined: Wed Dec 22, 2010 2:36 am

Rename Tool in PowerSwitch - Can I do this?

Post 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.
Post Reply