Copy link to clipboard
Copied
Is there a way to get a list of the current structured application names currently in memory with ExtendScript? I didn't find a similar property in the FDK docs and wonder if this list is exposed to ExtendScript. Thanks.
Copy link to clipboard
Copied
Hi Klaus,
The FDK has a secret property, FP_StructuredApplicationList, which was discussed here (not sure if you can read this thread):
https://groups.yahoo.com/neo/groups/Frame_dev/conversations/topics/1110
It is referenced in the ExtendScript documentation in the list of constants, but nothing further. I could not get it to work, so maybe it is not implemented. I tried things like:
app.StructuredApplicationList
..and
var params = app.GetProps();
var index = GetPropIndex(params, Constants.StructuredApplicationList);
... something with params[index].propVal.ssval ...
I also tried Contants.XMLStructuredApplicationList which is also referenced in the docs. Nothing worked. I suspect it is not implemented. But I don't really know.
Russ
Copy link to clipboard
Copied
Thanks Russ. Instead of worrying about the required structured application being loaded, I am basically doing this:
I have to do some more testing, but this looks like it will be a good solution. I am trying to avoid having my users update their structapps.fm file for some of my scripts. Here is the basic shell.
#target framemaker
var structapps, file, structfile, doc;
// Make a custom structapps file.
structapps = makeStructappsFile ("JMCC_AMM_TOC");
file = File (File ($.fileName).path + "/_structapps.xml");
// CP.saveXmlFile not shown.
structfile = CP.saveXmlFile (structapps, file);
// Read it into memory.
readApplicationDefinitions (structfile.fsName);
// Open the xml file that uses the custom structapps file.
// ... Process the resulting fm file ...
// Restore the default user structured applications.
file = (app.UserSettingsDir + "\\structapps.fm");
readApplicationDefinitions (file);
function makeStructappsFile (name) {
var structapps, appfolder;
appfolder = new File ($.fileName).fsName.replace (/[^\\]+$/, name + "\\");
structapps = <StructuredSetup>
<Version/>
<XMLApplication>
<ApplicationName>{name}</ApplicationName>
<DOCTYPE>{name}</DOCTYPE>
<DTD>{appfolder}{name}.dtd</DTD>
<Template>{appfolder}{name}_Template.fm</Template>
<ReadWriteRules>{appfolder}{name}_RW.fm</ReadWriteRules>
<Entities>
<Public>
<PublicID>{name}</PublicID>
<FileName>{appfolder}{name}.dtd</FileName>
</Public>
</Entities>
<Stylesheets>
<XSLTPreferences>
<PreProcessing>
<Stylesheet>{appfolder}{name}.xsl</Stylesheet>
</PreProcessing>
</XSLTPreferences>
</Stylesheets>
</XMLApplication>
</StructuredSetup>;
return structapps;
}
function readApplicationDefinitions (name) {
var doc;
doc = CP.getDocument (name, undefined, false);
if ((doc) && (doc.ObjectValid () === 1)) {
CallClient ("FmDispatcher", "ReadAppFile " + doc.id);
if (doc.openedByScript === true) {
doc.Close (true);
}
return true;
}
}