Skip to main content
Participating Frequently
July 15, 2025
Answered

global.subscribe at folder-level script

i try for test 

 
global.radius=2;
global.subscribe("radius", RadiusChanged);
function RadiusChanged(x)  
{
   app.alert(x);
}

 i have 

Exception in line 2 of function top_level, script Folder-Level:App:test.js

GeneralError: Operation failed.
Global.subscribe:2:Folder-Level:App:test.js

whats wrong ?

PDF Automation Station
Community Expert
July 15, 2025

global.subscribe("radius", RadiusChanged); must be declared from an open document.  You get an error in a folder level script because it runs before a document is open.  Remove it from the folder level script and put it in a document level script.

7 replies

PDF Automation Station
Community Expert
Community Expert
July 15, 2025

global.subscribe("radius", RadiusChanged); must be declared from an open document.  You get an error in a folder level script because it runs before a document is open.  Remove it from the folder level script and put it in a document level script.

Translate
Bernd Alheit
Community Expert
Community Expert
July 15, 2025

RadiusChanged is not defined 

 

Translate
try67
Community Expert
Community Expert
July 15, 2025

That shouldn't matter. It appears like that in the Reference and it works from the Console, just not from a folder-level script, not even if you place it in a trusted function. It seems it can't be used in that way.

Translate
Bernd Alheit
Community Expert
Community Expert
July 15, 2025

global has no function wth the name subscribe

Translate
SergeiRAuthor
Participating Frequently
July 15, 2025

subscribe is global method

Translate
PDF Automation Station
Community Expert
Community Expert
July 15, 2025

What are you trying to do?  Line 2 doesn't make sense.

Translate
SergeiRAuthor
Participating Frequently
July 15, 2025

general error != sense absense  🙂

Translate