home *** CD-ROM | disk | FTP | other *** search
- //--------------------------------------------------------------------------
- // Object Scripting
- // Copyright (c) 1996, 1997 by Borland International, All Rights Reserved
- //
- // LOADLAST.SPP: Load Last Script. Loads the last-loaded script. Useful for
- // frequently reloading a script under development (before it is assigned
- // to a hot key, menu, or some other quick trigger).
- //
- // USE: Load script. Invoke loadlast() to load the previously loaded script.
- // Note that a script must actually be loaded, not simply have one of its
- // routines called, in order for it to become the last-loaded script.
- //
- // FILES: MSG.SPP
- //--------------------------------------------------------------------------
- print typeid(module());
-
- //
- // IDE imports.
- //
- import scriptEngine;
-
- //
- // Load support module(s).
- //
- if (!scriptEngine.IsLoaded("msg")) scriptEngine.Load("msg");
-
- LastLoadedScr = NULL; // Last module loaded.
-
- loadlast()
- {
- declare msg = new TMsg();
-
- // Load last-loaded script.
- //
- if (LastLoadedScr != NULL) {
- if (!scriptEngine.Load(LastLoadedScr)) {
- msg.Error("Could not load last-loaded script file " + LastLoadedScr);
- }
- }
- }
-
- //
- // Track the last loaded script.
- //
- on scriptEngine:>Loaded(scrName)
- {
- // Assign as last loaded if it's not this script.
- //
- declare sScript = new String(scrName);
- sScript = sScript.Lower();
- if (!sScript.Index("loadlast")) {
- if (sScript.Index(".spx")) {
- sScript.Text = sScript.SubString(0, sScript.Length - 1).Text + "p";
- }
- LastLoadedScr = sScript.Text;
- }
- return pass(scrName);
- }
-
-