Parent Previous Next

// TeXworksScript

// Title: Pre-Load Globals

// Description: Pre-loads gloabal varibales used in script modules

// Author: Paul A Norman

// Version: 0.3

// Date: 2010-12-19

// Script-Type: hook

// Hook: TeXworksLaunched

// TW.information(null,"Hello","Hello from NewFile Hook"); // will change to ApplicationReady hook later on

function setUp(globalName, fileName)




      if (hasGlobal(globalName) == false) // this test should be redundant


           var fileResult = TW.readFile(fileName);

           setGlobal(globalName, fileResult.result) // makes it available for later eval() in other scripts




setUp("helper_twPan", "helper_twPan.mod");// later eval() of this will create:

// twConst, msgBox, twPan, global_load(globalName), create_helper()

setUp("phpjs_namespaced", "phpjs.namespaced.mod"); // later eval() of this will create:

// PHP_JS(); object factory function

setUp("helper_PhpJs",'helper_PhpJs.mod'); // later eval() of this will create:

// an object called window and PhpJs from new PHP_JS(); see helper_PhpJs.mod for more information

Created with the Personal Edition of HelpNDoc: Easily create iPhone documentation