Is there an efficient and elegant way to managing tag paths used by different scripts? For example, I have one script to write certain metadata in to an image:
<code>// common tag group paths
string tgPath1A = "script1:group1:parameter A";
string tgPath1B = "script2:group2:parameter B";
string tgPath2 = "point";
image img := RealImage( "image 1", 4, 50, 50 );
TagGroup tgImg = img.ImageGetTagGroup();
tgImg.TagGroupSetTagAsString( tgPath1A, "Hello" );
tgImg.TagGroupSetTagAsNumber( tgPath1B, 35 );
tgImg.TagGroupSetTagAsShortPoint( tgPath2, 3, 5 );
<code>// common tag group paths
string tgPath1A = "script1:group1:parameter A";
string tgPath1B = "script2:group2:parameter B";
string tgPath2 = "point";
// write meta data
image img := RealImage( "image 1", 4, 50, 50 );
TagGroup tgImg = img.ImageGetTagGroup();
tgImg.TagGroupSetTagAsString( tgPath1A, "Hello" );
tgImg.TagGroupSetTagAsNumber( tgPath1B, 35 );
tgImg.TagGroupSetTagAsShortPoint( tgPath2, 3, 5 );
img.ShowImage();
</code>
// common tag group paths
string tgPath1A = "script1:group1:parameter A";
string tgPath1B = "script2:group2:parameter B";
string tgPath2 = "point";
// write meta data
image img := RealImage( "image 1", 4, 50, 50 );
TagGroup tgImg = img.ImageGetTagGroup();
tgImg.TagGroupSetTagAsString( tgPath1A, "Hello" );
tgImg.TagGroupSetTagAsNumber( tgPath1B, 35 );
tgImg.TagGroupSetTagAsShortPoint( tgPath2, 3, 5 );
img.ShowImage();
Then I have another script to access these metadata:
<code>// common tag group paths
string tgPath1A = "script1:group1:parameter A";
string tgPath1B = "script2:group2:parameter B";
string tgPath2 = "point";
image img := GetFrontImage();
TagGroup tgImg = img.ImageGetTagGroup();
if( tgImg.TagGroupGetTagAsString( tgPath1A, str ) )
result( tgPath1A + " = " + str + "n" );
if( tgImg.TagGroupGetTagAsNumber( tgPath1B, num ) )
result( tgPath1B + " = " + num + "n" );
if( tgImg.TagGroupGetTagAsShortPoint( tgPath2, px, py) )
result( tgPath2 + " = (" + px + ", " + py + ")n" );
<code>// common tag group paths
string tgPath1A = "script1:group1:parameter A";
string tgPath1B = "script2:group2:parameter B";
string tgPath2 = "point";
// write meta data
image img := GetFrontImage();
TagGroup tgImg = img.ImageGetTagGroup();
string str;
if( tgImg.TagGroupGetTagAsString( tgPath1A, str ) )
result( tgPath1A + " = " + str + "n" );
number num;
if( tgImg.TagGroupGetTagAsNumber( tgPath1B, num ) )
result( tgPath1B + " = " + num + "n" );
number px, py;
if( tgImg.TagGroupGetTagAsShortPoint( tgPath2, px, py) )
result( tgPath2 + " = (" + px + ", " + py + ")n" );
</code>
// common tag group paths
string tgPath1A = "script1:group1:parameter A";
string tgPath1B = "script2:group2:parameter B";
string tgPath2 = "point";
// write meta data
image img := GetFrontImage();
TagGroup tgImg = img.ImageGetTagGroup();
string str;
if( tgImg.TagGroupGetTagAsString( tgPath1A, str ) )
result( tgPath1A + " = " + str + "n" );
number num;
if( tgImg.TagGroupGetTagAsNumber( tgPath1B, num ) )
result( tgPath1B + " = " + num + "n" );
number px, py;
if( tgImg.TagGroupGetTagAsShortPoint( tgPath2, px, py) )
result( tgPath2 + " = (" + px + ", " + py + ")n" );
Instead of “hard coding” the tag paths at the beginning for each script handling these specific metadata, is there a better way? The entries of these tag paths can reach hundreds or more for a large projects where multiple scripts writing and reading to the corresponding tag group (which can be associated with images or as part of global tag group).