Skip to main content
Participating Frequently
Jul 15, 2025 1:09 PM UTC
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
Jul 15, 2025 5:40 PM UTC

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
Jul 15, 2025 5:40 PM UTC

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
Jul 15, 2025 3:17 PM UTC

RadiusChanged is not defined 

 

Translate
try67
Community Expert
Community Expert
Jul 15, 2025 4:00 PM UTC

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
Jul 15, 2025 1:46 PM UTC

global has no function wth the name subscribe

Translate
SergeiRAuthor
Participating Frequently
Jul 15, 2025 2:10 PM UTC

subscribe is global method

Translate
PDF Automation Station
Community Expert
Community Expert
Jul 15, 2025 1:22 PM UTC

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

Translate
SergeiRAuthor
Participating Frequently
Jul 15, 2025 2:12 PM UTC

general error != sense absense  🙂

Translate