Tag Archives: source file manipulation

Text Processing Example : Modify a Hex value on every source code line

Bitmap2LCD is a tool for programming small Graphic LCDs in embedded systems and a programmable text processing tool.

Text Processing Batch Example

Target : Modifying a Hex value on every source code line

  • Convert an image to code : The code array then is visible in the Text editor ( see below )

Example here see the two first hex values : 0x01 and 0x70

Bitmap2LCD Batch Text Processing 1

 

In the Text Processing Window, create a new batch and write this program, using the choice comboboxes and the editors located upwards the program lines :

Bitmap2LCD Batch Text Processing 2

if ‘0x’
      then get hex (0)                         –> Hex value prefix is already 0x in the configuration settings
shift left (1)
      then overwrite (index)’    ‘    –> 4 x space inside the string
      then insert hex (index)

Remark : Everything between two “if conditions” is one block of functions for this “if condition” !

On every text editor line, checks if ‘0x’ is found and if condition is “true”, gets the first hex value (index 0) , shifts left  the hex value of 1 bit to the left , overwrites source from the index where the ‘0x’ was found with four space chars,  and finally inserts the shifted hex value at the index position…

Activate the new batch and run it over the text editor.

Bitmap2LCD Batch Text Processing 3

The source file in the Text Editor has been modified (red arrow)

You can read the processing report journal (blue arrow)

 

 

 

 

 

Bitmap2LCD : Text processing on multiple files located in a folder

Bitmap2LCD is a tool for programming small Graphic LCDs in embedded systems and a programmable text processing tool.

Text processing on multiple files located in a folder

From Bitmap2CD Standard Edition V2.8d, a text processing batch can be run on defined multiple files located in a defined folder.

1. In the File Explorer, select the folder where the source files are located  (blue arrow, fig 1)

2. Open the Configuration Settings Panel , click the Text Process tab

3 Click on the Folder Select button (red arrow)

4 The selected folder appears in the field (orange arrow) This field will be saved with the configurations settings when closing the program.

5. Define the file extension, for example : “.txt”  or “.csv”  or “.h”  Only the files with this extension in the folder ( case sensitive ) will be text processed.

Bitmap2CLD Multiple File Text Processing 1

fig 1)

The selected batch (see red arrow fig 2) can be started from the menu or from the text processing panel (green arrows fig2)

If no batch allready activated, list the batch files with the button at the left of blue arrow, choose the batch you want to run in the list and activate it ( blue arrow fig2 )

Bitmap2CLD Multiple File Text Processing 2

fig 2)

At the end of a Multiple file Text processing run, a journal is displayed (fig 3 below)

It lists the source folder and file, the destination folder and file and the number of Text processing occurences found

The destination folder is the source folder name + _processed

The source files in the source folder are not modified

Bitmap2CLD Multiple File Text Processing 3

fig 3)