Macros
macros are defined as name value pairs, where a value replaces the name during the barcodereadercli session this process is called macro expansion macros are used specify names of input and output file/folder names select data presented in the output macro format and expansion rules in most cases, a macro is referenced by its name enclosed in curly brackets \<font color="#eb144c">`{macro name}`\</font> macro names are case insensitive general macro references format is \<font color="#eb144c">`{namespace macro name?/format}`\</font> where \<font color="#eb144c">`namespace `\</font> optional namespace to distinguish macros with the same name defined in multiple categories \<font color="#eb144c">`macro name`\</font> the required name of a macro \<font color="#eb144c">`?`\</font> optional mark to expand undefined macro to an empty string without this mark, an undefined macro causes a runtime error \<font color="#eb144c">`|format`\</font> optional macro expansion control available formats \<font color="#eb144c">`#xn`\</font> duplicate macro value n times \<font color="#eb144c">`#n` \</font> expands to the name of the macro \<font color="#eb144c">`#v`\</font> expands to the value of the macro examples \<font color="#eb144c">`{tab|#x3}` \</font> expands to 3 tab characters \<font color="#eb144c">`{dob?|#n is #v}`\</font> expands to a string \<font color="#eb144c">`dob is` `user date of birth`\</font> , if the current barcode contains driver's license data; otherwise, it expands to an empty string \<font color="#eb144c">`{path temp}{path sep}myoutput xml`\</font> expands to a \<font color="#0c121d">`myoutput xml`\</font> file path located in a temporary folder, e g /tmp/myoutput xml \<font color="#eb144c">`{bc page}` \</font> expands to the page number in a file, where a barcode is located macro categories session macros the session macros remain constant in the course of the barcodereadercli session the namespace for these macros is \<font color="#eb144c">`prg `\</font> name value description \<font color="#eb144c">`path tmp`\</font> system temporary folder path (without terminating path separator} \<font color="#eb144c">`path sep`\</font> path separator character \ on windows, / on linux \<font color="#eb144c">`host`\</font> host computer name \<font color="#eb144c">`app filename`\</font> barcodereadercli file name \<font color="#eb144c">`app version`\</font> barcodereadercli version \<font color="#eb144c">`start date`\</font> session start date format yyyy mm dd \<font color="#eb144c">`start time`\</font> session start time format hh\ mm\ ss \<font color="#eb144c">`nl`\</font> new line character \<font color="#eb144c">`cr`\</font> carriage return character \<font color="#eb144c">`eol`\</font> carriage return + new line characters \<font color="#eb144c">`tab`\</font> tab character \<font color="#eb144c">`bom`\</font> utf 8 byte order mark (bom) environment variables selected environmental variables are converted to a macro the namespace for these macros is \<font color="#eb144c">`env `\</font> user macros the user macros are defined using \<font color="#eb144c"> ` d="``macro name=macro value"`\</font> option on a command line or in the configuration file the namespace for these macros is \<font color="#eb144c">`user `\</font> the value of user macros referenced in filename options can reference other user macros (recursive expansion ) source macros the source macros are associated with the currently processed source the namespace for these macros is \<font color="#eb144c">`source `\</font> name value description \<font color="#eb144c">`path`\</font> source path specified on a command line \<font color="#eb144c">`type`\</font> source type file , folder , url \<font color="#eb144c">`files`\</font> number of files found in the source \<font color="#eb144c">`bc count`\</font> total number of found barcodes file macros the file macros are associated with the currently processed image file the namespace for these macros is \<font color="#eb144c">`file `\</font> name value description \<font color="#eb144c">`path`\</font> image file path \<font color="#eb144c">`filename`\</font> filename section of path \<font color="#eb144c">`basename`\</font> filename without extension \<font color="#eb144c">`ext`\</font> the extension portion of the filename \<font color="#eb144c">`folder`\</font> path to a folder containing the image file \<font color="#eb144c">`pages`\</font> number of pages in a file \<font color="#eb144c">`format`\</font> image file format \<font color="#eb144c">`size`\</font> size of image file \<font color="#eb144c">`bc count`\</font> total number of found barcodes page macros the page macros are associated with the currently processed image page the namespace for these macros is \<font color="#eb144c">`page `\</font> name value description \<font color="#eb144c">`page`\</font> page number (1 based) \<font color="#eb144c">`bpp`\</font> bits per pixel \<font color="#eb144c">`width`\</font> page width in pixels \<font color="#eb144c">`height`\</font> page height in pixels \<font color="#eb144c">`hdpi`\</font> horizontal dpi \<font color="#eb144c">`vdpi`\</font> vertical dpi \<font color="#eb144c">`compr`\</font> page compression \<font color="#eb144c">`path`\</font> path to the image file containing this page \<font color="#eb144c">`bc count`\</font> total number of found barcodes barcode macros the barcode macros are associated with the currently processed barcode the namespace for these macros is \<font color="#eb144c">`bc `\</font> name value description \<font color="#eb144c">`ind`\</font> barcode index on a page \<font color="#eb144c">`text`\</font> barcode text value as utf 8 string \<font color="#eb144c">`data`\</font> barcode value as a byte array encoded as base 64 string \<font color="#eb144c">`length`\</font> barcode value length \<font color="#eb144c">`type`\</font> barcode type \<font color="#eb144c">`rotation`\</font> barcode rotation \<font color="#eb144c">`encoding`\</font> the encoding used to convert barcode data to utf 8 text \<font color="#eb144c">`tbr`\</font> tbr code used to read this barcode (not present if code was not set) \<font color="#eb144c">`path`\</font> image file path \<font color="#eb144c">`abspath`\</font> image file absolute path \<font color="#eb144c">`page`\</font> page number (1 based) \<font color="#eb144c">`mod`\</font> barcode module size in pixels \<font color="#eb144c">`skew`\</font> barcode skew \<font color="#eb144c">`rectangle left`\</font> the left coordinate of the encompassing rectangle \<font color="#eb144c">`rectangle top`\</font> the top coordinate of the encompassing rectangle \<font color="#eb144c">`rectangle right`\</font> the right coordinate of the encompassing rectangle \<font color="#eb144c">`rectangle bottom`\</font> the bottom coordinate of the encompassing rectangle \<font color="#eb144c">`corners tl x`\</font> x coordinate of the top left corner \<font color="#eb144c">`corners tl y`\</font> y coordinate of the top left corner \<font color="#eb144c">`corners tr x`\</font> x coordinate of the top right corner \<font color="#eb144c">`corners tr y`\</font> y coordinate of the top right corner \<font color="#eb144c">`corners bl x`\</font> x coordinate of the bottom left corner \<font color="#eb144c">`corners bl y`\</font> y coordinate of the bottom left corner \<font color="#eb144c">`corners br x`\</font> x coordinate of the bottom right corner \<font color="#eb144c">`corners br y`\</font> y coordinate of the bottom right corner driver's license macros the driver's license macros are associated with the currently processed barcode; it contains driver's license or id card data the namespace for these macros is \<font color="#eb144c">`dl `\</font> name value description \<font color="#eb144c">`last`\</font> cardholder family name \<font color="#eb144c">`first`\</font> cardholder first name \<font color="#eb144c">`middle`\</font> cardholder middle name \<font color="#eb144c">`dob`\</font> cardholder's date of birth \<font color="#eb144c">`eyes`\</font> cardholder eyes color \<font color="#eb144c">`hair`\</font> cardholder hair color \<font color="#eb144c">`sex`\</font> cardholder sex \<font color="#eb144c">`height`\</font> cardholder height in ft and inch \<font color="#eb144c">`weight`\</font> cardholder weight in pounds \<font color="#eb144c">`street`\</font> cardholder street address \<font color="#eb144c">`city`\</font> cardholder city \<font color="#eb144c">`state`\</font> cardholder state or province \<font color="#eb144c">`postal`\</font> cardholder zip or postal code \<font color="#eb144c">`id`\</font> card id number \<font color="#eb144c">`issued`\</font> card issue date \<font color="#eb144c">`expires`\</font> card expiration date