FrameMaker UI freezing while script is running

Community Beginner ,
Feb 22, 2018 Feb 22, 2018

Copy link to clipboard

Copied

Hello guys,

I have a couple of questions for you.

When I am running my script, the script is actually working correctly in the background, but the FrameMaker UI is freezing and not reacting until the script is being shut down.

First question: How can this strange behavior be imrpoved?

Second question: How can I tell FrameMaker that a certain script must always be started when FM is starting (Autorun)?

Thanks a lot!


Selim

TOPICS
Scripting

Views

319

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct Answer

Enthusiast , Feb 22, 2018 Feb 22, 2018
If they are included in your main script, you can call these functions.If you want to call an external script you can call it like this:var MyScript  = MyFolder  + "\\" + "ScriptA.jsx;var RunFile = new File(MyScript); $.evalFile(RunFile);

Likes

Translate

Translate
Enthusiast ,
Feb 22, 2018 Feb 22, 2018

Copy link to clipboard

Copied

Hi Selim

to start a script when FM st started, copy it to

C:\Users\YOURUSERNAME\AppData\Roaming\Adobe\FrameMaker\14\startup

When I am running my script, the script is actually working correctly in the background, but the FrameMaker UI is freezing and not reacting until the script is being shut down.

That is normal, that it freezes until the script is finished.

My workaraound is, that I show a "personal console", where all the steps of the script is displayed, so the user is informed.

The second way is  to set app.Displaying = 0, and after the script is finished set app.Displaying = 1;

But there are some things to consider. Use the find function here in the forum to find some threads with  "app.Displaying".

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Feb 22, 2018 Feb 22, 2018

Copy link to clipboard

Copied

Hi Klaus,

thanks for your answer. I have 5 .jsx files, all of them are needed to run my script correctly. The script is loaded in one file I called "main.jsx". I need the other 4 files to run the script, but how can I tell FM, that "main.jsx" is to be started only?

Thanks!

PS: Thank you too Ian, as I mentioned now, I have problems regarding multiple files being added to this folder. Maybe you know a solution for this too?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Feb 22, 2018 Feb 22, 2018

Copy link to clipboard

Copied

If I understand it right:

1. You have a script A

2. You have 2 other scripts B,C,D,E

Scripts B,C,D,E should be able to call script A?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Feb 22, 2018 Feb 22, 2018

Copy link to clipboard

Copied

Not exactly.


Script A is the main routine, starting my socket etc. In Script B, C ,D, E there are only several functions to be called by script A. I "outsourced" functions depending on their logical purpose to various files, e.g.
Functions creating socket and establishing connection: "socket.jsx"
Functions for rendering .mif files: "docRenderer.jsx"
Functions for for parsing XML-Files: "XMLParser.jsx"

These files are included in the main.jsx like

#target "FrameMaker-14.0"

#include "B.jsx"

#include "C.jsx";

#include "D.jsx";

#include "E.jsx";

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Feb 22, 2018 Feb 22, 2018

Copy link to clipboard

Copied

If they are included in your main script, you can call these functions.

If you want to call an external script you can call it like this:

var MyScript  = MyFolder  + "\\" + "ScriptA.jsx;

var RunFile = new File(MyScript);

$.evalFile(RunFile);

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Feb 22, 2018 Feb 22, 2018

Copy link to clipboard

Copied

Hi Selim,

It depends on how your scripts are written. In an ideal world you would have just one entry point to a function in Script A. That would then provide the logic to call functions in Scripts B,C,D and E.

The secret is that by including the four other scripts you are only telling the scripting engine where to find the functions when they are needed. These four other script files should only include functions that are called from Script A, or by some sequence of calls that are initiated by script A.

The typical way to do this is that Script A included code to create a FrameMaker menu. But functions in script files B, C, D and E are only called when the user selects the menu. In other words there is no direct access to the code in the four included scripts, so they are never accessed during start-up.

Ian

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Feb 22, 2018 Feb 22, 2018

Copy link to clipboard

Copied

LATEST

Thank you Ian for your detailed explanation,

Thank you Klaus for your code example!

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Feb 22, 2018 Feb 22, 2018

Copy link to clipboard

Copied

Hello Selim,

The FrameMaker UI freezing whilst running a script is unfortunately normal behaviour. FrameMaker 2017 seems to suffer from it more than earlier versions. I have tried various ways to prevent it, but the usual side-effect is to degrade the script's performance. For one of my scripts I wanted to write processing messages to the status bar, but after the first message the screen freezes and no status messages are shown until the script completes.

If you add a script to the startup folder in FrameMaker's installation folder it will run as soon as FrameMaker starts. You may have to change the security settings for the startup folder as it is read-only by default. <drive>:\Users\<username>\AppData\Roaming\Adobe\FrameMaker\<version>\startup

I hope that helps?

Ian

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines