Smart Package Robot 's "Script to Executable" Compiler

<< Click to Display Table of Contents >>

Navigation:  2. Components > 2. EXE-Compiler >

Smart Package Robot 's "Script to Executable" Compiler

#LIB: - User-Library Path

Previous Top Next


Compiler-Directives

 

#LIB: - User-Library Path

Used to automatically include User-Lib files and folders into the executable.

 

 

Intention

 

The #LIB:-Directive will enable you to include your personal Library-Script-Files into any of your Scripts easily.

To make this possible, the commands does a lot of things "under the hood".

What you need to provide is the "Library Path". That is the Path where your Library-Skript files are.

Then all you write is this:

 

   #LIB:(Library-Path)\

 

    For example:

 

   #LIB:X:\SPR-Library\

 

the folder can also be "relative to your Skript's Folder", using:

 

#LIB:?path\..\My-Library\

 

Here is a Sample that shows how to use the Directive:

 

#LIB:?path\..\User-Lib\

 

LIB-P1

 

The "User-Lib" Folder can be anywhere, even on another drive. In this case its just at the same Level as ?path\ which is the Project Folder where the Skript itself is located. To make this possible, '#LIB: is a mixed Preprocessor- and Compiler Directive.
The #LIB: Command will therefore do a couple of things, during Compilation and during Preprocessing. These are:

 

1. When starting a Script inside the Editor, it will also search Skripts inside the User-Lib Path.

   Example: JNF.MyLibscript.mrt
   will be executed if in ?path or in ?lib\

2. The Special-Folder ?lib\ will be set to the Path that was specified behind the #LIB:-Directive.

  JNF.?lib\MyLibscript.mrt

   will be executed, if the file is in the Library-Path.

3. When compiling an EXE-File, the whole Folder "User-Lib" and all Sub-Folders and files inside will be compiled into the Folder:

 ?path\LibXXSPR\

This is the Path that ?lib\ will have when the Script runs in EXE-Mode (when the Script runs from a compiled Executable).

This way, the Library will be included and also deleted after Script execution.

 

How to Avoid to include always the whole library:

You can prevent the Compiler to generally include the whole library, by adding the |N

Doing so, you will have to manually add

  

  '#INC:?path\..\User-Lib\WasMe.mrt->?path\LibXXSPR\

 

to your Script. You can simply add this Line into the Library file. It will look like this:

 

Main-Script:

  #LIB:?path\..\User-Lib\|N

  JNF.WasMe

 

Library file:

  '#INC:?path\..\User-Lib\WasMe.mrt->?path\LibXXSPR\

  MBX. Was me!

  RET.

 

This way, you can just call your "Library Skript" using JNF.Wasme

and the Preprocessor will know that this shall be included into the Library during compilation.

 

You can use the #LIB: - Directive as well together with the

#INC: - Preprocessor-Directive.

 

Using this, you can add all used "Subroutines" to the bottom of your Script using a Single (or multiple)

#INC:(path and name of lib-file)

 

Example:

  #INC:Subroutines.mrt

or

#INC:?lib\Subroutines.mrt

 

 

Hint: To protect your Scripts and Library Scripts from being seen by unauthorized persons, you can use the '#CRY: - Directive.

 

Syntax:

 

#LIB:P1[|N]

 

 

 

Example:

 

'----------------------------------------

' Using the User-Library Command with #INC:

'----------------------------------------

'#SPI:ForceWrite

'#LIB:?pfad\..\User-Library\

'

#INC:MyLine.mrt

' This Subprogram will be included below with the #INC:

GSB.DoX

 

EXO.?path\

MBX.!

ENR.

 

' This will include your Subprograms

#INC:MySubs.mrt

END.

 

 

' MyLine.mrt must be in the Library-Folder and could look like this:

'

MBX.I was here A!

'

 

 

' MySubs.mrt must be in the Library-Folder and could look like this:

'

:DoX

MBX.I was here B!

RET.

'

 

 

 

'----------------------------------------

' Using the User-Library Command with JNF.

'----------------------------------------

'#SPI:ForceWrite

'#LIB:?pfad\..\User-Library\

'

JNF.MySubs.mrt

EXO.?path\

MBX.!

END.

 

 

' MySubs.mrt must be in the Library-Folder and could look like this:

'

MBX.I was here!

' In this case we need the "ENR." Command to return to the Main-Script.

ENR.

 

 

 

 

Parameter Explanation:

 

-

 

 

Remarks:

Preprocessor-Directives start with the Sequence: #

Because this is only important for the Preprocessor, the running script ignores these commands at Runtime (at time of script execution).

 

 

Limitations:

 

-

 

 

See also:

 

    2.1.8 '#INC: - Include Files and Folders into the Executable

    1.3 '#SPI: - Special Instructions

    Specialfolders

    #ONCE / # OEND - Multiple Include Protection

    1.1 #INC: - Pre-Processor File-Include

    2.1.B #CRY: - enCrypt the Script