Author Topic: PM 4.6.3 corrupts keywords in Stationery Pad  (Read 5610 times)

Offline DaveTheC

  • Newcomer
  • *
  • Posts: 11
    • View Profile
PM 4.6.3 corrupts keywords in Stationery Pad
« on: February 13, 2010, 07:01:20 PM »
I am using PM 4.6.3 on Windows XP SP3

I have a Stationery Pad that defines this expression to process the filename "donation2010_DEP03_05.tif"

{filenamebase:-13,4} Donations Deposit {filenamebase:-5,2} Page {filenamebase:-2,2}

and this, when applied, results in a caption of

2010 Donations Deposit 03 Page 05

Works great, so I do the same for the keywords:

Clinic, {filenamebase:-13, 2}, deposit_{filenamebase:-5,2}, DEPOSIT{filenamebase:-5,2}, donation, Page_{filenamebase:-2,2}, SMCORG

and I expect the keywords:

Clinic, 2010, deposit_03, DEPOSIT03, donation, Page_05, SMCORG

instead I get

Clinic, 20, deposit_05-04, SMCORG

and, reopening the Stationery Pad shows the expression:

Clinic, {filenamebase:-13, 2}, deposit_{filenamebase:-5, DEPOSIT{filenamebase:-5, donation, Page_{filenamebase:-2}, SMCORG

Note how the 2nd arg for {filenamebase:-5,2} and the closing brace have been removed; this wrecks the expression.

Any time the Pad is saved, this corruption occurs. Save... and Load..., or even saving it to a snapshot causes the expression to change. If I select an image, open Stationery Pad, fix the expression, and press "Apply to selected", it works - once. A second time fails and opening the Stationery Pad to inspect it reveals the corrupted expression.

There is a related topic at http://forums.camerabits.com/index.php?topic=4999.0, but this related to changing a colon into a pipe character, a defect fixed in 4.6.3. The pipe is fixed; the above issue happens in both 4.6.3 and 4.6.2.1.

It is weird that only these specific expressions are messed up. Am I missing a setting somewhere?

Offline DaveTheC

  • Newcomer
  • *
  • Posts: 11
    • View Profile
Addendum : Edit Keywords dialog similar
« Reply #1 on: February 13, 2010, 07:12:37 PM »
I found if I rewrite the expression with leading zeros on all the numeric arguments, e.g.

Clinic, {filenamebase:-000013, 0002}, deposit_{filenamebase:-000005, 000002}, DEPOSIT{filenamebase:-00005, 00002}, donation, Page_{filenamebase:-00002, 000002 }, SMCORG

It applies the correct keywords multiple times and saves and loads.

Looks like a unit test is in order testing the single-digit two-argument handling in keywords...assuming I am supposed to be able to do this.

ALSO - in the Stationery Pad dialog, with the previous expression entered, open the "Edit Keywords..." dialog and see what happens with the keyword list. The 2nd arguments are stripped and dropped in as new keywords.

Offline Kirk Baker

  • Senior Software Engineer
  • Camera Bits Staff
  • Superhero Member
  • *****
  • Posts: 24731
    • View Profile
    • Camera Bits, Inc.
Re: Addendum : Edit Keywords dialog similar
« Reply #2 on: February 13, 2010, 08:21:38 PM »
Dave,

I found if I rewrite the expression with leading zeros on all the numeric arguments, e.g.

Clinic, {filenamebase:-000013, 0002}, deposit_{filenamebase:-000005, 000002}, DEPOSIT{filenamebase:-00005, 00002}, donation, Page_{filenamebase:-00002, 000002 }, SMCORG

It applies the correct keywords multiple times and saves and loads.

Looks like a unit test is in order testing the single-digit two-argument handling in keywords...assuming I am supposed to be able to do this.

ALSO - in the Stationery Pad dialog, with the previous expression entered, open the "Edit Keywords..." dialog and see what happens with the keyword list. The 2nd arguments are stripped and dropped in as new keywords.

Thanks for the heads-up on this.  I'll look into it.

-Kirk

Offline Kirk Baker

  • Senior Software Engineer
  • Camera Bits Staff
  • Superhero Member
  • *****
  • Posts: 24731
    • View Profile
    • Camera Bits, Inc.
Re: Addendum : Edit Keywords dialog similar
« Reply #3 on: February 13, 2010, 09:21:27 PM »
Dave,

I found if I rewrite the expression with leading zeros on all the numeric arguments, e.g.

Clinic, {filenamebase:-000013, 0002}, deposit_{filenamebase:-000005, 000002}, DEPOSIT{filenamebase:-00005, 00002}, donation, Page_{filenamebase:-00002, 000002 }, SMCORG

It applies the correct keywords multiple times and saves and loads.

Looks like a unit test is in order testing the single-digit two-argument handling in keywords...assuming I am supposed to be able to do this.

ALSO - in the Stationery Pad dialog, with the previous expression entered, open the "Edit Keywords..." dialog and see what happens with the keyword list. The 2nd arguments are stripped and dropped in as new keywords.

I found the problem and have fixed it.  The fix will appear in the next update to Photo Mechanic.

In the meantime, if you change your repeating fields separator from comma to semi-colon, the problem should go away.  You can change this setting in the IPTC/XMP tab of the preferences dialog.

Please note that repeating fields, like keywords and caption writers, never allow the same item to appear more than once in their lists.  So if you used {filenamebase:-5,2} twice in the keywords field, it would only exist once when saved no matter what the variable might evaluate to.  Your examples never repeated the same expressions, but I thought you should know this detail.

-Kirk

Offline DaveTheC

  • Newcomer
  • *
  • Posts: 11
    • View Profile
Side effect of changing repeating fields separator character
« Reply #4 on: February 14, 2010, 02:13:35 PM »
Boy, don't you ever take the day off?

Thanks for the info on the separator. Changing the option does have one side effect you might know about or not:

So the expression is this:
Clinic, {filenamebase:-000013,4}, deposit_{filenamebase:-000005,000002}, ...

I changed the separator to semicolon and the expression is now showing as:

Clinic; {filenamebase:-000013;4}; deposit_{filenamebase:-000005;000002}; ...

So ALL the semicolons are replaced, not just the ones separating keywords. Not deadly, but I was not looking for it and was surprised. Just had to fix the commas between args.

Thanks again!




Offline Kirk Baker

  • Senior Software Engineer
  • Camera Bits Staff
  • Superhero Member
  • *****
  • Posts: 24731
    • View Profile
    • Camera Bits, Inc.
Re: Side effect of changing repeating fields separator character
« Reply #5 on: February 14, 2010, 02:27:49 PM »
Boy, don't you ever take the day off?

Thanks for the info on the separator. Changing the option does have one side effect you might know about or not:

So the expression is this:
Clinic, {filenamebase:-000013,4}, deposit_{filenamebase:-000005,000002}, ...

I changed the separator to semicolon and the expression is now showing as:

Clinic; {filenamebase:-000013;4}; deposit_{filenamebase:-000005;000002}; ...

So ALL the semicolons are replaced, not just the ones separating keywords. Not deadly, but I was not looking for it and was surprised. Just had to fix the commas between args.

Thanks again!

Yes, you'd have to fix that issue one time, but it shouldn't continue to happen.

-Kirk