Admin Script Editor > Creating Custom Wizards for ASE
In one of the final releases of ASE, the ability to create your own custom wizards was introduced. This sample script walks you through the use of the AdminScriptEditor.Wizard COM object used to creating custom Wizards for ASE in the KiXtart scripting language.
First, establish a handle to the AdminScriptEditor.Wizard object…
$ASEWizard = CreateObject("AdminScriptEditor.Wizard") If @error <> 0 ? "ASE Does Not Appear To Be Installed" ? "Download/Install ASE From http://www.adminscripteditor.com" Sleep 5 Quit EndIf
The above example assumes that if the object cannot be created, ASE must not be installed and prompts the user to obtain it. Next we will check to see if ASE is running…
If Not $ASEWizard.IsAseRunning ? "ASE Does Not Appear To Be Running" ? "Launch the Admin Script Editor and try again." Sleep 5 Quit EndIf
The above example uses the IsAseRunning method to see if the Admin Script Editor is running on the system. If not, the wizard will abort. Next, we need to be certain there is an active script to work with…
If Not $ASEWizard.IsScriptOpen ? "You must have an active Script open in ASE before running this wizard." Sleep 5 Quit EndIf
The above example aborts if the boolean value returned by IsScriptOpen indicates there is no script for the Wizard to work with. Now we need to determine what the language of the active script is in order to insert language-appropriate code…
$ASELanguage = $ASEWizard.LanguageType If $ASELanguage = "VBScript" Or $ASELanguage = "KiXtart" Or $ASELanguage = "Batch" Or $ASELanguage = "AutoIt" ; Supported Language Detected $Code = "What ever text my wizard is to insert into ASE" Else ? "Sorry, this wizard only supports VBScript, KiXtart, Batch and AutoIt" Sleep 5 Quit EndIf
Now that we know ASE is installed, running and that we have an active script with a supported language, your wizard may insert the appropriate code…
$CodeInsert = Wizard.InsertText($Code) If $CodeInsert <> 0 ? "An error was encountered when attempting to write data to script!" Sleep 3 Exit EndIf
To create a usable wizard, this script may be packaged using the Script Packager. Be sure to populate the version information appropriately, so that your Wizard displays helpful information within the Admin Script Editor.