Variable imaging - detecting the last letter, and more!

59 views
Skip to first unread message

Jay

unread,
Sep 15, 2015, 5:30:00 PM9/15/15
to XMPie Interest Group
Ahoy-hoy,

I'm using the latest XMPie, and am running into a strange problem I've never had to deal with before - an Engish "s."

For some of our variable imaging projects, the name is posessive ("Bob's," "Carl's," etc). Obviously, this makes it problematic when names end in "S" (such as "Charles"). With me so far? Good, because I'm not amazing at explanations here.

Basically, I need the variable passed to the text to create the image to detect if the last letter in the name is "s," and then act accordingly. So, if the name is "Charles," then I need it to return "Charles'" instead of "Charles's".

Probably not a new thing, and I'd imagine someone has a quick explanation, but assuming you can understand what the heck it is I'm trying to say.. Any ideas?

Thank you!

couch

unread,
Sep 15, 2015, 5:59:22 PM9/15/15
to XMPie Interest Group
if (SubString(|->[firstName], Length(Trim(LCase(|->[firstName])))-1, 1) = "s")
{
|->[firstName] & "'"
}
else
{
SubString(|->[firstName],0,Length(|->[firstName])) & "'s" 
}

Jay

unread,
Sep 16, 2015, 5:28:58 PM9/16/15
to XMPie Interest Group
Awesome, looks like I was about halfway there.

Next question - does this pick up the font being used in the uImage PSD file, or do I have to define the font to use when adding the "'s"? If so, how do I do that, where it's using so many different variables?

couch

unread,
Sep 16, 2015, 5:50:20 PM9/16/15
to XMPie Interest Group
The font is set in Photoshop. 
Whatever value you pass into the uImage expression will be used in the image.

Jay

unread,
Sep 16, 2015, 6:22:24 PM9/16/15
to XMPie Interest Group
Kinda-sorta.

I've got two words: let's call them Bob and Terwilliger. Bob is in one font, Terwilliger is in another. Terwilliger is adopting the font properties of Bob, so instead of being in two different fonts, they're stuck with just the one. What am I missing, besides the big picture?

couch

unread,
Sep 16, 2015, 7:04:31 PM9/16/15
to XMPie Interest Group
XMPie takes the font characteristics of the first letter "<" and uses that for the entire line of point text in Photoshop. (If you set copy fitting it will change size or horizontal scale based on the <..> you define.)

If you want two ADORs in the template to have different font, you should use two different pieces of point text.

Jay

unread,
Sep 18, 2015, 1:17:58 PM9/18/15
to XMPie Interest Group
Roger that. Understood.

Over and out.
Reply all
Reply to author
Forward
0 new messages