Subscribe Bookmark RSS Feed

[JSL] Recover variable value from another script

antoinesofradir

Community Trekker

Joined:

Apr 26, 2013

Hello !

In my first Script i defined a variable ... I would like now to recover this variable in my second Script :

How can i do ?

this example show my problem:

First Script :

Variable = 1 ;

Include("C:\Second Script.jsl");

Second Script :

If( Variable ==1, Data Table ... )

Thanks for your help !

1 ACCEPTED SOLUTION

Accepted Solutions
pmroz

Super User

Joined:

Jun 23, 2011

Solution

If you aren't using namespaces or "names default to here(1)" then all variables will be global.

If you are using namespaces or names default to here(1), then if you preface the variable with two colons it will be treated as a global variable.

First Script :

::Variable = 1 ;

Include("C:\Second Script.jsl");

Second Script :

If( ::Variable ==1, Data Table ... )

2 REPLIES
pmroz

Super User

Joined:

Jun 23, 2011

Solution

If you aren't using namespaces or "names default to here(1)" then all variables will be global.

If you are using namespaces or names default to here(1), then if you preface the variable with two colons it will be treated as a global variable.

First Script :

::Variable = 1 ;

Include("C:\Second Script.jsl");

Second Script :

If( ::Variable ==1, Data Table ... )

antoinesofradir

Community Trekker

Joined:

Apr 26, 2013

Merci beaucoup !