Copy link to clipboard
Copied
I have process which takes around 10 minutes - during this time I see frozen window on frame maker. Any ideas on this issue ?
Copy link to clipboard
Copied
Hi, I believe the concept of multiple processing threads within the FM environment is well beyond any current capability. If your tasks are taking too long, perhaps you could optimize your code to reduce the time. There are many tricks to do the same task differently and more quickly. You haven't provided any details on what your code does, so I couldn't comment any further.
Russ
Copy link to clipboard
Copied
Thanks for the answer. I get all the .fm files of 2 books and save2dita. Books are quite big. I use 3 while loop to get 3 level hierarchy - source/folder(1..n) + .fm files/folder(1..n) + .fm files. Overall takes around 10 minutes. And I see loading icon and not responding window as long as the process is going.
Copy link to clipboard
Copied
Well, I'm still not exactly sure what you are doing, but maybe let me ask this question... if you were to follow all the steps manually in the UI, would it still take 10 minutes of processing? In some cases, if you are calling functionality or another API client with complex internal processing, there isn't much you can do except wait. If you are constructing your own logic piece by piece, sometimes there are multiple ways to do something, with some ways more efficient than others.
Russ
Copy link to clipboard
Copied
I have several scripts that load and edit several documents.
In this case I use a "ProgressConsoleWindow" that shows the file or/and the step the script is working on.
So the user can see, that something is happening and FrameMaker is still alive.
But I agree with Russ, that there could be a way to make the script more efficient.
Copy link to clipboard
Copied
Thanks Klaus, Russ - please find main part of code below.
function book2Xml (bookpath)
{
var comp = bookpath.FirstComponentInBook;
while (comp.id)
{
var compType=comp.ComponentType;
if(Constants.FV_BK_FOLDER == compType || Constants.FV_BK_GROUP == compType)
{
var comp1 = comp.FirstComponentInBookComponent;
while (comp1.id)
{
var compType2=comp1.ComponentType;
if(Constants.FV_BK_FOLDER == compType2 || Constants.FV_BK_GROUP == compType2)
{
var comp2 = comp1.FirstComponentInBookComponent;
while (comp2.id)
{
Console("Processing Sub-Sub Component: " + comp2.Name);
var doc3 = OpenFm (comp2.Name)
if (doc3.ObjectValid() == true) {
save2Xml (doc3)
}
comp2 = comp2.NextComponentInBook;
}
} else {
Console("Processing Sub Component: " + comp1.Name);
var doc1 = OpenFm (comp1.Name)
if (doc1.ObjectValid() == true) {
save2Xml (doc1)
}
}
comp1 = comp1.NextComponentInBook;
}
}
else
{
var compName = comp.Name;
Console("Processing Component: " + compName);
var doc2 = OpenFm (compName)
if (doc2.ObjectValid() == true) {
save2Xml (doc2)
}
}
comp = comp.NextComponentInBook;
}
}
I run this for 2 big books - I see not responding window and I don't see logs updating after few seconds because of not responding window.
Manually it takes also 12 minutes. I know I can optimize this code but I'm not sure if it will solve this issue. I am thinking that I am missing something there.
Thanks.
Copy link to clipboard
Copied
Hi,
Multithreading is not possible in FrameMaker, FDK and ExtendScript.
There is nothing you can do here, but live with it. Algorithm seems OK while I prefer recursive algorithms for this, but this doesn't change anything.
I'm not sure which FM Version you are running, perhaps it's worth trying FM 2019 64bit, as I've seen significant performance optimizations there in general.
Markus