Skip to main content
Participating Frequently
July 15, 2025
Answered

global.subscribe at folder-level script

  • July 15, 2025
  • 4 replies
  • 294 views

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 ?

Correct answer PDF Automation Station

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.

4 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.

Bernd Alheit
Community Expert
Community Expert
July 15, 2025

RadiusChanged is not defined 

 

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.

Bernd Alheit
Community Expert
Community Expert
July 15, 2025

global has no function wth the name subscribe

SergeiRAuthor
Participating Frequently
July 15, 2025

subscribe is global method

PDF Automation Station
Community Expert
Community Expert
July 15, 2025

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

SergeiRAuthor
Participating Frequently
July 15, 2025

general error != sense absense  🙂