<< BACK

Above the body tag, I've created an array of records (objects). Below, I'm printing out all records in the array.

At the bottom, I'm printing out "aMacro[imcSingleLineUn3]", which is equal to aMacro[4]. Using an explicit variable name (imcSingleLineUn3) to reference the array element (instead of the number "4") gives the an easy way to reference a specific object, without having to keep track of which number element it actually is.

When creating the array above, I'm numbering each element with iArrayIndex++, instead of hard-coding numbers. This way I can move around/add/delete elements without having to renumber these indexes each time.


aMacro[0].sMacroName =    Comment continue
aMacro[0].sKeyCombo =     Shift + Enter
aMacro[0].sDocDirectory = comment
aMacro[0].sDocFile =      continue
aMacro[0].sFileName =     comment_continue

aMacro[1].sMacroName =    Comment single line
aMacro[1].sKeyCombo =     Ctrl + ~, Ctrl + ~
aMacro[1].sDocDirectory = comment
aMacro[1].sDocFile =      single_line
aMacro[1].sFileName =     comment_single_line

aMacro[2].sMacroName =    Comment single line UN 1
aMacro[2].sKeyCombo =     Ctrl + ~, Ctrl + 1
aMacro[2].sDocDirectory = comment
aMacro[2].sDocFile =      single_line_un1
aMacro[2].sFileName =     comment_single_line_un1

aMacro[3].sMacroName =    Comment single line UN 2
aMacro[3].sKeyCombo =     Ctrl + ~, Ctrl + 2
aMacro[3].sDocDirectory = comment
aMacro[3].sDocFile =      single_line_un2
aMacro[3].sFileName =     comment_single_line_un2

aMacro[4].sMacroName =    Comment single line UN 3
aMacro[4].sKeyCombo =     Ctrl + ~, Ctrl + 3
aMacro[4].sDocDirectory = comment
aMacro[4].sDocFile =      single_line_un3
aMacro[4].sFileName =     comment_single_line_un3


aMacro[imcSingleLineUn3].sMacroName = Comment single line UN 3 aMacro[imcSingleLineUn3].sKeyCombo = Ctrl + ~, Ctrl + 3 aMacro[imcSingleLineUn3].sDocDirectory = comment aMacro[imcSingleLineUn3].sDocFile = single_line_un3 aMacro[imcSingleLineUn3].sFileName = comment_single_line_un3