Reply to: XMAX and XFT via CTMMarch 13, 2009 at 7:37 pm
XMAX does not know where it is installed because what that really means to most people is where the location of the application hosting XMAX. For example, if you have embedded XMAX in an HTML page being hosted in IE, or in a VB application, etc, telling you where the xmcontrol.dll itself is located on your machine is typically not much use, nor would you care where iexplore.exe is. I mention this because one solution for XMetaL Author in this case is to place your XFT files into a folder and then reference them using something like [code]Application.Path + “\Forms\myfile.xft”[/code]
There is no Application object for XMAX (like XMetaL Author has) because that is something we expect the hosting application to provide with associated properties and methods. For example, VB6 has App.Path, VB.NET and C# have Application.ExecutablePath and Application.StartupPath, etc.
In your case (because you are scripting the CTM functionality) you will need to provide a full path to any XFT you wish to locate. XMAX does not make any assumptions in this case either.
With an XAC file the XFT files will be extracted to the same folder as the rest of the contents of the XAC before being loaded and there are several ways to locate this folder.
var myXFTFilePath = ActiveDocument.ResourceSet.Root + “\q-physicalsymbol”;[/code]
In that case the folder returned is the one containing the CTM file.
var XACTempFolder = ActiveDocument.RulesFile.substring(0,ActiveDocument.RulesFile.lastIndexOf(“\”));
var myXFTFilePath = XACTempFolder + “\q-physicalsymbol”;[/code]
The first method would probably be my preferred one, however, there are people out there that have relied on the second method so they may be more familiar with it. It is also possible to locate the CSS file using ActiveDocument.DisplayStylesFile (and that could be used in place of the API in the second method).
Refer to the XMetaL Developer Programmers Guide for more information about these APIs. ResourceSet may be of particular interest as it is has a number of properties, methods and objects associated with it that allow you to query the content of XAC files in detail.