Setting up a character format
Dear friends,
It's quite easy to set up a new character format with 'all AsIs', but I have not found the necessary ingredients to set up one with particular properties:
a) name = superscript: all AsIs, but superscript
b) name = highlight: all AsIs, but a colour (from the standard set)
Hence I had the idea to call the Character Designer by means of F-codes.
Well - it opens, but I do not see how to set the dialogue to "All AsIs" - because the user normally has its cursor somewhere in the document and the really defined properties are only seen if the cursor is outside the document.
So far I'm here:
function DefineCharFmt (sName, oDoc, bProperty) {
var charFmt = 0, fcode = [], msg;
msg = "Character format '" + sName + "' does not exist in catalogue\nShall it be created?";
charFmt = oDoc.GetNamedCharFmt (sName);
if (!charFmt.ObjectValid()) { // does not exist in catalogue
if (confirm (msg, false, "Confirm new character format")) {
charFmt = oDoc.NewNamedObject (Constants.FO_CharFmt, sName);
if (bProperty) {
fcode[0] = FCodes.CHAR_DESIGN_CAT; // Open Charactr designer to set the property
// fcode[1] = FCodes.CHAR_DESIGNKIT_RESET; // nothing to do with Set AsIs
Fcodes(fcode);
}
return true;
} else {
return false;name
}
}
return true;
} //--- end DefineCharFmt
Maybe I need to put it the other way round:
Instruct the user that for the proper function of the script the xxx character formats must exist in the catalogue and be set up accordingly...
Or:
Createte the needed character formats in the catalogue - only "AsIs" and instruct the user to set them up properly to see the effect in the document.
Klaus
