Author Topic: Code Replacement  (Read 5512 times)

Offline emccainaz

  • Newcomer
  • *
  • Posts: 42
    • View Profile
Code Replacement
« on: December 21, 2012, 09:25:47 AM »
Hi,

I'm using PM 4.6.9 on Windows 7 Professional, Service Pack 1.

I've looked at several of the posts about Code Replacement and have tried several different ways to see if I can get it to work with no luck. I'm attaching screen shots of the Stationery Pad with the code replacement variables in the fields and a shot of what the IPTC info looks like for the image after I run the Stationery Pad. I have tried several different formats of text - all tab-delimited: one directly from Excel, and two others with NotePad, including one with UTF-8 encoding. I still can't get it to work. What am I doing wrong?

Also, I am attaching a snippet of the data file to show you how that is set up.

[attachment deleted by admin]

Offline Kirk Baker

  • Senior Software Engineer
  • Camera Bits Staff
  • Superhero Member
  • *****
  • Posts: 24730
    • View Profile
    • Camera Bits, Inc.
Re: Code Replacement
« Reply #1 on: December 21, 2012, 10:25:29 AM »
I've looked at several of the posts about Code Replacement and have tried several different ways to see if I can get it to work with no luck. I'm attaching screen shots of the Stationery Pad with the code replacement variables in the fields and a shot of what the IPTC info looks like for the image after I run the Stationery Pad. I have tried several different formats of text - all tab-delimited: one directly from Excel, and two others with NotePad, including one with UTF-8 encoding. I still can't get it to work. What am I doing wrong?

What is your Code Replacement delimiter?  '\' is the default, what is yours set to now?
I looked at your file and you should be using only selectors up to 5, not 6 since your data only has 5 columns beyond the code column.

-Kirk

Offline emccainaz

  • Newcomer
  • *
  • Posts: 42
    • View Profile
Re: Code Replacement
« Reply #2 on: December 21, 2012, 12:20:05 PM »
I'm using the default delimiter "\". If I have one too many (or too few) columns, will it prevent the Code Replacement from working at all?

Edward

Offline Hayo Baan

  • Uber Member
  • ******
  • Posts: 2552
  • Professional Photographer & Software Developer
    • View Profile
    • Hayo Baan - Photography
Re: Code Replacement
« Reply #3 on: December 21, 2012, 12:28:41 PM »
Edward,

Are you sure the file names you are using are present in the code replacement file? In the sample you showed the naming convention looks completely different from what your code replacement looks like.
Hayo Baan - Photography
Web: www.hayobaan.nl

Offline emccainaz

  • Newcomer
  • *
  • Posts: 42
    • View Profile
Re: Code Replacement
« Reply #4 on: December 21, 2012, 02:27:53 PM »
I may have had the wrong data, but I've fixed that, but am still not getting Code Replacement to work. Here again are my thumbnails, Stationery Pad, view of the IPTC info for an image and the tab-delimited data. What am I doing wrong here?

Thanks,

Edward McCain
Center for Creative Photography
www.creativephotography.org

[attachment deleted by admin]

Offline Kirk Baker

  • Senior Software Engineer
  • Camera Bits Staff
  • Superhero Member
  • *****
  • Posts: 24730
    • View Profile
    • Camera Bits, Inc.
Re: Code Replacement
« Reply #5 on: December 21, 2012, 03:17:48 PM »
Edward,

I may have had the wrong data, but I've fixed that, but am still not getting Code Replacement to work. Here again are my thumbnails, Stationery Pad, view of the IPTC info for an image and the tab-delimited data. What am I doing wrong here?

If you create an extra line in your text file like so:
test[tab]value

and reload it in the Code Replacement dialog, and then in the IPTC Info (not IPTC Stationery) enter:

\test\

does it not replace the above with "value" ?

I looked at your example IPTC Info and your text file and "76024000_a.JPG" does not exist.  Make sure your filen ames are listed in your code replacement file.  But please also do the above test and make sure even the simplest code replacement works for you.

-Kirk
« Last Edit: December 21, 2012, 03:22:07 PM by Kirk Baker »

Offline emccainaz

  • Newcomer
  • *
  • Posts: 42
    • View Profile
Re: Code Replacement
« Reply #6 on: December 21, 2012, 03:33:09 PM »
If you create an extra line in your text file like so:
test[tab]value and reload it in the Code Replacement dialog, and then in the IPTC Info (not IPTC Stationery) enter:

\test\

does it not replace the above with "value" ?

I looked at your example IPTC Info and your text file and "76024000_a.JPG" does not exist.  Make sure your filen ames are listed in your code replacement file.  But please also do the above test and make sure even the simplest code replacement works for you.

-Kirk

Yes, I got the test to work. I can see "value" now. Sorry about the fields names. I will go back and fix that and see what happens.

Thanks,

Edward
Center for Creative Photography

Offline emccainaz

  • Newcomer
  • *
  • Posts: 42
    • View Profile
Re: Code Replacement
« Reply #7 on: December 27, 2012, 01:36:14 PM »
Yeah! I have it working now. I still have a few things to figure out, though:

1. Can I edit or adjust the date field using Code Replacement?

2. Is there a way I can use the Code Replacement when I have a main file and two derivative files (a TIFF and two JPEGs) and not have to create a separate record for all three - just make one filename and apply it to all three that have the same number before the extension? What about if the file number stays the same, but I have added a text suffix?

Thanks for all your help.

Edward McCain
Center for Creative Photography


Offline Kirk Baker

  • Senior Software Engineer
  • Camera Bits Staff
  • Superhero Member
  • *****
  • Posts: 24730
    • View Profile
    • Camera Bits, Inc.
Re: Code Replacement
« Reply #8 on: December 27, 2012, 06:00:45 PM »
Edward,

Yeah! I have it working now. I still have a few things to figure out, though:

1. Can I edit or adjust the date field using Code Replacement?

No.

Quote from: emccainaz
2. Is there a way I can use the Code Replacement when I have a main file and two derivative files (a TIFF and two JPEGs) and not have to create a separate record for all three - just make one filename and apply it to all three that have the same number before the extension? What about if the file number stays the same, but I have added a text suffix?

Sure.  Use {filenamebase} instead of {filename} for your Code Replacement lookups and make your codes only be the base name instead of the full file name.

-Kirk

Offline emccainaz

  • Newcomer
  • *
  • Posts: 42
    • View Profile
Re: Code Replacement
« Reply #9 on: December 28, 2012, 08:37:10 AM »
Quote from: emccainaz
2. Is there a way I can use the Code Replacement when I have a main file and two derivative files (a TIFF and two JPEGs) and not have to create a separate record for all three - just make one filename and apply it to all three that have the same number before the extension? What about if the file number stays the same, but I have added a text suffix?

Sure.  Use {filenamebase} instead of {filename} for your Code Replacement lookups and make your codes only be the base name instead of the full file name.

-Kirk
[/quote]

Things are moving along nicely now thanks to your help, Kirk. Thanks so much.

I do have a situation where some files have an extension added to the filename, usually a letter (e.g. m = master or t = text). This is always at the end of the filename. Is there a way to just do a "contains" search on the first part of the filename and use that for the code?

Thanks,

Edward

Offline Kirk Baker

  • Senior Software Engineer
  • Camera Bits Staff
  • Superhero Member
  • *****
  • Posts: 24730
    • View Profile
    • Camera Bits, Inc.
Re: Code Replacement
« Reply #10 on: December 28, 2012, 08:50:26 AM »
Edward,

Quote from: emccainaz
2. Is there a way I can use the Code Replacement when I have a main file and two derivative files (a TIFF and two JPEGs) and not have to create a separate record for all three - just make one filename and apply it to all three that have the same number before the extension? What about if the file number stays the same, but I have added a text suffix?
Quote from: Kirk Baker
Sure.  Use {filenamebase} instead of {filename} for your Code Replacement lookups and make your codes only be the base name instead of the full file name.

Things are moving along nicely now thanks to your help, Kirk. Thanks so much.

I do have a situation where some files have an extension added to the filename, usually a letter (e.g. m = master or t = text). This is always at the end of the filename. Is there a way to just do a "contains" search on the first part of the filename and use that for the code?

Not quite, but you can use variable substring extraction.  Try:

{filenamebase:0,#of similar characters in the base filename}

Of course this won't work if your filenames don't have a consistent length.

-Kirk

Offline emccainaz

  • Newcomer
  • *
  • Posts: 42
    • View Profile
Re: Code Replacement
« Reply #11 on: December 28, 2012, 09:05:13 AM »
Quote
Not quite, but you can use variable substring extraction.  Try:

{filenamebase:0,#of similar characters in the base filename}

Of course this won't work if your filenames don't have a consistent length.

-Kirk

Damn you are good! That did the trick. Wow, thanks so much. I love Photo Mechanic - especially this forum!!!

Edward McCain
Center for Creative Photography