Here is a script that will insert a ProductName user variable automatically when you insert a ProdName element. Save the code to a text file and put it in this folder:
C:\Users\<UserName>\AppData\Roaming\Adobe\FrameMaker\<Version>\startup
where <UserName> is your Windows login name and <Version> is your FrameMaker version. You may have to create the startup folder.
Quit and restart FrameMaker and try inserting a ProdName element.
If the script is useful to you, please consider visiting http://give.roswellpark.org/goto/rickquatro
#target framemaker
Notification (Constants.FA_Note_PostInsertElement, true);
function Notify (note, object, sparam, iparam) {
var doc, element;
switch (note) {
// This event will be triggered after an element is inserted.
case Constants.FA_Note_PostInsertElement:
doc = object;
element = doc.ElementSelection.beg.parent;
// Check which element is the last one inserted.
if (element.ElementDef.Name === "ProdName") {
// Insert a user variable.
insertVariable (element, "ProductName", doc);
}
break;
}
}
function insertVariable (element, name, doc) {
var textLoc;
textLoc = doc.ElementLocToTextLoc (doc.ElementSelection.beg);
doc.NewAnchoredFormattedVar (name, textLoc);
}