Use Exiftools to add a tag with spaces and special characters to an image file - exiftool

When I compare a file that uploads correctly (into Mapillary) and a jpg file that fails in EXIFTOOLS I see that it doesn't have Create Date, Date/Time Original and Modify Date. There are lots of other fields as well but these are the only ones dealing with time.
When I try to use
'.\exiftool(-k).exe' -"Date/Time Original"="2019:10:27 18:14:10.5" Photo_2019_Jul_12_13_38_40_019.jpg
It doesn't let me add the tag (I assume) because it has a '/' in it. It also doesn't allow "Create Date" for example.
How can I create a tag with these?
Some sample files are in https://drive.google.com/drive/folders/1QCQdSvdk0RygfCqqRWaOj-IzBbj17gax?usp=sharing

See ExifTool FAQ #2
"Date/Time Original" isn't the tag name, it's the tag description, which can change depending upon the set language (see the -lang option). Tag names don't have spaces or special characters. The actual tag name to set a value is DateTimeOriginal.
So your command should be
.\exiftool(-k).exe -DateTimeOriginal="2019:10:27 18:14:10.5" Photo_2019_Jul_12_13_38_40_019.jpg
Though take note that DateTimeOriginal doesn't hold a subsecond value. The location for that would be SubSecTimeOriginal. But exiftool does have a shortcut. If you set SubSecDateTimeOriginal, it will set the DateTimeOriginal and SubSecTimeOriginal tags. Also, if you add a time zone to the end of that, it will set OffsetTimeOriginal, where the time zone value is held.
For example:
.\exiftool(-k).exe -SubSecDateTimeOriginal="2019:10:27 18:14:10.5-04:00" Photo_2019_Jul_12_13_38_40_019.jpg

Related

Find exif tags in image by name/value

Is it possible to find and print all exif tags, contained specific word in name/value.
For example I need to find all tags, who has "Unknown" value or all "Nikon*" name tags? Will be nice to do it with exiftool.
You can't list just tags that have a specific value but you can check to see if there exists a tag with the value by checking full groups of tags. For example:
exiftool -if "$EXIF:all=~/Unknown/" -EXIF:all /path/to/files/
With that command, if one of the tags in the EXIF group contains a value that includes "Unknown", then all the EXIF tags will be displayed. You can check against the group All:All but processing will be very slow as it will check against all tags that exiftool knows, not just what is in the file, which numbers in the 10s of thousands.
You can use wildcards when listing tag names. For example, you could use -GPS* and all tags that start with GPS will be listed.

Docvariable with empty string value

In word, I'm using docvariables to manage pluralization.
A VBA macro is changing the value of several docvariables to pluralize / singularize them.
But sometimes I want to use a Docvariable only for enable/disable a 's' suffix.
Problem: I cannot set it to empty string, because it deletes the docvariable.
The field displays an error in word.
So I'm searching a way to achieve this, it could be :
A way to keep a Docvariable existing, with empty string or equivalent value
A field formula which make this job if the variable doesn't exist
Any other workaround would be appreciated.
Thank you
A Document Variable (used in DocVariable field codes) cannot exist if it has no content.
A possibility would be to also store the space in this DocVariable so that it display s[space] or just [space].
Otherwise you may need to write this information to a Bookmark (possibly using a Set field) and display the content using a Ref field.

Exiftool - modify metadata format

Suppose I have 5000 images with following metadata in the LABEL field.
0001 ELEPHANT
0002 ELEPHANT
0003 ELEPHANT
...
4999 ELEPHANT
5000 ELEPHANT
I wish to change the format to:
ELEPHANT-0001
ELEPHANT-0002
ELEPHANT-0003
…
ELEPHANT-4999
ELEPHANT-5000
In other words, I want to do the following for a metadata field of multiple images:
#### NAME —> NAME-####
From what I can gather there could be two ways of doing this
Ignore the current metadata in the images, and reference a (plain text? csv?) file that I prepare separately; or
Read the file's metadata as a string, identify the space and the number preceding the space, save that number, and finally make a new string by concatenating the number and space, and adding a hyphen in between!
Any suggestions?
Expanding upon the answer I gave in the exiftool forums.
The basic command would be
exiftool "-LABEL<${LABEL;s/(\d{4}) (.*)/$2-$1/}" <FileOrDir>
You basically want to copy a tag into the same tag, with some modifications. The option to copy a tag is the less than (or greater than) symbol < or >. A common mistake is to use the equal sign = which is used to assign a static value to a tag.
To do the modification to the tag, it takes the Advance Formatting option, which is actually some in-line perl code. In this example, the tag is treated as a perl string and a regex substitution is used. It matches and captures the first four digits (\d{4}), matches the space (but doesn't capture it), then matches and captures the rest of the tag (.*). The two captures are assigned to the variables $1 and $2, respectively. In the replace half of the substitution $2-$1, the two captures are reversed with the hyphen between them.
To take full advantage of the advance formatting, some basic perl and regex knowledge is helpful.
Once you are sure of the command, you can add -overwrite_original to suppress the generation of backup files and -r to recurse into subdirectories.

Changing the Access date format

In an Access form, I need to use the date output from a date picker field to be used to search for a file in a form. However, the default data format seems to only allow slashes. Although I know the date is being stored as a number in the database.
Put simply, I need Me.myDate to output a legal file name structure, for example, yy-mm-dd. Then I can concatenate that with my file name to search for myfilename_yy-mm-dd
I always get myfilename_yy/mm/dd which is of course unusable as a file name.
Changing the format of the field obviously makes no difference to how the value is stored. What I don't understand is if the date is stored as a number, and the output is shown in the selected format, how I can override the default formatting behaviour used when I query the date.
The Format Function will allow you to format the date as you wish.
An expression to include the formatted date in a filename pattern could look like this ...
"myfilename_" & Format(Me.myDate, "yy-mm-dd") & "*"

How can I identify an OpenXml Paragraph as one I programmatically inserted?

I am programmatically adding an OpenXML paragraph to a Word Document and I need to be able to identify that paragraph as mine later on. Any ideas on how to do this? I have tried inserting an XML comment and extended attributes but when you save the document in word it removes all unknown xml. It doesn't matter if it is an attribute in the paragraph or the run, or an element before the paragraph, just some way I can identify it later on. Also, I do not want this identifier visible in the word document.
Examples of what I could use:
<paragraph id="myParagraph"></paragraph>
<otherelement>myparagraph</otherelement>
<paragraph></paragraph>
Any help would be AWESOME because my head it hurting from the brick wall I have been running into.
Thanks!
Give the paragraph a w:rsidR attribute and assign a unique value to it; if there is no value present when word saves the document it will randomly assign it's own 8-digit hexadecimal value anyway. (The value is not limited to 8 digits or hexadecimal characters. Word will not modify existing RSIDs.)
That being said -- make sure to keep RSID values unique and do NOT modify existing RSID attributes -- they are the unique ID for that paragraph, and if the document splits into multiple versions and a user tries to merge them back together those RSIDs are used to determine what paragraphs have changed.
(Also note that runs have RSIDs as well.)
If the user modifies the paragraph, the RSID of that paragraph may change.
The alternate option is to use Custom XML: http://msdn.microsoft.com/en-us/library/bb608618.aspx
Use stylename in paragraph properties.
or try this one
http://msdn.microsoft.com/en-us/library/office/hh674468.aspx
Hope this helps.