#1 : 13/04-21 01:38 John Johnson
Posts: 8
|
I have photo shoots on different locations on different dates and would like to use an automated script to insert a location description based on the date of the image taken. The image files have been processed to reflect the date and uniquely indexed based on the date (see below) and I now want to run a script which will insert a given location name based on the specific date of the image. Example as follows:
Current processed file name: 2020_11_02 001.NEF 2020_11_02 002.NEF 2020_11_02 003.NEF 2020_11_06 001.NEF 2020_11_06 002.NEF 2020_11_06 003.NEF 2021_01_26 001.NEF 2021_01_26 002.NEF 2021_01_26 003.NEF 2021_01_26 004.NEF 2021_02_01 001.NEF 2021_02_01 002.NEF Want to achieve this; 2020_11_02 Black Bear 001.NEF 2020_11_02 Black Bear 002.NEF 2020_11_02 Black Bear 003.NEF 2020_11_02 Black Bear 004.NEF 2020_11_06 Library Springs 001.NEF 2020_11_06 Library Springs 002.NEF 2020_11_06 Library Springs 003.NEF 2021_01_26 Rolling Meadows 001.NEF 2021_01_26 Rolling Meadows 002.NEF 2021_01_26 Rolling Meadows 003.NEF 2021_01_26 Morton Arboretum 005.NEF 2021_02_01 Morton Arboretum 001.NEF 2021_02_01 Morton Arboretum 002.NEF Help is much appreciated |
#2 : 13/04-21 09:55 David Lee
Posts: 1125
|
If you only have a limited number of date/location pairs then just use the List replace method with one line for each replacement...
Replace (2020_11_02) with \1 Black Bear (2020_11_06) -> \1 Library Springs (2021_01_26) -> \1 Rolling Meadows (2021_02_01) -> \1 Morton Arboretum Use regular expressions Alternatively you can read the replacement data from two columns of a csv file as explained in my reply to the Forum post at: www.advancedrenamer.com/forum_thread?forum_id=11652 Use the Pre batch script as written (modifying your csv file path as appropriate) and use the following main script: match = item.name.match(/([^ ]*)(.*)/); place = replace[match[1]]; if (place) return match[1] + " " + place + match[2]; |
#3 : 14/04-21 14:30 John Johnson
Posts: 8
|
Reply to #2:
Excellent! Works "like a dream". Thank you very much David. Excellent Support and Fantastic product. Well worth the price.!! |