Sorting odd and even pages

Post Reply
frode
Newbie
Posts: 2
Joined: Mon Mar 07, 2011 4:51 pm

Sorting odd and even pages

Post by frode »

Hi!



I'm looking for a script that can replace my "condition with variables". We receive single paged pdf's and the name of the file determine if it's a odd or even page.



I have created a "condition with variables", but I assume this can be done in a script instead. We are using PowerSwitch.



The condition with variables goes like this (even pages):



Job Name Contains 02.pdf

OR

Job Name Contains 04.pdf

OR

Job Name Contains 06.pdf

and so on...



I'm a newbie regarding scripts but are fascinated about the possibilities, and are eager to understand more :) Therefore it would be great if someone in this forum could help me.



Kind regards

Frode Nordeide
davidvd
Newbie
Posts: 9
Joined: Fri Feb 18, 2011 11:45 am

Sorting odd and even pages

Post by davidvd »

Frode,



You can for sure do this with a script, but why would you go there? I'm relatively certain you can also accomplish what you want with a simple file name filter using regular expressions and that wouldn't involve scripting at all.



I'm not an expert on writing regular expressions without trying them, but something like this:



".*[24680].pdf"



would match any filename that ends on "2.pdf", "4.pdf" and so on.



David.



frode wrote: Hi!



I'm looking for a script that can replace my "condition with variables". We receive single paged pdf's and the name of the file determine if it's a odd or even page.



I have created a "condition with variables", but I assume this can be done in a script instead. We are using PowerSwitch.



The condition with variables goes like this (even pages):



Job Name Contains 02.pdf

OR

Job Name Contains 04.pdf

OR

Job Name Contains 06.pdf

and so on...



I'm a newbie regarding scripts but are fascinated about the possibilities, and are eager to understand more :) Therefore it would be great if someone in this forum could help me.



Kind regards

Frode Nordeide
frode
Newbie
Posts: 2
Joined: Mon Mar 07, 2011 4:51 pm

Sorting odd and even pages

Post by frode »

Hi David,



".[24680].pdf" did it, perfect!!



But that's nothing compared to the fact that your answer gave me the key to understand regular expressions, hurray!



Thanks a lot!



Frode
davidvd
Newbie
Posts: 9
Joined: Fri Feb 18, 2011 11:45 am

Sorting odd and even pages

Post by davidvd »

My pleasure!



There are a couple of very good websites regarding regular expressions around, even including (I seem to remember) sites that let you try things out and stuff like that.

David.
Post Reply