Subscribe Bookmark RSS Feed

button window with script address inside

RosDima

Occasional Contributor

Joined:

Jan 17, 2017

Hi,

 

I am trying use button window with script address inside, so when user push a button it will trigger some script.

I saw someone used include function so it will recognize scrip address on a share drive or other place.

Can you please show how algorithm should looks like?

 

Button Box( "AR",

"some directory in share drive with script inside"

  );

I am missig some "include function" so i will be able open script from different directory

Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson

Super User

Joined:

Jun 22, 2012

Solution

Here is a section from the Scripting Guide on the Include() function

      Help==>Books==>Scripting Guide

 

Includes
The Include() function opens a script file, parses the script in it, and executes the JSL in the specified file. Include( "pathname" );

     For example, Include( "$SAMPLE_SCRIPTS/myStartupScript.jsl" );

There is an option to obtain the parsed expression from the file, rather than evaluating the file.

     Include( "pathname", <<Parse Only );

Another named option creates a namespace that the included script runs in. This namespace is an anonymous namespace and it is independent from the parent script’s namespace.

     Include( "file.jsl", <<New Context );

See “Advanced Scoping and Namespaces” on page235 for information about using namespaces with your scripts. Note the following about included files: • JMP files aside from JSL cannot be used.
Chapter 8 Programming Methods 257 Scripting Guide File and Directory Operations
• Other recognized file types, such as image files, SAS data sets, and Microsoft Excel files cannot be used. • Unrecognized file types are treated as a JSL file. • Files with the .txt extension are treated as a JSL file. A text file that contains data can be included, however an error will appear since this is not valid JSL.

Jim
2 REPLIES
txnelson

Super User

Joined:

Jun 22, 2012

Solution

Here is a section from the Scripting Guide on the Include() function

      Help==>Books==>Scripting Guide

 

Includes
The Include() function opens a script file, parses the script in it, and executes the JSL in the specified file. Include( "pathname" );

     For example, Include( "$SAMPLE_SCRIPTS/myStartupScript.jsl" );

There is an option to obtain the parsed expression from the file, rather than evaluating the file.

     Include( "pathname", <<Parse Only );

Another named option creates a namespace that the included script runs in. This namespace is an anonymous namespace and it is independent from the parent script’s namespace.

     Include( "file.jsl", <<New Context );

See “Advanced Scoping and Namespaces” on page235 for information about using namespaces with your scripts. Note the following about included files: • JMP files aside from JSL cannot be used.
Chapter 8 Programming Methods 257 Scripting Guide File and Directory Operations
• Other recognized file types, such as image files, SAS data sets, and Microsoft Excel files cannot be used. • Unrecognized file types are treated as a JSL file. • Files with the .txt extension are treated as a JSL file. A text file that contains data can be included, however an error will appear since this is not valid JSL.

Jim
RosDima

Occasional Contributor

Joined:

Jan 17, 2017

Thanks!