JTAG API Help
In the Name of God
In this tutorial, we are focusing at the JTAG API training.
In version 3 and later of the JTAG, API has also been added to the program, so programmers can use the ability to build tags in their software.
To use this feature, you need to place the JTAG software files in a folder. All required software files are located at the software installation location. Note that the names and structure of these files do not change. Also, because the command line mode does not use the second mechanism, prefabricated labels, the database file does not require prefabricated tags, and you just need to copy the files in the installation location of the application.
You can run the program with Command Line Arguments. The software needs two arguments. The first argument is the address of a sequential file that contains the original text for the label. This file must be on the specified path. The second argument is the file address where the tags should be stored. If this file does not exist, it will be created by JTAG. For example, in the screenshot below, you see a file called my text.txt
containing the original text for the tag is opened by the JTAG software and its tags are located in another file called my tags.txt
. The second file, my tags.txt
, is not present on the specified path, so it will be created automatically by JTAG:
The important point here is that tags will be created based on the settings defined in the settings for the program. In terms of tag number and so on. Therefore, to change these settings without opening the software, you need to change the software information in the Windows registry. For example, the reg
file below sets the tag separator to ",", sets the maximum number of characters for a tag to 14, places the maximum number of tags in 5, sets the minimum number of characters for a tag equal to 4 and removes the extra letters from the tags.
Windows Registry Editor Version 5.00 [HKEY_CURRENT_USER\Software\Pure Soft\JTAG\Tagger] "Separator"="," "MaxChar"=dword:00000014 "MaxTag"=dword:00000005 "MinChar"=dword:00000004 "Preposition"="true"
You will see a sample source code written in C++ and using the JTAG API to build the tag from the API:
// JTAG API TEST #include "stdafx.h" using namespace std; #define MAX_CONTENT_LEN 1024 int main(int argc, char ** argv) { char fmname[_MAX_PATH];// Main text file char frname[_MAX_PATH];// Result file char content[MAX_CONTENT_LEN];// Main content char path_arg[_MAX_PATH] = { 0 };// Path args // Get Main file path cout << "Please enter main text file path: " << endl; cin.getline(fmname, _MAX_PATH); // Get main content cout << "Please enter main contents: " << endl; cin.getline(content, MAX_CONTENT_LEN); // Get result file path cout << "Please enter result file path: " << endl; cin.getline(frname, _MAX_PATH); // Open main file for writing content to it FILE * fm = fopen(fmname, "w"); fputs(content, fm); fclose(fm); cout << "Content Saved to main file" << endl; // Create argument for run JTAG with arguments strcat(path_arg, "JTAG.exe ");// App name strcat(path_arg, fmname);// main file name strcat(path_arg, " "); strcat(path_arg, frname);// result file (Tags will put on this file and its not created) cout << "Path Arguments: " << path_arg << endl; // Run JTAG with arguments system(path_arg); cout << "JTAG rans" << endl; // Keep command line open system("pause"); // Open result file FILE * fr = fopen(frname, "r"); fgets(content,MAX_CONTENT_LEN, fr); fclose(fr); // Show contents of result file cout << "Result file opened" << endl << "Here you can see contents of file: " << endl << content << endl; // Keep command line open system("pause"); return 0; }