KiXtart About

KiXtart 2001 Reference

HTML Help File

This file was created and compiled by ScriptLogic Corporation using the Microsoft HTML Help Workshop 1.3. This guide is not intended to replace the manual (MS Word format) accompanying the full KiXtart download, but rather it is intended to provide a handy on-screen reference while programming -- specifically, it does not contain the setup and troubleshooting information contained within the the original manual.

Start here >> Master Keyword Index

For complete help on KiXtart, including installation procedure and troubleshooting tips, please refer to the complete KiXtart documentation (Microsoft Word format) included with the complete KiXtart package. For updates to this HTML help system, please visit www.scriptlogic.com/kixtart.

About KiXtart

KiXtart 2001 (4.0) was designed and developed by Ruud van Velsen of Microsoft Netherlands.

The program was developed on Windows 2000 using the Microsoft Visual Studio, Microsoft Visual C 6.0 SP4, Microsoft Assembler 6.1 and the Windows 32 Software Development Kit.

The SPK format used by the PLAY command was originally designed by Gordon E. Peterson II. The SPK files were translated from BASIC and Assembler programs gathered from various public domain sources.

THE INFORMATION AND CODE PROVIDED AS PART OF KIXTART (HEREUNDER COLLECTIVELY REFERRED TO AS "SOFTWARE") IS PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL RUUD VAN VELSEN OR MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF RUUD VAN VELSEN OR MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

This Software is provided to you as CareWare. This Software may be copied, distributed and evaluated royalty-free subject to the following conditions:

  • If you continue to use the Software, you must make a charitable donation as described in the section “KiXtart: Do You Care?”
  • You must copy all Software without modification and must include all pages.
  • You must place all copyright notices and other protective disclaimers and notices contained on the Software on all copies of the Software.
  • You may not distribute this Software for profit.
  • Distribution of this Software as part of a commercial product or service requires written consent from the author of this Software.
  • You agree to indemnify, hold harmless, and defend Ruud van Velsen, Microsoft and its suppliers from and against any claims or lawsuits, including attorneys' fees, that arise or result from the use or distribution of the Software.

Copyright© 2001 Ruud van Velsen. All rights reserved.

Feedback

If you have feedback or questions regarding KiXtart, please contact kixtart2001@hotmail.com.

If you are interested in joining an international community of KiXtart users to discuss tips and tricks and share sample scripts, please connect to www.scriptlogic.com/kixtart, www.kixtart.org or www.brainbuzz.com.

To download the latest version of KiXtart, view sample scripts, tips and tricks, please visit one of the following sites:

  • www.scriptlogic.com/kixtart
  • www.kixtart.org
  • home.wanadoo.nl/scripting/summary.htm
  • www.comptrends.com
  • Win-Scripts
  • members.ozemail.com.au/~chrismat/scripts.html
  • www.dx21.com/scripting/kixtart/default.asp

If you are interested in a ‘KiXtart-aware’ script-editor, please visit:
versionzero.webjump.com or www.ultraedit.com

Acknowledgements

KiXtart is the result of feedback, suggestions and ideas from people all over the world and from all types of organizations. Once the first alpha-versions of the latest update started passing the compiler, even more people started testing, re-testing, and testing yet again, thereby producing the truly exciting end result that is now called KiXtart 2001 (4.0).

I would like to express my sincerest thanks to all of you, and Keep Scripting!

Very special thanks go out to all the enthusiastic die-hards who over the years supported KiXtart (and kept me alive) by hosting and/or actively participating in KiXtart web-sites, forums, mail-lists and bulletin boards. The group of people involved is far too large to list in full, but some names absolutely require mentioning: Steve Wilson, Steve Ognibene, Larry Duncan, Brian Styles, Jim Kay, Henri Wiering, Shawn Tassie, Kevin Cowan, Humberto Roche García y María C. Meléndez Mulero, Erik Kærholm, Jochen Polster, Chris Matheson, Bryan Steele, Brad Schunk, Ben Burnett, Rob Butler and of course the people at BrainBuzz: thanks guys, you really made a difference!

Once again, my sincerest thanks to all of you, and I hope to see you again in the next release…!


KiXtart About

KiXtart 2001 Reference

KiXtart: Do You Care?

Introduction
KiXtart was started as a spare-time project in 1991 in response to the many requests for logon scripting for the Microsoft LAN Manager environment. KiXtart’s simplicity, speed and lack of competition soon made it very popular with LAN Manager network administrators.

KiXtart was initially distributed as freeware through bulletin boards in Europe. Later, Internet sites picked up on KiXtart and started distribution lists, discussion forums and script archives. KiXtart was also shipped as part of several Microsoft Resource Kits. Over time, KiXtart grew, both in popularity as well as in functionality. Windows NT and Windows 95 support was added, as well as lots of new functions and features.

Today, thousands of organizations worldwide use KiXtart. Banks, insurance companies, colleges, universities, hospitals, power plants, governmental organizations, IT companies, car manufacturers, oil companies, aerospace industries, publishers, amusement parks, broadcasting companies, and numerous other types of organizations around the globe make daily use of KiXtart to configure workstations, install software, and perform many other scripting tasks.

KiXtart is a hot topic on various Internet discussion forums, with many enthusiastic participants sharing tips, tricks and scripts.

Over the years, many people have asked when KiXtart would be commercialized. In fact, requests for pricing and licensing information on KiXtart are quite common. If nothing else, all of the above proves that KiXtart has a value.

Rather than commercializing KiXtart, I would like to turn its value into something truly positive. Specifically, I would like to use its value to help people who absolutely need and deserve our support: the people of Nepal.

As part of this initiative, KiXtart 2001 is provided to you as so-called CareWare. Exactly what this means is detailed in the following paragraphs. Please read the information carefully and support the KiXtart CareWare initiative!

What is CareWare?
CareWare is a variant on shareware and freeware. It is sometimes also known as 'charityware', 'donationware', 'helpware' or 'goodware', and is copyrighted software that you are allowed to use at no charge in return for a donation to specified charity/ies or to a charity of the users' choice.

KiXtart CareWare can be downloaded, installed and evaluated at no charge. If you continue using KiXtart, you are kindly requested to make a donation to a non-profit charitable organization. A list of preferred charities is provided below.

How much should we donate?
The answer to this question is in your heart. The donation amount should reflect your perception of the value of KiXtart for your organization. The suggested minimum donation amount is fifty US dollars ($50) per organization/company using KiXtart. Please consider that CareWare is not about making money, but about sharing with and caring for other people.

Making a donation is more important than the actual amount of the donation.

Note that in many countries, charitable donations to officially registered charities are tax deductible, so you may be able to donate more than you think!

Who should we donate to?
The following non-profit, charitable organizations that support the people in Nepal are preferred:

ROKPA INTERNATIONAL www.rokpa.org
ROKPA INTERNATIONAL is a non-profit organization helping and supporting people in need irrespective of their nationality, religion or cultural background. ROKPA INTERNATIONAL works in the areas of education, health care, relief of hunger and preservation of culture, self-help and ecology. The organization both offers emergency and long-term help through its projects in Nepal, Tibet and other countries.

SHIVA Charity Nepal www.shivacharity.org
SHIVA is a UK based charity promoting skills and education in Nepal. By setting up free schools, SHIVA gives you the opportunity to give a Nepali child a chance in life. SHIVA UK Regd. Charity no. 1045197.

Books for Nepal www.booksfornepal.org
Books for Nepal seeks to provide every child with an opportunity to gain the lifelong gift of literacy by attacking the root causes of illiteracy in Nepalese society.

If, for whatever reason, you can not donate to any of these organizations, you are kindly requested to donate to Unicef instead:

UNICEF www.unicef.org
For more than 53 years UNICEF has been helping governments, communities and families make the world a better place for children. Part of the United Nations system, UNICEF has an enviable mandate and mission, to advocate for children's rights and help meet their needs.

Note: more details on these organizations can be found in the GuideStar directory: http://www.guidestar.org.

Why Nepal?
When I visited Nepal in 1999, I became enchanted with its magnificent beauty and its kind and hospitable people. At the same time, I was stunned by the poverty.

Nepal, home of Mount Everest, is one of the poorest countries in the world in relative as well as absolute terms. More than half of the population lives below the poverty line and 53% of the people live on less than US$ 1 per day. Nepal has few natural resources apart from its beauty and hardworking people. Life expectancy is very low, and illiteracy affects more than 50% of the children.Education, medication, and even basic things such as clean water are a luxury in large parts of Nepal. Everyday, a Nepali child goes blind for want of vitamin A, something that can be prevented by a medicine costing less than ten cents.

What do I get in return?
Of course, the whole concept of CareWare is about giving, not receiving. Still, making a donation on behalf of KiXtart provides the following benefits:

  • People elsewhere in the world benefit from your support.

  • You get to feel good about using KiXtart.

  • I am motivated to continue developing KiXtart.

Additionally, if you choose to register your donation, you will be kept up to date on KiXtart developments, and your (company) name can be included on the list of KiXtart CareWare sponsors.

How should we make a donation?
To make a donation, simply select the organization you would like to support, determine the amount you can donate, and use one of the donation methods supported by the organization.

When you make a donation, please include a reference to “KiXtart 2001”.

Optionally, you can also register your donation by forwarding the confirmation email you send to or receive from the charitable organization to kixtart2001@hotmail.com or ruudv@microsoft.com.

I can’t make a donation to charity!
If you are not able to donate money to any charity, for whatever reason, I would appreciate it if you could let me know why. Understanding what the problem with making a donation is will enable me to improve the KiXtart CareWare process.

I don’t care…
That is entirely your prerogative. The KiXtart CareWare initiative is based on your voluntary cooperation. KiXtart has no built-in registration process or license checks.

Please carefully consider the value of KiXtart to you and your organization, and reconsider making a donation. Your support will be greatly appreciated, by me, and more importantly, by the organizations you donate to and the people they support.


KiXtart Keyword Index

KiXtart Reference

Keyword Index
A complete listing of all commands, functions and macros in alphabetical order

A B C D E F G H I K L M O P Q R S T U V W Y

Bold items are new to this release

Keyword | Description | Type
? Print / display Command
: Denote label for goto/gosub Command
; Denote comments Command
AddKey( ) | Add a key to registry | Function
AddPrinterConnection( ) | Add a connection to a network printer (NT only) | Function
AddProgramGroup( ) | Create a new program group | Function
AddProgramItem( ) | Add/replace an item in current program group | Function
@Address | Address of the network adapter | Macro
Asc( ) | Returns ASCII code of character | Function
At( ) | Place the cursor at the place indicated | Function
BackupEventLog( ) | Backs up an NT event log | Function
Beep | Beep speaker | Command
Big | Sets character mode to large characters (8x8) | Command
Break On/Off | (Re)set Ctrl-C/Break handling | Command
@Build | Build number of the operating system | Macro
Call | Execute a separate script | Command
CD | Change current directory | Command
Chr( ) | Returns ASCII representation of numeric value | Function
ClearEventLog( ) | Clears an NT event log | Function
Close( ) | Closes an ASCII file opened with OPEN | Function
CLS | Clear the console screen | Command
Color | change fore-/background color | Command
CompareFileTimes( ) | Compares the file date and time of two files | Function
Cookie1 | Creates 'cookie' for the 9x Logon API | Command
@Comment | User comment (Description field in User Manager) | Macro
Copy | Copy files | Command
CreateObject( ) | Launches the COM/OLE Automation server | Function
@CRLF | Returns a carriage-return line-feed combination | Macro
@CSD | CSD information (eg: "Service Pack 1") | Macro
@CurDir | Current directory | Macro
@Date | Date (in the format YYYY/MM/DD) | Macro
@Day | Day of the week (Monday, Tuesday, and so on) | Macro
Debug On/Off | Turn debug mode on or off during runtime | Command
DecToHex( ) | Returns the HEX equivalent given a decimal value | Function
Del | Delete files | Command
DelKey( ) | Delete key from registry | Function
DelPrinterConnection( ) | Remove a connection to a network printer (NT only) | Function
DelProgramGroup( ) | Delete a program group | Function
DelProgramItem( ) | Delete a program item from a program group | Function
DelTree( ) | Delete key from registry, including subkeys | Function
DelValue( ) | Delete value of key from registry | Function
Dim | Dimension a variable | Command
Dir | Enumerates directories | Function
Display | Display contents of a text file | Command
Do Until | Loop the loop | Command
@Domain | Domain or workgroup the computer belongs to | Macro
@DOS | Version of Windows NT | Macro
EnumGroup( ) | Returns name of global group the user is member of | Function
EnumIpInfo( ) | Enumerates TCP/IP information of network adapters | Function
EnumKey( ) | Returns name of subkey of key | Function
EnumLocalGroup( ) | Returns name of local group the user is member of | Function
EnumValue( ) | Returns name of value of key | Function
@Error | Return code of the most recent command or function. A return code of 0 means the command or function was successful. Any other value indicates an error. | Macro
Execute( ) | Executes a piece of script | Function
Exist( ) | Checks if a file exists | Function
Exit | exit current script, optionally with return code | Command
ExpandEnvironmentVars( ) | Expands environment variables in a string | Function
FlushKb | Remove any keystrokes from keyboard buffer | Command
For ... Each | Control statements to enumerate arrays | Command
For ... Next | Control stmts. to conditionally execute a set of statements | Command
@FullName | Full name of current user | Macro
Function ... EndFunction | Definition of user defined functions | Command
Get | Wait for single keystroke | Command
GetDiskSpace( ) | Returns free disk space (in Kbytes) | Function
GetFileAttr( ) | Retrieves attributes of a file | Function
GetFileSize( ) | Returns the size (in bytes) of a file | Function
GetFileTime( ) | Retrieves the date & time of a file | Function
GetFileVersion( ) | Returns the version string of a file | Function
GetObject( ) | Gets a COM object from a file stored on disk | Function
GetS | Accept a string of chars | Command
Global | Declare one of more global variables | Command
Go | Change the current drive | Command
Gosub | Call subroutine at label | Command
Goto | Jump to label | Command
@HomeDir | Short name of the directory part of home directory | Macro
@HomeDrive* | Drive letter of drive containing home directory | Macro
@HomeShr | Server and share name part of home directory | Macro
@HostName | Fully qualified TCP/IP host name (including TCP/IP domain name) | Macro
If ... Else ...Endif | Standard if/else construct | Command
InGroup( ) | Checks for membership of user of specified group | Function
@InWin | Operating system: 1 = Windows NT; 2 = Windows 9x | Macro
@IPAddressX | TCP/IP address (possible values for x are 0 - 3). Addresses are padded so that the resulting string always consists of four sets of three characters separated by periods (a total of 15 characters). For example, if your IP address is 123.45.6.7, @IPADDRESS0 is "123. 45. 6. 7". | Macro
InStr( ) | Searches a string in a string (parsing from left to tight) | Function
InStrRev( ) | Returns index of a substring in another string (parsing from right to left) | Function
KbHit( ) | Checks the console for keyboard input | Function
KeyExist( ) | Checks for the existence of a registry subkey | Function
@KiX | Version of KiXtart | Macro
@LanRoot | Directory where network software resides (usually Systemroot\System32) | Macro
LCase | Returns string in lower case | Function
@LDomain* | Logon (authenticating) domain | Macro
@LDrive | Drive that is redirected to \\logonserver\NETLOGON | Macro
Len( ) | Returns length of a string | Function
Left( ) | Returns a specified number of characters from the left side of a string | Function
@LM | Version of network software | Macro
LoadHive( ) | Load a registry hive | Function
LoadKey( ) | Loads (overwrites!) key (sub keys and values) | Function
LogEvent( ) | Creates an entry in the NT event log | Function
Logoff( ) | Logs current user off | Function
@LongHomeDir | Long name of the directory part of home directory | Macro
@LServer | Logon server | Macro
LTrim( ) | Strips leading spaces from string | Function
@MaxPWAge | Maximum password age | Macro
MD | Creates a folder on disk | Command
MessageBox( ) | Displays a standard Windows dialog box | Function
@MDayNo | Day of the month (1-31) | Macro
@Month | Name of the month | Macro
@MonthNo | Month number (January=1, December=12) | Macro
@MSecs | Milliseconds part of the current time | Macro
Open( ) | Opens an ASCII file | Function
Play | Plays 'music' from SPK-file, string or WAV-file | Command
@PrimaryGroup* | Current user's primary group | Macro
@Priv | User's privilege level (Guest, User, Admin) | Macro
@ProductSuite OS "Suite." Possible Values:
1 | "Small Business"
2 | "Enterprise"
4 | "BackOffice"
8 | "CommunicationServer"
16 | "Terminal Server"
32 | "Small Business (Restricted)"
64 | "Embedded NT"
128 | "DataCenter"
256 | "Single User Terminal Server"
512 | "Home Edition"
1024 | "Blade Server"
 Macro
@ProductType OS type. Possible values:
"Windows 95"
"Windows 98"
"Windows Me"
"Windows NT Workstation"
"Windows NT Server"
"Windows NT Domain Controller"
"Windows 2000 Professional"
"Windows 2000 Server"
"Windows 2000 Domain Controller"
"Windows XP Home Edition"
"Windows XP Professional"
"Windows XP Server"
"Windows XP Domain Controller" 		Macro
@PWAge | Password age | Macro
Quit | Exit script, optionally with an exitcode | Command
@RAS | Number of active Remote Access Service (RAS) connections | Macro
RD | Remove folder from disk | Command
ReadLine( ) | Reads a line from an ASCII file opened with OPEN | Function
ReadProfileString( ) | Read string from an .ini file | Function
ReadType( ) | Returns ASCII representation of type (eg: REG_SZ) | Function
ReadValue( ) | Returns ASCII representation of value | Function
ReDim | Re-declare arrays | Command
RedirectOutput( ) | Redirects all output to a file | Function
Return | Exits a subroutine or script | Command
Right( ) | Returns a specified number of characters from the right side of a string | Function
Rnd( ) | Returns a pseudo random number | Function
@RServer* | KXRPC server used for the current session | Macro
RTrim( ) | Strips trailing spaces from string | Function
Run | WinExec's a program (script continues) | Command
SaveKey( ) | Saves entire key (including sub keys and values) | Function
@ScriptDir | Directory of current script | Macro
Select ... Case ... EndSelect | 'CASE' statement | Command
SendKeys( ) | Sends keystrokes to the focused application | Function
SendMessage( ) | Send a message to another user or workstation | Function
@SError | Error text corresponding with @ERROR | Macro
Set | Sets variables in environment CURRENT_USER (NT) | Command
SetL | Sets variables in local environment (NT) | Command
SetM | Sets variables in environment. of LOCAL_MACHINE (NT) | Command
SetAscii( ) | Enables/disables ASCII output | Function
SetConsole( ) | Change display mode of console | Function
SetDefaultPrinter( ) | Sets the default printer | Function
SetFileAttr( ) | Sets attributes of a file | Function
SetFocus( ) | Sets focus to a specific application | Function
SetOption( ) | Enables/disables global settings of the interpreter | Function
SetSystemState( ) | Changes the (power) state of the local system | Function
SetTime | Synchronize local time with time on server | Command
SetTitle( ) | Sets the Window title of the current console | Function
SetWallpaper( ) | Sets the current wallpaper | Function
Shell | Executes a program, and waits for completion | Command
ShowProgramGroup( ) | Change display status of a program group | Function
ShutDown( ) | Shutdown or reboot local or remote system | Function
@SID* | Current user's Windows NT Security Identifier (SID) | Macro
SidToName( ) | Translates a Security Identifier (SID) into a name | Function
@Site** | Name of the site in which the system resides | Macro
Sleep | Suspends script for xx seconds | Command
Small | Resets character mode to normal | Command
Split( ) | Splits a single string into an array given a delimiter | Function
SRnd( ) | Sets the starting point for generating pseudorandom integers | Function
@StartDir | Directory from which KiXtart was started | Macro
Substr( ) | Returns a substring from a string | Function
@SysLang | Full English name of the language of the operating system specified in the format defined by ISO Standard 639. (example : “0413Dutch (Standard)”). | Macro
@Ticks | Milliseconds elapsed since computer was last booted. | Macro
@TIME | Current time (in the format HH:MM:SS) | Macro
Trim( ) | Strips leading and trailing spaces from a string | Function
Ubound( ) | Returns the largest available subscript for an array | Function
UCase( ) | Returns string in upper case | Function
UnloadHive( ) | Unload a registry hive | Function
Use | Connects/disconnects to/from network shares | Command
@USERID | Current user's Windows NT user ID | Macro
@USERLANG | Full English name of the language selected by the current user specified in the format defined by ISO Standard 639. (example : “0413Dutch (Standard)”). | Macro
Val( ) | Returns the numerical value of a string | Function
VarType( ) | Returns an integer value indicating the subtype of a variable | Function
VarTypeName( ) | Returns a string that provides type info. about a variable | Function
@WDayNo | Days since Sunday (1 – 7) | Macro
While ... Loop | loop the loop | Command
@WKSTA | Computer name | Macro
WriteLine( ) | Write a line of text to a file | Function
WriteProfileString( ) | Write string to an ini-file | Function
WriteValue( ) | Write single value to registry | Function
@WUserID | Current user's Windows user ID | Macro
@YDayNo | Days since January 1 (1 – 365) | Macro
@Year | Current year | Macro

* Available on computers running Windows 9x only if the KiXtart RPC service is running.
** Only available on clients with full Active Directory support.


KiXtart and the console

KiXtart Reference

KiXtart 2001 and the console

KiXtart 2001 is provided in two ‘flavors’: the standard console-based version and a Windows version. The Windows version will only display a console if and when any output is sent to the screen. If desired, this behavior can be overridden using the /I (Invisible) command line option.

Note:
By default, the Windows version of KiXtart 2001 runs as an asynchronous process. This means that if you start WKIX32.EXE from a batch file, the batch file will continue processing and will not wait for KiXtart to exit. This behavior can cause problems if KiXtart is being used as part of the logon process, especially on Windows 9x clients. To prevent these problems, WKIX32.EXE should be started from a batch file using the START command, eg: “START /w WKIX32.EXE”.

The console version (KIX32.EXE) behaves exactly like KiXtart 95, and will automatically cause a console window to be created upon startup.


COM automation in KiXtart 2001

KiXtart Reference

COM automation in KiXtart 2001

COM Automation is a way for applications (such as Word and Excel) to expose functionality to other applications, including scripting languages such as KiXtart. This provides an easy way to access properties and call methods of other applications from within a script.

Note: the new COM automation support in KiXtart 2001 replaces the OLE functions in previous versions of KiXtart.

Creating a COM object in KiXtart is simple:

$Object = CreateObject("WScript.Shell")
$ExcelSheet = CreateObject("Excel.Sheet")

To release all system and memory resources associated with an object, simply assign any other value to the variable:

$Object = 0

The following three sample scripts demonstrate just a few of the ways in which COM automation canbe used in KiXtart scripts. Please consult Microsoft Developer Network (MSDN) for more information on the many possibilities of COM automation.

Sample 1: script using COM automation and Active Directory Services Interface (ADSI) to retrieve various global properties of an LDAP server:

$root = GetObject("LDAP://RootDSE")

$root.GetInfo

? "ADSPath: " + $root.ADSPath
? "GUID : " + $root.GUID
? "Name : " + $root.Name
? "Parent : " + $root.Parent
? "DNC : " + $root.defaultNamingContext

Sample 2: script using COM automation and Windows Management Instrumentation (WMI) to enumerate the logical disks of the local system:

$Drives = GetObject("winmgmts:").ExecQuery("select Name,DriveType from Win32_LogicalDisk")

if @error <> 0
  ? @error + " / " @serror
else
  for each $Drive in $Drives
    ? $Drive.Name
  next
endif

Sample 3: script demonstrating how to start Excel and add data to a worksheet:

$oXL = CreateObject("EXCEL.application")

if @error = 0
  $oXL.Visible = 1 ; make Excel visible to the user
  $rc=$oXL.Workbooks.Add ; add a new workbook
  $array = "Order #", "Amount", "Tax"
  $oXL.Range("A1:C1").Value = $array ;add some columns

  For $i = 0 To 19
    $oXL.Cells(($i+2),1).Value = "ORD" + ($i + 1000)
    $oXL.Cells(($i+2),2).Value = rnd() / 100
  Next

  ;Fill the last column with a formula to compute the sales tax.
  $oXL.Range("C2").Resize(20, 1).Formula = "=B2*0.07"

  ;Format the worksheet
  $oXL.Range("A1:C1").Font.Bold = 1
  $rc=$oXL.Range("A1:C1").EntireColumn.AutoFit

  $oXL.UserControl = 1
else
  ? @error + " / " @serror
endif


KiXtart General Syntax Rules

KiXtart Reference

General Syntax Rules

KiXtart is a free-format scripting language. It is not case-sensitive. This means that...

IF @PRIV="ADMIN" DISPLAY "ADMIN.TXT" ELSE DISPLAY "USER.TXT" ENDIF

is equivalent to

If @PRIV = "ADMIN"
  Display "ADMIN.TXT"
Else
  Display "USER.TXT"
Endif

When using KiXtart, note the following rules:

  • Strings can contain any characters, except the \0 (NULL) and \x1a (end of file) characters.
  • Script commands should be separated by white space — that is, any combination of spaces, tabs, or new line characters.
  • If a string contains delimiters (-, +, *, and so on), the string must be enclosed in quotation marks. For example:
'String with a dash (-) in it.'  ; String with a dash (-) in it.


KiXtart Expressions

KiXtart Reference

Expressions

KiXtart supports two types of expressions: numeric and string. When working with expressions, KiXtart evaluates and resolves each part of the expression in a predetermined order. This predetermined order is known as operator precedence.

Numeric Expressions

Numeric expressions can consist of any combination of:

  • Sub-expressions
  • Numeric values (in decimal or hexadecimal notation)
  • Functions that return a numeric value
  • Object references
  • Numeric operators (+, – , *, /, &, |)

KiXtart support the following numeric operators:

+ | Used to sum two numbers.
- | Used to find the difference between two numbers or to indicate the negative value of a numeric expression.
* | Used to multiply two numbers.
/ | Used to divide two numbers and return an integer result.
& | The & operator performs a bit-wise mathematical AND operation on two numbers.
| | The | operator performs a bit-wise mathematical OR operation on two numbers.

To specify a number in hexadecimal notation, prepend it with an ampersand (‘&’).

String Expressions

A string expression can consist of any combination of the following:

  • Literals (a sequence of characters enclosed in quotation marks)
  • Functions that return a string
  • Object references
  • Plus signs (+), which indicate concatenated sub-expressions

A string expression can contain up to 32,000 characters. Any macros, or references to environment strings within a string (eg: “String with the macro @USERID in it.”) are resolved before the string is evaluated. For compatibility reasons, references to variables inside strings (eg: “String with a $Var in it.”) are also resolved before the string is displayed. The only exception to this rule are arrays, which can not be used inside strings. To use arrays or object references in combination with strings, you have to use concatenation.

Note: The characters @, %, or $ are normally used to indicate macros, environment strings, or variables. If you want to use these characters in a string, use @@, %%, or $$.

The following examples show the correct use of expressions in KiXtart:

 $X = 1 + "20"  ; $X type = integer / value = 21.
 $X = &10 + &A  ; $X type = integer / value = &1A (26).

 $X = "1" + "20"  ; $X type = string / value = '120'.
 $X = @USERID + "1"  ; $X type = string / value = 'USER1'.
 "Current time =  " + @time  ; prints: "Current time = 12:34:00"
 "Use @@time to print the time"  ; prints: "Use @time to print the time "
 $Y = "And this is how you access environment variables: %USERNAME%..."
 IF @Day='Sunday' AND @USERID = 'RuudV'
 $X = (@MONTHNO=3 AND @MDAYNO>=20) OR @MONTHNO=4
 IF @WKSTA="VLEERBEER" OR @WKSTA="PALOMINE"
 $X = ((@YDAYNO + 7) / 7) + 1

Old style use of variables inside a string:

    "Use of a variable $Var inside a string."

New, preferred style to use variables in combination with strings:

    "Use of a variable " + $Var + " inside a string."

Strings in the script are displayed on the screen in the current character size starting from the current cursor position. For information about character size, see the BIG and SMALL commands.

A string can be enclosed in single or double quotation marks. To specify quotation marks in a string, either use the CHR function or enclose the entire string in the opposite type of quotation marks — .that is, if you want to include single quotation marks in a string, enclose the string in double quotation marks, and vice versa.

The following examples show the correct use of string expressions in KiXtart:

Code Output
"Hi "+ @userid
Hi RuudV
'Double quote in a string: (")'
Double quote in a string: (")

"Single quote in a string: (')"

Single quote in a string: (')

"More double quote: " + Chr(34)
More double quote: "

KiXtart determines the type of the expression from the first element of the expression.

Both string and numeric expressions can contain the following conditional and logical operators:

< | Less than
> | Greater than
= | Equal (case insensitive)
== | Equal (case sensitive)
<> | Not equal
<= | Less than or equal
>= | Greater than or equal
And | Logical AND
Or | Logical OR
Not | Unary NOT

Operator Precedence

When several operations occur in an expression, KiXtart evaluates and resolves each part of the expression in a predetermined order. This predetermined order is known as operator precedence.

Parentheses can be used to override the order of precedence and force some parts of an expression to be evaluated before other parts. Operations within parentheses are always performed before those outside the parentheses. Within parentheses standard operator precedence is maintained.

The precedence of operators affects the grouping and evaluation of operands in expressions. Expressions with higher-precedence operators are evaluated first.

The following table summarizes the precedence of the supported operators, listing them in order of precedence from highest to lowest. Where several operators appear together, they have equal precedence and are evaluated from left to right.

Operator | Type of operation
[ ] ( ) | Expression
+ - Not | Unary
* / | Multiplicative
+ - | Addition
< > <= >= | Relational
= == | Equality
And Or | Logical AND, Logical OR


KiXtart Dynamic Program Variables

KiXtart Reference

Dynamic Program Variables

Introduction
 In KiXtart, variables are used to temporarily store values during the execution of a script. Variables have a name (the word you use to refer to the value the variable contains) a type (which determines the kind of data the variable can store) and a scope (which determines where in the script you can reference the variable). You can think of a variable as a placeholder in memory for an unknown value.

Storing data in variables
 Variables can be assigned a particular value by using an assignment statement:

$Variable = 10

or by using a GET or GETS statement :

GET $Variable

Optionally, variables can be created and assigned a value on the command line with which KiXtart is started. To do this, type the variable name followed by an equal sign (=) and the value the variable should have. For example:
KIX32 Demo.kix $Key=Value

On the command line, do not include spaces between the equal sign (=) and the value. If you want to specify a value that contains spaces, enclose it in quotation marks (for example, KIX32 Demo.kix $Key="Hi there").

Declaring Variables
 To declare a variable is to tell the program about it in advance. You declare a variable with the Dim or the Global statement, supplying a name for the variable:

DIM variablename

Variables declared with the Dim statement exist only as long as the script is executing. When the script finishes, the variable, and its value, disappear. Variables declared with the Global statement exist during the entire KiXtart session.

A variable name:

  • Can't contain operator characters (+,-,*,/,&,<,>,=)
  • Must not exceed 14 characters.
  • Must be unique within the same scope, which is the range from which the variable can be referenced in a script, or script segment.

Note: You can use the same name for variables in different scopes, and if you do, you will only be able to reference the variable in the current scope. Please see the example below for more details:

$Var = 10
IF InGroup( “Admins” )
  DIM $Var ; local variable with same name
  $Var = 20
  ? $Var   ; this will display ‘20’
ENDIF
? $Var     ; this will display ‘10’

Implicit declaration
 Variables don’t have to be declared before they can be used. You can also implicitly declare them simply by assigning a value to them. Note that all variables that are declared in this way have a global scope (see below for details on scope).

Scope of variables
 Depending on how and where they are declared, variables can have a local or a global scope. Variables with a global scope are visible anywhere in any script during the entire KiXtart session. Variables with a local scope are only visible to the script or script segment in which they were created.

Examples:

$GlobalVariable = 10
 Assuming this is the first reference to ‘$GlobalVariable’, this variable is implicitly declared and will become a global variable, visible everywhere in every script during this KiXtart session.

DIM $LocalVariable
$LocalVariable = 10
This variable will become a local variable and will be visible only in the current script.

IF $X = 1
   DIM $LocalVariable
   $LocalVariable = 10
ENDIF
In this example, $LocalVariable will only be visible inside the IF statement.

GOSUB Demo
EXIT 1
:Demo
DIM $LocalVariable
$LocalVariable = 10
RETURN
 In this example, $LocalVariable will only be visible inside the subroutine ‘Demo’.

Variable types
There are two types of variables: string and integer. String variables can contain up to 32,000 characters. Integer variables can contain any value between -2,147,483,648 and 2,147,483,647. The type of a variable is automatically changed to the result of the expression that is assigned to it. This means that if you assign a string to an integer, the integer is changed to a string.

There is no limit on the number of variables that can be defined, other than the amount of memory available to KiXtart.

Arrays
 KiXtart supports single dimension arrays. Arrays allow you to refer to a series of variables by the same name and to use a number (an index) to tell them apart. This helps you create smaller and simpler code in many situations, because you can set up loops that deal efficiently with any number of cases by using the index number. Arrays have both upper and lower bounds, and the elements of the array are contiguous within those bounds. Because KiXtart allocates space for each index number, avoid declaring an array larger than necessary.

Unlike normal variables, arrays must be declared explicitly before they can be used.

When declaring an array, follow the array name by the upper bound in square brackets. The upper bound cannot exceed 2,147,483,647.

Examples:

Dim $Counters[14]     ; explicit declaration
Dim $Sums[20]         ; explicit declaration
$NewArray = 10,20,30  ; implicit declaration
$NewArray = "A1","B2","C3" ; implicit declaration

The first declaration creates an array with 14 elements, with index numbers running from 0 to 13. The second creates an array with 20 elements, with index numbers running from 0 to 19. The third, implicit, declaration creates an array with 3 elements, with index numbers running from 0 to 2.

All elements of an array that has been declared explicitly have the same type: integer. Individual elements of an array can subsequently be changed to the string type (just as any other variable) simply by assigning a string expression to them.

Note: Unlike regular variables, arrays can not be used inside strings and can also not be assigned a value on the command line.


KiXtart Macro Reference

KiXtart Reference

Macro Reference

Macros can be used anywhere an expression is expected. Supported macros are defined in the following table.

Bold items are new to this release

Macro | Definition
@Address | Address of the network adapter
@Build | Build number of the operating system
@Comment | User comment (Description field in User Manager)
@CRLF | Returns a carriage-return line-feed combination
@CSD | CSD information (eg: "Service Pack 1")
@CurDir | Current directory
@Date | Date (in the format YYYY/MM/DD)
@Day | Day of the week (Monday, Tuesday, etc.)
@Domain | Domain or workgroup the computer belongs to
@DOS | Version of Windows NT
@Error | Return code of the most recent command or function. A return code of 0 means the command or function was successful. Any other value indicates an error.
@FullName | Full name of current user
@HomeDir | Short name of the directory part of home directory
@HomeDrive* | Drive letter of drive containing home directory
@HomeShr | Server and share name part of home directory
@HostName | Fully qualified TCP/IP host name (including TCP/IP domain name)
@InWin | Operating system: 1 = Windows NT; 2 = Windows 9x
@IPAddressX TCP/IP address (possible values for X are 0 - 3).
Note: Addresses are padded so that the resulting string always consists of four sets of three characters separated by periods. For example, if your IP address is 123.45.6.7, @IPADDRESS0 is "123. 45. 6. 7"
@KiX | Version of KiXtart
@LanRoot | Directory where network software resides (usually Systemroot\System32)
@LDomain* | Logon domain
@LDrive | Drive that is redirected to \\logonserver\NETLOGON
@LM | Version of network software
@LongHomeDir | Long name of the directory part of home directory
@LServer | Logon server
@MaxPWAge | Maximum password age (Note: if passwords are set not to expire, this value is set to ((unsigned long)-1) (or 0xFFFFFFFF in hex). This evaluates to 4294967295 decimal).
@MDayNo | Day of the month (1-31)
@MonthNo | Month number, beginning with January (1-12)
@Month | Name of the month
@MSecs | Milliseconds part of the current time
@PrimaryGroup* | Current user's primary group
@Priv | User's privilege level (GUEST, USER, ADMIN)
@ProductSuite OS Suite. Possible Values:
1 | "Small Business"
2 | "Enterprise"
4 | "BackOffice"
8 | "CommunicationServer"
16 | "Terminal Server"
32 | "Small Business (Restricted)"
64 | "Embedded NT"
128 | "DataCenter"
256 | "Single User Terminal Server"
512 | "Home Edition"
1024 | "Blade Server"
@ProductType OS type. Possible values:
"Windows 95"
"Windows 98"
"Windows Me"
"Windows NT Workstation"
"Windows NT Server"
"Windows NT Domain Controller"
"Windows 2000 Professional"
"Windows 2000 Server"
"Windows 2000 Domain Controller"
"Windows XP Home Edition"
"Windows XP Professional"
"Windows XP Server"
"Windows XP Domain Controller"
@PWAge | Password age
@RAS | Number of active Remote Access Service (RAS) connections
@RServer* | KXRPC server used for the current session
@ScriptDir | Directory of current script
@SError | Error text corresponding with @ERROR
@SID* | Current user's Windows NT Security Identifier (SID)
@Site** | Name of the site in which the system resides
@StartDir | Directory from which KiXtart was started
@SysLang | Full English name of the language of the operating system specified in the format defined by ISO Standard 639. (example : “0413Dutch (Standard)”).
@Ticks | Number of milliseconds elapsed since computer was last booted.
@Time | Current time (in the format HH:MM:SS)
@UserID | Current user's Windows NT user ID
@UserLang | Full English name of the language selected by the current user specified in the format defined by ISO Standard 639. (example : “0413Dutch (Standard)”).
@WDayNo | Days since Sunday (1 – 7)
@Wksta | Computer name
@WUserID | Current user's Windows user ID
@YDayNo | Days since January 1 (1 – 365)
@Year | Current year

*Available on computers running Windows 9x only if the KiXtart RPC service is running.
**Only available on clients with full Active Directory support.

Note: During the logon sequence, @WUserID is empty on computers running Windows 9x if Windows NT Networking has been configured as the system's primary network provider.

The following examples show the correct use of KiXtart macros:

@LM

"2.10"

@DATE

"1997/10/03"

DISPLAY @USERID + ".TXT"

displays the file "RUUDV.TXT"

CD "\DATA\" + @DOMAIN

changes the current directory to "\DATA\your-domain"


KiXtart Error Codes

KiXtart Reference

Error Handling

To find out if a KiXtart command or function is successful, always check the @ERROR and @SERROR macros. Note that most functions also return the error code.

If @ERROR is zero, the previous command or function was successful. If @ERROR is non-zero, the value corresponds to the error code returned by the most recently executed Win32 API.

To find out what a specific error code means, please consult the list of Win32 error codes on the Microsoft Developer Network:

http://msdn.microsoft.com/library/en-us/debug/errlist_7oz7.asp

The above link will take you to the Microsoft website which contains the most current information. If you do not have access to the Internet right now, a 'shot' list of error codes is still included with this help system.


Code

KiXtart Reference

Error Handling

To find out if a KiXtart command or function is successful, always check the @ERROR and @SERROR macros. Note that most functions also return the error code.

If @ERROR is zero, the previous command or function was successful. If @ERROR is non-zero, the value corresponds to the error code returned by the most recently executed Win32 API.

Code | Error
0L | NO_ERROR, ERROR_SUCCESS
1L | ERROR_INVALID_FUNCTION
2L | ERROR_FILE_NOT_FOUND
3L | ERROR_PATH_NOT_FOUND
4L | ERROR_TOO_MANY_OPEN_FILES
5L | ERROR_ACCESS_DENIED
6L | ERROR_INVALID_HANDLE
7L | ERROR_ARENA_TRASHED
8L | ERROR_NOT_ENOUGH_MEMORY
9L | ERROR_INVALID_BLOCK
10L | ERROR_BAD_ENVIRONMENT
11L | ERROR_BAD_FORMAT
12L | ERROR_INVALID_ACCESS
13L | ERROR_INVALID_DATA
14L | ERROR_OUTOFMEMORY
15L | ERROR_INVALID_DRIVE
16L | ERROR_CURRENT_DIRECTORY
17L | ERROR_NOT_SAME_DEVICE
18L | ERROR_NO_MORE_FILES
19L | ERROR_WRITE_PROTECT
20L | ERROR_BAD_UNIT
21L | ERROR_NOT_READY
22L | ERROR_BAD_COMMAND
23L | ERROR_CRC
24L | ERROR_BAD_LENGTH
25L | ERROR_SEEK
26L | ERROR_NOT_DOS_DISK
27L | ERROR_SECTOR_NOT_FOUND
28L | ERROR_OUT_OF_PAPER
29L | ERROR_WRITE_FAULT
30L | ERROR_READ_FAULT
31L | ERROR_GEN_FAILURE
32L | ERROR_SHARING_VIOLATION
33L | ERROR_LOCK_VIOLATION
34L | ERROR_WRONG_DISK
36L | ERROR_SHARING_BUFFER_EXCEEDED
38L | ERROR_HANDLE_EOF
39L | ERROR_HANDLE_DISK_FULL
50L | ERROR_NOT_SUPPORTED
51L | ERROR_REM_NOT_LIST
52L | ERROR_DUP_NAME
53L | ERROR_BAD_NETPATH
54L | ERROR_NETWORK_BUSY
55L | ERROR_DEV_NOT_EXIST
56L | ERROR_TOO_MANY_CMDS
57L | ERROR_ADAP_HDW_ERR
58L | ERROR_BAD_NET_RESP
59L | ERROR_UNEXP_NET_ERR
60L | ERROR_BAD_REM_ADAP
61L | ERROR_PRINTQ_FULL
62L | ERROR_NO_SPOOL_SPACE
63L | ERROR_PRINT_CANCELLED
64L | ERROR_NETNAME_DELETED
65L | ERROR_NETWORK_ACCESS_DENIED
66L | ERROR_BAD_DEV_TYPE
67L | ERROR_BAD_NET_NAME
68L | ERROR_TOO_MANY_NAMES
69L | ERROR_TOO_MANY_SESS
70L | ERROR_SHARING_PAUSED
71L | ERROR_REQ_NOT_ACCEP
72L | ERROR_REDIR_PAUSED
80L | ERROR_FILE_EXISTS
82L | ERROR_CANNOT_MAKE
83L | ERROR_FAIL_I24
84L | ERROR_OUT_OF_STRUCTURES
85L | ERROR_ALREADY_ASSIGNED
86L | ERROR_INVALID_PASSWORD
87L | ERROR_INVALID_PARAMETER
88L | ERROR_NET_WRITE_FAULT
89L | ERROR_NO_PROC_SLOTS
100L | ERROR_TOO_MANY_SEMAPHORES
101L | ERROR_EXCL_SEM_ALREADY_OWNED
102L | ERROR_SEM_IS_SET
103L | ERROR_TOO_MANY_SEM_REQUESTS
104L | ERROR_INVALID_AT_INTERRUPT_TIME
105L | ERROR_SEM_OWNER_DIED
106L | ERROR_SEM_USER_LIMIT
107L | ERROR_DISK_CHANGE
108L | ERROR_DRIVE_LOCKED
109L | ERROR_BROKEN_PIPE
110L | ERROR_OPEN_FAILED
111L | ERROR_BUFFER_OVERFLOW
112L | ERROR_DISK_FULL
113L | ERROR_NO_MORE_SEARCH_HANDLES
114L | ERROR_INVALID_TARGET_HANDLE
117L | ERROR_INVALID_CATEGORY
118L | ERROR_INVALID_VERIFY_SWITCH
119L | ERROR_BAD_DRIVER_LEVEL
120L | ERROR_CALL_NOT_IMPLEMENTED
121L | ERROR_SEM_TIMEOUT
122L | ERROR_INSUFFICIENT_BUFFER
123L | ERROR_INVALID_NAME
124L | ERROR_INVALID_LEVEL
125L | ERROR_NO_VOLUME_LABEL
126L | ERROR_MOD_NOT_FOUND
127L | ERROR_PROC_NOT_FOUND
128L | ERROR_WAIT_NO_CHILDREN
129L | ERROR_CHILD_NOT_COMPLETE
130L | ERROR_DIRECT_ACCESS_HANDLE
131L | ERROR_NEGATIVE_SEEK
132L | ERROR_SEEK_ON_DEVICE
133L | ERROR_IS_JOIN_TARGET
134L | ERROR_IS_JOINED
135L | ERROR_IS_SUBSTED
136L | ERROR_NOT_JOINED
137L | ERROR_NOT_SUBSTED
138L | ERROR_JOIN_TO_JOIN
139L | ERROR_SUBST_TO_SUBST
140L | ERROR_JOIN_TO_SUBST
141L | ERROR_SUBST_TO_JOIN
142L | ERROR_BUSY_DRIVE
143L | ERROR_SAME_DRIVE
144L | ERROR_DIR_NOT_ROOT
145L | ERROR_DIR_NOT_EMPTY
146L | ERROR_IS_SUBST_PATH
147L | ERROR_IS_JOIN_PATH
148L | ERROR_PATH_BUSY
149L | ERROR_IS_SUBST_TARGET
150L | ERROR_SYSTEM_TRACE
151L | ERROR_INVALID_EVENT_COUNT
152L | ERROR_TOO_MANY_MUXWAITERS
153L | ERROR_INVALID_LIST_FORMAT
154L | ERROR_LABEL_TOO_LONG
155L | ERROR_TOO_MANY_TCBS
156L | ERROR_SIGNAL_REFUSED
157L | ERROR_DISCARDED
158L | ERROR_NOT_LOCKED
159L | ERROR_BAD_THREADID_ADDR
160L | ERROR_BAD_ARGUMENTS
161L | ERROR_BAD_PATHNAME
162L | ERROR_SIGNAL_PENDING
164L | ERROR_MAX_THRDS_REACHED
167L | ERROR_LOCK_FAILED
170L | ERROR_BUSY
173L | ERROR_CANCEL_VIOLATION
174L | ERROR_ATOMIC_LOCKS_NOT_SUPPORTED
180L | ERROR_INVALID_SEGMENT_NUMBER
182L | ERROR_INVALID_ORDINAL
183L | ERROR_ALREADY_EXISTS
186L | ERROR_INVALID_FLAG_NUMBER
187L | ERROR_SEM_NOT_FOUND
188L | ERROR_INVALID_STARTING_CODESEG
189L | ERROR_INVALID_STACKSEG
190L | ERROR_INVALID_MODULETYPE
191L | ERROR_INVALID_EXE_SIGNATURE
192L | ERROR_EXE_MARKED_INVALID
193L | ERROR_BAD_EXE_FORMAT
194L | ERROR_ITERATED_DATA_EXCEEDS_64k
195L | ERROR_INVALID_MINALLOCSIZE
196L | ERROR_DYNLINK_FROM_INVALID_RING
197L | ERROR_IOPL_NOT_ENABLED
198L | ERROR_INVALID_SEGDPL
199L | ERROR_AUTODATASEG_EXCEEDS_64k
200L | ERROR_RING2SEG_MUST_BE_MOVABLE
201L | ERROR_RELOC_CHAIN_XEEDS_SEGLIM
202L | ERROR_INFLOOP_IN_RELOC_CHAIN
203L | ERROR_ENVVAR_NOT_FOUND
205L | ERROR_NO_SIGNAL_SENT
206L | ERROR_FILENAME_EXCED_RANGE
207L | ERROR_RING2_STACK_IN_USE
208L | ERROR_META_EXPANSION_TOO_LONG
209L | ERROR_INVALID_SIGNAL_NUMBER
210L | ERROR_THREAD_1_INACTIVE
212L | ERROR_LOCKED
214L | ERROR_TOO_MANY_MODULES
215L | ERROR_NESTING_NOT_ALLOWED
230L | ERROR_BAD_PIPE
231L | ERROR_PIPE_BUSY
232L | ERROR_NO_DATA
233L | ERROR_PIPE_NOT_CONNECTED
234L | ERROR_MORE_DATA
240L | ERROR_VC_DISCONNECTED
254L | ERROR_INVALID_EA_NAME
255L | ERROR_EA_LIST_INCONSISTENT
259L | ERROR_NO_MORE_ITEMS
266L | ERROR_CANNOT_COPY
267L | ERROR_DIRECTORY
275L | ERROR_EAS_DIDNT_FIT
276L | ERROR_EA_FILE_CORRUPT
277L | ERROR_EA_TABLE_FULL
278L | ERROR_INVALID_EA_HANDLE
282L | ERROR_EAS_NOT_SUPPORTED
288L | ERROR_NOT_OWNER
298L | ERROR_TOO_MANY_POSTS
317L | ERROR_MR_MID_NOT_FOUND
487L | ERROR_INVALID_ADDRESS
534L | ERROR_ARITHMETIC_OVERFLOW
535L | ERROR_PIPE_CONNECTED
536L | ERROR_PIPE_LISTENING
994L | ERROR_EA_ACCESS_DENIED
995L | ERROR_OPERATION_ABORTED
996L | ERROR_IO_INCOMPLETE
997L | ERROR_IO_PENDING
998L | ERROR_NOACCESS
999L | ERROR_SWAPERROR
1001L | ERROR_STACK_OVERFLOW
1002L | ERROR_INVALID_MESSAGE
1003L | ERROR_CAN_NOT_COMPLETE
1004L | ERROR_INVALID_FLAGS
1005L | ERROR_UNRECOGNIZED_VOLUME
1006L | ERROR_FILE_INVALID
1007L | ERROR_FULLSCREEN_MODE
1008L | ERROR_NO_TOKEN
1009L | ERROR_BADDB
1010L | ERROR_BADKEY
1011L | ERROR_CANTOPEN
1012L | ERROR_CANTREAD
1013L | ERROR_CANTWRITE
1014L | ERROR_REGISTRY_RECOVERED
1015L | ERROR_REGISTRY_CORRUPT
1016L | ERROR_REGISTRY_IO_FAILED
1017L | ERROR_NOT_REGISTRY_FILE
1018L | ERROR_KEY_DELETED
1019L | ERROR_NO_LOG_SPACE
1020L | ERROR_KEY_HAS_CHILDREN
1021L | ERROR_CHILD_MUST_BE_VOLATILE
1022L | ERROR_NOTIFY_ENUM_DIR
1051L | ERROR_DEPENDENT_SERVICES_RUNNING
1052L | ERROR_INVALID_SERVICE_CONTROL
1053L | ERROR_SERVICE_REQUEST_TIMEOUT
1054L | ERROR_SERVICE_NO_THREAD
1055L | ERROR_SERVICE_DATABASE_LOCKED
1056L | ERROR_SERVICE_ALREADY_RUNNING
1057L | ERROR_INVALID_SERVICE_ACCOUNT
1058L | ERROR_SERVICE_DISABLED
1059L | ERROR_CIRCULAR_DEPENDENCY
1060L | ERROR_SERVICE_DOES_NOT_EXIST
1061L | ERROR_SERVICE_CANNOT_ACCEPT_CTRL
1062L | ERROR_SERVICE_NOT_ACTIVE
1063L | ERROR_FAILED_SERVICE_CONTROLLER_CONNECT
1064L | ERROR_EXCEPTION_IN_SERVICE
1065L | ERROR_DATABASE_DOES_NOT_EXIST
1066L | ERROR_SERVICE_SPECIFIC_ERROR
1067L | ERROR_PROCESS_ABORTED
1068L | ERROR_SERVICE_DEPENDENCY_FAIL
1069L | ERROR_SERVICE_LOGON_FAILED
1070L | ERROR_SERVICE_START_HANG
1071L | ERROR_INVALID_SERVICE_LOCK
1072L | ERROR_SERVICE_MARKED_FOR_DELETE
1073L | ERROR_SERVICE_EXISTS
1074L | ERROR_ALREADY_RUNNING_LKG
1075L | ERROR_SERVICE_DEPENDENCY_DELETED
1076L | ERROR_BOOT_ALREADY_ACCEPTED
1077L | ERROR_SERVICE_NEVER_STARTED
1078L | ERROR_DUPLICATE_SERVICE_NAME
1100L | ERROR_END_OF_MEDIA
1101L | ERROR_FILEMARK_DETECTED
1102L | ERROR_BEGINNING_OF_MEDIA
1103L | ERROR_SETMARK_DETECTED
1104L | ERROR_NO_DATA_DETECTED
1105L | ERROR_PARTITION_FAILURE
1106L | ERROR_INVALID_BLOCK_LENGTH
1107L | ERROR_DEVICE_NOT_PARTITIONED
1108L | ERROR_UNABLE_TO_LOCK_MEDIA
1109L | ERROR_UNABLE_TO_UNLOAD_MEDIA
1110L | ERROR_MEDIA_CHANGED
1111L | ERROR_BUS_RESET
1112L | ERROR_NO_MEDIA_IN_DRIVE
1113L | ERROR_NO_UNICODE_TRANSLATION
1114L | ERROR_DLL_INIT_FAILED
1115L | ERROR_SHUTDOWN_IN_PROGRESS
1116L | ERROR_NO_SHUTDOWN_IN_PROGRESS
1117L | ERROR_IO_DEVICE
1118L | ERROR_SERIAL_NO_DEVICE
1119L | ERROR_IRQ_BUSY
1120L | ERROR_MORE_WRITES
1121L | ERROR_COUNTER_TIMEOUT
1122L | ERROR_FLOPPY_ID_MARK_NOT_FOUND
1123L | ERROR_FLOPPY_WRONG_CYLINDER
1124L | ERROR_FLOPPY_UNKNOWN_ERROR
1125L | ERROR_FLOPPY_BAD_REGISTERS
1126L | ERROR_DISK_RECALIBRATE_FAILED
1127L | ERROR_DISK_OPERATION_FAILED
1128L | ERROR_DISK_RESET_FAILED
1129L | ERROR_EOM_OVERFLOW
1130L | ERROR_NOT_ENOUGH_SERVER_MEMORY
1131L | ERROR_POSSIBLE_DEADLOCK
1132L | ERROR_MAPPED_ALIGNMENT
1140L | ERROR_SET_POWER_STATE_VETOED
1141L | ERROR_SET_POWER_STATE_FAILED
1150L | ERROR_OLD_WIN_VERSION
1151L | ERROR_APP_WRONG_OS
1152L | ERROR_SINGLE_INSTANCE_APP
1153L | ERROR_RMODE_APP
1154L | ERROR_INVALID_DLL
1155L | ERROR_NO_ASSOCIATION
1156L | ERROR_DDE_FAIL
1157L | ERROR_DLL_NOT_FOUND
1200L | ERROR_BAD_DEVICE
1201L | ERROR_CONNECTION_UNAVAIL
1202L | ERROR_DEVICE_ALREADY_REMEMBERED
1203L | ERROR_NO_NET_OR_BAD_PATH
1204L | ERROR_BAD_PROVIDER
1205L | ERROR_CANNOT_OPEN_PROFILE
1206L | ERROR_BAD_PROFILE
1207L | ERROR_NOT_CONTAINER
1208L | ERROR_EXTENDED_ERROR
1209L | ERROR_INVALID_GROUPNAME
1210L | ERROR_INVALID_COMPUTERNAME
1211L | ERROR_INVALID_EVENTNAME
1212L | ERROR_INVALID_DOMAINNAME
1213L | ERROR_INVALID_SERVICENAME
1214L | ERROR_INVALID_NETNAME
1215L | ERROR_INVALID_SHARENAME
1216L | ERROR_INVALID_PASSWORDNAME
1217L | ERROR_INVALID_MESSAGENAME
1218L | ERROR_INVALID_MESSAGEDEST
1219L | ERROR_SESSION_CREDENTIAL_CONFLICT
1220L | ERROR_REMOTE_SESSION_LIMIT_EXCEEDED
1221L | ERROR_DUP_DOMAINNAME
1247L | ERROR_ALREADY_INITIALIZED
1248L | ERROR_NO_MORE_DEVICES
1300L | ERROR_NOT_ALL_ASSIGNED
1301L | ERROR_SOME_NOT_MAPPED
1302L | ERROR_NO_QUOTAS_FOR_ACCOUNT
1303L | ERROR_LOCAL_USER_SESSION_KEY
1304L | ERROR_NULL_LM_PASSWORD
1305L | ERROR_UNKNOWN_REVISION
1306L | ERROR_REVISION_MISMATCH
1307L | ERROR_INVALID_OWNER
1308L | ERROR_INVALID_PRIMARY_GROUP
1309L | ERROR_NO_IMPERSONATION_TOKEN
1310L | ERROR_CANT_DISABLE_MANDATORY
1311L | ERROR_NO_LOGON_SERVERS
1312L | ERROR_NO_SUCH_LOGON_SESSION
1313L | ERROR_NO_SUCH_PRIVILEGE
1314L | ERROR_PRIVILEGE_NOT_HELD
1315L | ERROR_INVALID_ACCOUNT_NAME
1316L | ERROR_USER_EXISTS
1317L | ERROR_NO_SUCH_USER
1318L | ERROR_GROUP_EXISTS
1319L | ERROR_NO_SUCH_GROUP
1320L | ERROR_MEMBER_IN_GROUP
1321L | ERROR_MEMBER_NOT_IN_GROUP
1322L | ERROR_LAST_ADMIN
1323L | ERROR_WRONG_PASSWORD
1324L | ERROR_ILL_FORMED_PASSWORD
1325L | ERROR_PASSWORD_RESTRICTION
1326L | ERROR_LOGON_FAILURE
1327L | ERROR_ACCOUNT_RESTRICTION
1328L | ERROR_INVALID_LOGON_HOURS
1329L | ERROR_INVALID_WORKSTATION
1330L | ERROR_PASSWORD_EXPIRED
1331L | ERROR_ACCOUNT_DISABLED
1332L | ERROR_NONE_MAPPED
1333L | ERROR_TOO_MANY_LUIDS_REQUESTED
1334L | ERROR_LUIDS_EXHAUSTED
1335L | ERROR_INVALID_SUB_AUTHORITY
1336L | ERROR_INVALID_ACL
1337L | ERROR_INVALID_SID
1338L | ERROR_INVALID_SECURITY_DESCR
1340L | ERROR_BAD_INHERITANCE_ACL
1341L | ERROR_SERVER_DISABLED
1342L | ERROR_SERVER_NOT_DISABLED
1343L | ERROR_INVALID_ID_AUTHORITY
1344L | ERROR_ALLOTTED_SPACE_EXCEEDED
1345L | ERROR_INVALID_GROUP_ATTRIBUTES
1346L | ERROR_BAD_IMPERSONATION_LEVEL
1347L | ERROR_CANT_OPEN_ANONYMOUS
1348L | ERROR_BAD_VALIDATION_CLASS
1349L | ERROR_BAD_TOKEN_TYPE
1350L | ERROR_NO_SECURITY_ON_OBJECT
1351L | ERROR_CANT_ACCESS_DOMAIN_INFO
1352L | ERROR_INVALID_SERVER_STATE
1353L | ERROR_INVALID_DOMAIN_STATE
1354L | ERROR_INVALID_DOMAIN_ROLE
1355L | ERROR_NO_SUCH_DOMAIN
1356L | ERROR_DOMAIN_EXISTS
1357L | ERROR_DOMAIN_LIMIT_EXCEEDED
1358L | ERROR_INTERNAL_DB_CORRUPTION
1359L | ERROR_INTERNAL_ERROR
1360L | ERROR_GENERIC_NOT_MAPPED
1361L | ERROR_BAD_DESCRIPTOR_FORMAT
1362L | ERROR_NOT_LOGON_PROCESS
1363L | ERROR_LOGON_SESSION_EXISTS
1364L | ERROR_NO_SUCH_PACKAGE
1365L | ERROR_BAD_LOGON_SESSION_STATE
1366L | ERROR_LOGON_SESSION_COLLISION
1367L | ERROR_INVALID_LOGON_TYPE
1368L | ERROR_CANNOT_IMPERSONATE
1369L | ERROR_RXACT_INVALID_STATE
1370L | ERROR_RXACT_COMMIT_FAILURE
1371L | ERROR_SPECIAL_ACCOUNT
1372L | ERROR_SPECIAL_GROUP
1373L | ERROR_SPECIAL_USER
1374L | ERROR_MEMBERS_PRIMARY_GROUP
1375L | ERROR_TOKEN_ALREADY_IN_USE
1376L | ERROR_NO_SUCH_ALIAS
1377L | ERROR_MEMBER_NOT_IN_ALIAS
1378L | ERROR_MEMBER_IN_ALIAS
1379L | ERROR_ALIAS_EXISTS
1380L | ERROR_LOGON_NOT_GRANTED
1381L | ERROR_TOO_MANY_SECRETS
1382L | ERROR_SECRET_TOO_LONG
1383L | ERROR_INTERNAL_DB_ERROR
1384L | ERROR_TOO_MANY_CONTEXT_IDS
1385L | ERROR_LOGON_TYPE_NOT_GRANTED
1386L | ERROR_NT_CROSS_ENCRYPTION_REQUIRED
1387L | ERROR_NO_SUCH_MEMBER
1388L | ERROR_INVALID_MEMBER
1389L | ERROR_TOO_MANY_SIDS
1390L | ERROR_LM_CROSS_ENCRYPTION_REQUIRED
1391L | ERROR_NO_INHERITANCE
1392L | ERROR_FILE_CORRUPT
1393L | ERROR_DISK_CORRUPT
1394L | ERROR_NO_USER_SESSION_KEY
1395L | ERROR_LICENSE_QUOTA_EXCEEDED
1400L | ERROR_INVALID_WINDOW_HANDLE
1401L | ERROR_INVALID_MENU_HANDLE
1402L | ERROR_INVALID_CURSOR_HANDLE
1403L | ERROR_INVALID_ACCEL_HANDLE
1404L | ERROR_INVALID_HOOK_HANDLE
1405L | ERROR_INVALID_DWP_HANDLE
1406L | ERROR_TLW_WITH_WSCHILD
1407L | ERROR_CANNOT_FIND_WND_CLASS
1408L | ERROR_WINDOW_OF_OTHER_THREAD
1409L | ERROR_HOTKEY_ALREADY_REGISTERED
1410L | ERROR_CLASS_ALREADY_EXISTS
1411L | ERROR_CLASS_DOES_NOT_EXIST
1412L | ERROR_CLASS_HAS_WINDOWS
1413L | ERROR_INVALID_INDEX
1414L | ERROR_INVALID_ICON_HANDLE
1415L | ERROR_PRIVATE_DIALOG_INDEX
1416L | ERROR_LISTBOX_ID_NOT_FOUND
1417L | ERROR_NO_WILDCARD_CHARACTERS
1418L | ERROR_CLIPBOARD_NOT_OPEN
1419L | ERROR_HOTKEY_NOT_REGISTERED
1420L | ERROR_WINDOW_NOT_DIALOG
1421L | ERROR_CONTROL_ID_NOT_FOUND
1422L | ERROR_INVALID_COMBOBOX_MESSAGE
1423L | ERROR_WINDOW_NOT_COMBOBOX
1424L | ERROR_INVALID_EDIT_HEIGHT
1425L | ERROR_DC_NOT_FOUND
1426L | ERROR_INVALID_HOOK_FILTER
1427L | ERROR_INVALID_FILTER_PROC
1428L | ERROR_HOOK_NEEDS_HMOD
1429L | ERROR_GLOBAL_ONLY_HOOK
1430L | ERROR_JOURNAL_HOOK_SET
1431L | ERROR_HOOK_NOT_INSTALLED
1432L | ERROR_INVALID_LB_MESSAGE
1433L | ERROR_SETCOUNT_ON_BAD_LB
1434L | ERROR_LB_WITHOUT_TABSTOPS
1435L | ERROR_DESTROY_OBJECT_OF_OTHER_THREAD
1436L | ERROR_CHILD_WINDOW_MENU
1437L | ERROR_NO_SYSTEM_MENU
1438L | ERROR_INVALID_MSGBOX_STYLE
1439L | ERROR_INVALID_SPI_VALUE
1440L | ERROR_SCREEN_ALREADY_LOCKED
1441L | ERROR_HWNDS_HAVE_DIFFERENT_PARENT
1442L | ERROR_NOT_CHILD_WINDOW
1443L | ERROR_INVALID_GW_COMMAND
1444L | ERROR_INVALID_THREAD_ID
1445L | ERROR_NON_MDICHILD_WINDOW
1446L | ERROR_POPUP_ALREADY_ACTIVE
1447L | ERROR_NO_SCROLLBARS
1448L | ERROR_INVALID_SCROLLBAR_RANGE
1449L | ERROR_INVALID_SHOWWIN_COMMAND
1500L | ERROR_EVENTLOG_FILE_CORRUPT
1501L | ERROR_EVENTLOG_CANT_START
1502L | ERROR_LOG_FILE_FULL
1503L | ERROR_EVENTLOG_FILE_CHANGED
1700L | RPC_S_INVALID_STRING_BINDING
1701L | RPC_S_WRONG_KIND_OF_BINDING
1702L | RPC_S_INVALID_BINDING
1703L | RPC_S_PROTSEQ_NOT_SUPPORTED
1704L | RPC_S_INVALID_RPC_PROTSEQ
1705L | RPC_S_INVALID_STRING_UUID
1706L | RPC_S_INVALID_ENDPOINT_FORMAT
1707L | RPC_S_INVALID_NET_ADDR
1708L | RPC_S_NO_ENDPOINT_FOUND
1709L | RPC_S_INVALID_TIMEOUT
1710L | RPC_S_OBJECT_NOT_FOUND
1711L | RPC_S_ALREADY_REGISTERED
1712L | RPC_S_TYPE_ALREADY_REGISTERED
1713L | RPC_S_ALREADY_LISTENING
1714L | RPC_S_NO_PROTSEQS_REGISTERED
1715L | RPC_S_NOT_LISTENING
1716L | RPC_S_UNKNOWN_MGR_TYPE
1717L | RPC_S_UNKNOWN_IF
1718L | RPC_S_NO_BINDINGS
1719L | RPC_S_NO_PROTSEQS
1720L | RPC_S_CANT_CREATE_ENDPOINT
1721L | RPC_S_OUT_OF_RESOURCES
1722L | RPC_S_SERVER_UNAVAILABLE
1723L | RPC_S_SERVER_TOO_BUSY
1724L | RPC_S_INVALID_NETWORK_OPTIONS
1725L | RPC_S_NO_CALL_ACTIVE
1726L | RPC_S_CALL_FAILED
1727L | RPC_S_CALL_FAILED_DNE
1728L | RPC_S_PROTOCOL_ERROR
1730L | RPC_S_UNSUPPORTED_TRANS_SYN
1731L | RPC_S_SERVER_OUT_OF_MEMORY
1732L | RPC_S_UNSUPPORTED_TYPE
1733L | RPC_S_INVALID_TAG
1734L | RPC_S_INVALID_BOUND
1735L | RPC_S_NO_ENTRY_NAME
1736L | RPC_S_INVALID_NAME_SYNTAX
1737L | RPC_S_UNSUPPORTED_NAME_SYNTAX
1739L | RPC_S_UUID_NO_ADDRESS
1740L | RPC_S_DUPLICATE_ENDPOINT
1741L | RPC_S_UNKNOWN_AUTHN_TYPE
1742L | RPC_S_MAX_CALLS_TOO_SMALL
1743L | RPC_S_STRING_TOO_LONG
1744L | RPC_S_PROTSEQ_NOT_FOUND
1745L | RPC_S_PROCNUM_OUT_OF_RANGE
1746L | RPC_S_BINDING_HAS_NO_AUTH
1747L | RPC_S_UNKNOWN_AUTHN_SERVICE
1748L | RPC_S_UNKNOWN_AUTHN_LEVEL
1749L | RPC_S_INVALID_AUTH_IDENTITY
1750L | RPC_S_UNKNOWN_AUTHZ_SERVICE
1751L | EPT_S_INVALID_ENTRY
1752L | EPT_S_CANT_PERFORM_OP
1753L | EPT_S_NOT_REGISTERED
1755L | RPC_S_INCOMPLETE_NAME
1756L | RPC_S_INVALID_VERS_OPTION
1757L | RPC_S_NO_MORE_MEMBERS
1758L | RPC_S_NOT_ALL_OBJS_UNEXPORTED
1759L | RPC_S_INTERFACE_NOT_FOUND
1760L | RPC_S_ENTRY_ALREADY_EXISTS
1761L | RPC_S_ENTRY_NOT_FOUND
1762L | RPC_S_NAME_SERVICE_UNAVAILABLE
1764L | RPC_S_CANNOT_SUPPORT
1765L | RPC_S_NO_CONTEXT_AVAILABLE
1766L | RPC_S_INTERNAL_ERROR
1767L | RPC_S_ZERO_DIVIDE
1768L | RPC_S_ADDRESS_ERROR
1769L | RPC_S_FP_DIV_ZERO
1770L | RPC_S_FP_UNDERFLOW
1771L | RPC_S_FP_OVERFLOW
1772L | RPC_X_NO_MORE_ENTRIES
1773L | RPC_X_SS_CHAR_TRANS_OPEN_FAIL
1774L | RPC_X_SS_CHAR_TRANS_SHORT_FILE
1775L | RPC_X_SS_IN_NULL_CONTEXT
1776L | RPC_X_SS_CONTEXT_MISMATCH
1777L | RPC_X_SS_CONTEXT_DAMAGED
1778L | RPC_X_SS_HANDLES_MISMATCH
1779L | RPC_X_SS_CANNOT_GET_CALL_HANDLE
1780L | RPC_X_NULL_REF_POINTER
1781L | RPC_X_ENUM_VALUE_OUT_OF_RANGE
1782L | RPC_X_BYTE_COUNT_TOO_SMALL
1783L | RPC_X_BAD_STUB_DATA
1784L | ERROR_INVALID_USER_BUFFER
1785L | ERROR_UNRECOGNIZED_MEDIA
1786L | ERROR_NO_TRUST_LSA_SECRET
1787L | ERROR_NO_TRUST_SAM_ACCOUNT
1788L | ERROR_TRUSTED_DOMAIN_FAILURE
1789L | ERROR_TRUSTED_RELATIONSHIP_FAILURE
1790L | ERROR_TRUST_FAILURE
1791L | RPC_S_CALL_IN_PROGRESS
1792L | ERROR_NETLOGON_NOT_STARTED
1793L | ERROR_ACCOUNT_EXPIRED
1794L | ERROR_REDIRECTOR_HAS_OPEN_HANDLES
1795L | ERROR_PRINTER_DRIVER_ALREADY_INSTALLED
1796L | ERROR_UNKNOWN_PORT
1797L | ERROR_UNKNOWN_PRINTER_DRIVER
1798L | ERROR_UNKNOWN_PRINTPROCESSOR
1799L | ERROR_INVALID_SEPARATOR_FILE
1800L | ERROR_INVALID_PRIORITY
1801L | ERROR_INVALID_PRINTER_NAME
1802L | ERROR_PRINTER_ALREADY_EXISTS
1803L | ERROR_INVALID_PRINTER_COMMAND
1804L | ERROR_INVALID_DATATYPE
1805L | ERROR_INVALID_ENVIRONMENT
1806L | RPC_S_NO_MORE_BINDINGS
1807L | ERROR_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT
1808L | ERROR_NOLOGON_WORKSTATION_TRUST_ACCOUNT
1809L | ERROR_NOLOGON_SERVER_TRUST_ACCOUNT
1810L | ERROR_DOMAIN_TRUST_INCONSISTENT
1811L | ERROR_SERVER_HAS_OPEN_HANDLES
1812L | ERROR_RESOURCE_DATA_NOT_FOUND
1813L | ERROR_RESOURCE_TYPE_NOT_FOUND
1814L | ERROR_RESOURCE_NAME_NOT_FOUND
1815L | ERROR_RESOURCE_LANG_NOT_FOUND
1816L | ERROR_NOT_ENOUGH_QUOTA
1817L | RPC_S_NO_INTERFACES
1818L | RPC_S_CALL_CANCELLED
1819L | RPC_S_BINDING_INCOMPLETE
1820L | RPC_S_COMM_FAILURE
1821L | RPC_S_UNSUPPORTED_AUTHN_LEVEL
1822L | RPC_S_NO_PRINC_NAME
1823L | RPC_S_NOT_RPC_ERROR
1824L | RPC_S_UUID_LOCAL_ONLY
1825L | RPC_S_SEC_PKG_ERROR
1826L | RPC_S_NOT_CANCELLED
1827L | RPC_X_INVALID_ES_ACTION
1828L | RPC_X_WRONG_ES_VERSION
1829L | RPC_X_WRONG_STUB_VERSION
1898L | RPC_S_GROUP_MEMBER_NOT_FOUND
1899L | EPT_S_CANT_CREATE
1900L | RPC_S_INVALID_OBJECT
1901L | ERROR_INVALID_TIME
1902L | ERROR_INVALID_FORM_NAME
1903L | ERROR_INVALID_FORM_SIZE
1904L | ERROR_ALREADY_WAITING
1905L | ERROR_PRINTER_DELETED
1906L | ERROR_INVALID_PRINTER_STATE
1907L | ERROR_PASSWORD_MUST_CHANGE
1908L | ERROR_DOMAIN_CONTROLLER_NOT_FOUND
1909L | ERROR_ACCOUNT_LOCKED_OUT
2000L | ERROR_INVALID_PIXEL_FORMAT
2001L | ERROR_BAD_DRIVER
2002L | ERROR_INVALID_WINDOW_STYLE
2003L | ERROR_METAFILE_NOT_SUPPORTED
2004L | ERROR_TRANSFORM_NOT_SUPPORTED
2005L | ERROR_CLIPPING_NOT_SUPPORTED
2138L | ERROR_NO_NETWORK
2202L | ERROR_BAD_USERNAME
2250L | ERROR_NOT_CONNECTED
2401L | ERROR_OPEN_FILES
2404L | ERROR_DEVICE_IN_USE
3000L | ERROR_UNKNOWN_PRINT_MONITOR
3001L | ERROR_PRINTER_DRIVER_IN_USE
3002L | ERROR_SPOOL_FILE_NOT_FOUND
3003L | ERROR_SPL_NO_STARTDOC
3004L | ERROR_SPL_NO_ADDJOB
3005L | ERROR_PRINT_PROCESSOR_ALREADY_INSTALLED
3006L | ERROR_PRINT_MONITOR_ALREADY_INSTALLED
4000L | ERROR_WINS_INTERNAL
4001L | ERROR_CAN_NOT_DEL_LOCAL_WINS
4002L | ERROR_STATIC_INIT
4003L | ERROR_INC_BACKUP
4004L | ERROR_FULL_BACKUP
4005L | ERROR_REC_NON_EXISTENT
4006L | ERROR_RPL_NOT_ALLOWED
6118L | ERROR_NO_BROWSER_SERVERS_FOUND


KiXtart Command Reference

KiXtart Reference

Command Reference

Bold items are new to this release:

?
:
;
BEEP
BIG
BREAK
CALL
CD
CLS
COLOR
COOKIE1
COPY
DEBUG
DEL
DIM
DISPLAY
DO UNTIL
EXIT
FLUSHKB
 FOR EACH
FOR NEXT
FUNCTION
GET
GETS
GLOBAL
GO
GOSUB
GOTO
IF ELSE ENDIF
MD
PLAY
QUIT
RD
REDIM
 RETURN
RUN
SELECT CASE
SET
SETL
SETM
SETTIME
SHELL
SLEEP
SMALL
USE
WHILE LOOP
         print
denote label for goto/gosub
denote comments
beep speaker
sets character mode to large characters (8x8)
(re)set Ctrl-C/Break handling
execute a separate script
change current directory
clear the screen
change fore-/background color
creates 'cookie' for the 9x Logon API
copy files
enables/disables debug mode during runtime
delete files
dimension a variable
display file indicated by x
loop the loop
exit current script, optionally with return code
remove any keystrokes from keyboard buffer
control statements to enumerate arrays
control stmts. to conditionally execute a set of statements
definition of user defined functions
wait for single keystroke
accept a string of chars
declare one of more global variables
change current drive
call subroutine at label
jump to label
standard if/else construct
create new directory
plays 'music' from SPK-file, string or WAV-file
exit script, optionally with an exitcode
remove directory
re-declares arrays
exits a subroutine or script
WinExec's a program (script continues)
'CASE' statement
sets variables in env. CURRENT_USER (NT)
sets variables in local environment (NT)
sets variables in env. of LOCAL_MACHINE (NT)
synchronize local time with time on server
executes a program, and waits for completion
suspends script for xx seconds
resets character mode to normal
(dis-)connect to/from network share
loop the loop

Note: In this documentation, square brackets [ ] indicate optional arguments, and angle brackets < > indicate required arguments.


Command :

:

Action: | Defines a label within the script file to which you can transfer control.
Syntax: | :label
Remarks: | Labels must be unique within a script or user defined function and cannot contain whitespace characters. Note also that you can define labels inside script segments (for example inside a WHILE – LOOP segment), but you cannot jump to such a label from outside the segment.
See Also: | Gosub, Goto


Command ;

;

Action: | Indicates a comment. Subsequent characters on the script line are ignored.
Syntax: | ;


Command ?

?

Action: | Indicates a new line. This moves the cursor position to the beginning of the next line.
Syntax: | ?
See Also: | At( ), Color


Command Beep

Beep

Action: | Causes the system to "beep" the PC speaker.
Syntax: | BEEP
See Also: | Play


Command Big

Big

Action: | Changes the character mode to large characters.
Syntax: | BIG
Remarks: | When BIG is used, subsequent screen output is 8 characters wide and 8 characters high. Use the Small command to reset the character mode to normal. BIG is ignored when screen output is redirected to a file.
See Also: | Small


Command Break

B reak

Action: Allows you to enable (BREAK ON) or disable (BREAK OFF) the ctrl+c/break keys and the Close command. This effectively allows you to control whether the script being run by KiXtart can be interrupted or not.
Syntax: BREAK <ON | OFF>
Remarks:

By default, to prevent users from inadvertently interrupting a script, KiXtart automatically disables the ctrl+c/break keys, disables the Close command in the System menu of the current command-prompt window, and hides the Please wait while your logon script executes message box on Windows 9x.

In a multi-tasking environment such as Windows NT, you cannot fully prevent users from interrupting a program. (They can end programs by using the Task List, for example.) As an additional protection, on computers running Windows NT or Windows 2000 only, when BREAK is OFF (the default) KiXtart also installs a special event handler for the current console. The effect of this handler is that whenever a user forcibly terminates KiXtart, the user is automatically logged off. This means that you must be careful when testing scripts.

Tip> On Windows 9X, the Please wait while your logon script executes message box contains a Cancel button, which you can hide by opening a copy of Msnet32.dll in Visual C 4.00 WorkBench, selecting the LMWINSCRIPTDLG resource, and making the Cancel button invisible.


Command Call

Call

Action: Allows you to start a separate KiXtart script.
Syntax: CALL "script name"
Remarks:

When the called script ends or when a RETURN statement is encountered, script execution continues at the statement following the CALL statement in the calling script.

Theoretically, there is no limit to the number of scripts that can be nested. Obviously, the practical limit on the number of scripts you can call is determined by the amount of available memory at the time KiXtart runs, the size of the scripts, the number of variables defined, and so on.

See Also: Return


Command CD

CD

Action: | Changes the current working directory to the directory specified.
Syntax: | CD "directory"
Remarks: | Check the value of @ERROR to see if CD was successful.
See Also: | Copy, Del, Go, MD, RD


Command CLS

CLS

Action: | Clears the screen and moves the cursor to position 0,0.
Syntax: | CLS
Remarks: | The CLS command is ignored if all output has been redirected to a file using the RedirectOutput function.
See Also: | RedirectOutput( )


Command Color

Color

Action: Allows you to specify the color attribute to be used in subsequent display statements.
Syntax: COLOR Xx/Yy
Parameters:
X | Foreground color
x | Optional intensity indication
Y | Background color
y | Optional blink indication

Possible values for the foreground and background colors are:

n | Normal (black)
b | Blue
g | Green
c | Cyan
r | Red
m | Magenta
y | Yellow/brown
w | White
Remarks:

If the foreground color is followed by a plus sign (+), the color is displayed with high intensity.

Specifying a plus sign (+) with the background color causes the color to be displayed blinking.
Examples:
COLOR w+/b

; Bright white text on a blue background

COLOR g/r+

; Green text on a blinking red background


Command Cookie1

Cookie1

Action: | Creates a cookie, or semaphore-file, that the Windows 9x Logon API uses to determine whether the script has finished running. This command is only useful when KiXtart is being used to emulate Lmscript.exe. For more information, see “Lmscript Emulation,” earlier in this document.
Syntax: | COOKIE1


Command Copy

Copy

Action: | Copies one or more files.
Syntax: | COPY "source" "destination" [/h]
Remarks: | Wildcards are supported. If a file already exists at the destination, it is overwritten without warning. The /h option can be used to include files with the hidden or system attribute set in the copy.
See Also: | CD, Del, Go, MD, RD


Command Del

Del

Action: | Deletes a file.
Syntax: | DEL "file name"
Remarks: | DEL does not prompt the user to confirm the deletion. Wildcards are supported.
See Also: | CD, Copy, Go, MD, RD


Command Dim

Dim

Action: Declare one or more local variables.
Syntax: DIM "variable1" [<,>"variableX"]
Remarks: Local variables are visible only in the current script or script segment.
See Also: Global, ReDim, UBound( )
Examples:

DIM $Variable
DIM $Array[9] ; Declaration of an array of 10 elements.
IF $X = 1
   DIM $Var1, $Var2, $Var3
ENDIF


Command Display

Display

Action: | Displays the contents of a file on the screen, starting at the current cursor position.
Syntax: | DISPLAY "file name"


Command Do Until

Do ... Until

Action: | Loops until an expression becomes true.
Syntax: | DO statements UNTIL "expression"
Remarks: | DO UNTIL loops can be nested as many times as memory allows.
See Also: | For Each, For Next, While Loop


Command Exit

Exit

Action: | Exits the current KiXtart script, or, if used at the topmost level, exits KiXtart.
Syntax: | EXIT [error level / exit code]
Remarks: | If EXIT is followed by a numeric expression, then @ERROR is set to the value of that expression and you can check it in the calling script or batch file.
See Also: | Return, Quit


Command FlushKB

FlushKb

Action: | Flushes all pending characters from the keyboard buffer.
Syntax: | FLUSHKB
See Also: | Get, GetS


Command For Each

For Each

Action: Repeats a group of statements for each element in an array or collection.
Syntax: FOR EACH $element IN group
statements…
NEXT

FOR EACH loops can be nested as many times as memory allows.
Parameters:

Element

Variable used to iterate through the elements of the collection or array.

Group

Name of an object collection or array.
Remarks: The For Each block is entered if there is at least one element in group. Once the loop has been entered, all the statements in the loop are executed for the first element in group. As long as there are more elements in group, the statements in the loop continue to execute for each element. When there are no more elements in group, the loop is exited and execution continues with the statement following the Next statement.
See Also: Do Until , For Next, While Loop
Examples:
Dim $MyArray[10]
For Each $Element In $MyArray
  ? $Element
Next

$Root = GetObject( "LDAP://localhost" )
For Each $Obj in $Root
  ? $Obj.name
Next


Command For Next

For ... Next

Action: Repeats a group of statements a specified number of times.
Syntax: FOR $counter = start TO end [STEP step]
statements…
NEXT
Parameters:

Counter

Numeric variable used as a loop counter.

Start

Initial value of $counter.

End

Final value of $counter.

Step

Amount counter is changed each time through the loop. If not specified, step defaults to one. The step argument can be either positive or negative. The value of the step argument determines loop processing as follows:

Value | Loop executes if
Positive or 0 | $counter <= end
Negative | $counter >= end

Once the loop starts and all statements in the loop have executed, step is added to counter. At this point, either the statements in the loop execute again (based on the same test that caused the loop to execute initially), or the loop is exited and execution continues with the statement following the Next statement.
Remarks: FOR NEXT loops can be nested as many times as memory allows.
Changing the value of counter while inside a loop can make it more difficult to read and debug your code.
See Also: Do Until , For Each, While Loop
Example:
For $Count = 0 To 10 Step 2
  ? $Count
Next


Command For Next

Function

Action: Declares the name, arguments, and code that form the body of a Function procedure.

A Function procedure is a separate procedure that can take arguments, perform a series of statements, and change the values of its arguments. A Function procedure can be used on the right side of an expression in the same way you use any intrinsic function, such as Len or Asc, when you want to use the value returned by the function.
Syntax: Function name [(argument1, argument2, [optional]argumentx)]
[statements]
[name = expression]
EndFunction
Parameters:

Name

Name of the Function.

Argumentlist

List of variables representing arguments that are passed to the Function procedure when it is called. Multiple variables are separated by commas. All arguments are passed by value. If an argument is preceded by the OPTIONAL keyword, the argument is not required, and all subsequent arguments in the list must also be optional and declared using the OPTIONAL keyword.

Statements

Any group of statements to be executed within the body of the Function procedure.

Expression

Return value of the Function.
Remarks: Function procedures have a global scope, that is, they are visible to all other scripts and procedures in the scripts. The value of local variables in a Function is not preserved between calls to the procedure.

You cannot define a Function procedure inside another procedure.

The Return statement causes an immediate exit from a Function procedure. Program execution continues with the statement that follows the statement that called the Function procedure. Any number of Return statements can appear anywhere in a Function procedure.

You call a Function procedure using the function name, followed by the argument list in parentheses, in an expression.

Note: Function procedures can be recursive, that is, they can call themselves to perform a given task. However, recursion can lead to stack overflow.

To return a value from a function, assign the value to the function name. Any number of such assignments can appear anywhere within the procedure. If no value is assigned to name, the procedure returns an empty value.

Variables used in Function procedures fall into two categories: those that are explicitly declared within the procedure and those that are not. Variables that are explicitly declared in a procedure (using Dim) are always local to the procedure. Variables that are used but not explicitly declared in a procedure are global.

Note: a procedure can use a variable that is not explicitly declared in the procedure, but a naming conflict can occur if anything you have defined at the script level has the same name. If your procedure refers to an undeclared variable that has the same name as another procedure, constant, or variable, it is assumed that your procedure is referring to that script-level name.
See Also: Return
Example:

Function ReadNC( $ServerName )
  $ReadNC = ""
  $Root = GetObject("LDAP://" + $ServerName + "/rootDSE")
  If @ERROR = 0
     $ReadNC = $Root.defaultNamingContext
  Endif
EndFunction

;More examples can be found at the ScriptLogic.com Function Library.


Command Get

Get

Action: | Accepts a single character from the keyboard and stores the character in a variable.
Syntax: | GET $x
Remarks: | The character is stored in the specified script variable. If a function key, such as F1, is pressed, GET returns 0, and @ERROR returns the key code of the function key.
See Also: | FlushKb, GetS, KbHit( )


Command Gets

GetS

Action: | Reads a line of characters from the keyboard until the <enter> key is pressed, and stores the result in a variable.
Syntax: | GETS $x
See Also: | FlushKb, Get


Command Global

Global

Action: Declare one or more global variables.
Syntax: GLOBAL "variable1" [<,>"variableX"]
Remarks: Global variables are visible everywhere in every script during the current KiXtart session.
See Also: Dim, ReDim
Examples:

GLOBAL $X
GLOBAL $X, $Y, $Z


Command Go

Go

Action: Changes the current drive.
Syntax: [GO] drive
Remarks: Use GO if you want to specify a variable as the drive to change to.
See Also: CD, Copy, Del, MD, RD
Examples:

GO A:
A:
GO $D2


Command Gosub

Gosub

Action: Causes script execution to continue at the first statement after a label.
Syntax: GOSUB <label>
Remarks:

Label can be an expression.
When a RETURN statement is encountered, script execution continues at the statement following the GOSUB statement.

See Also: :, Goto , Return
Example:

? "This demonstrates calling a subroutine"
GOSUB "Demo"
? "End of demonstration…"
EXIT 1

:Demo
? "We are in the subroutine now…"
RETURN


Command GoTo

Goto

Action: Causes script execution to continue at the first statement after a label.
Syntax: GOTO <label>
Remarks:

Label can be an expression.

See Also: : , Gosub
Examples:

GOTO "end"

$string = "end"
GOTO $string


Command If Else Endif

If Else Endif

Action: Conditionally runs statements.
Syntax: IF expression
 statement1
....
[ELSE
statement2
.... ]
ENDIF
Remarks:

The body of an IF statement is executed selectively depending on the value of the expression. If expression is true, then statement1 is executed. If expression is false and the ELSE clause is specified, then statement2 is executed.

IF statements can be nested as many times as memory allows.

If the expression does not contain any relational operators, the condition is considered to be true if it is numeric and it evaluates to a value other than zero, or if it is alphanumeric and it evaluates to a string containing at least one character.

Note: By default, all string comparisons are made case-insensitive. This behavior can be changed using the SetOption function. Please see the description of the SetOption function for full details.

See Also: Select ... Case ... Endselect, SetOption( )
Examples:
IF $X
  ; same as IF $X <> 0
  ; same as IF $X<>""
  ; do stuff
ENDIF

IF @HOMESHR
  ; similar to IF @HOMESHR <> ""
  ; do stuff
ENDIF

IF INGROUP("Admins")
  ; similar to IF INGROUP("Admins") > 0
  ; do stuff
ENDIF

IF NOT INGROUP("Domain Admins")
  ; true if user NOT a Domain Admin
  ; do stuff
ENDIF

IF $X*2 < 10
  ; do stuff
ENDIF

IF (($X*2) < 10) OR ($Y + 100) /3 >120
  ; do stuff
ENDIF

IF INSTR(%PATH%,"NETLOGON") AND @DOS = "3.51"
  ; do stuff
ENDIF

IF (SUBSTR(@WKSTA,11,1)="1" AND @USERID = "PETERV") OR  @DOMAIN = "VleerBeer"
  ; do stuff
ENDIF

IF @USERID = "RUUDV" OR @USERID = "WIMW"
  ; do stuff
ENDIF

IF (INGROUP("Domain Users") OR INGROUP("Users"))
  ; do stuff
ENDIF


Command MD

MD

Action: | Creates a new directory.
Syntax: | MD "directory"
Remarks: | Check the value of @ERROR to see if MD was successful (@ERROR = 0).
See Also: | CD, Copy, Del, Go, RD


Command Play

Play

Action: Allows you to play music on the computer's speaker by using the SPK file format described below, or on your sound card by playing a WAV file.
Syntax:

PLAY [FILE "path\filename.spk"] | "string" | "path\filename.wav"

There are four possible syntax forms:

· PLAY FILE "Jbond.spk"
· PLAY "0g256t 0g8d247f 4d165f 247f 8d262f 4d165f 262f 8d277f 4d165f"
· PLAY FILE "Ding.wav"
· PLAY "Chimes.wav"

The string or file consists of a sequence of commands indicating the frequency and duration of the tones to play. The following commands are available:

· F or f - frequency
This command causes a tone to be produced at the current frequency. The initial current frequency is 1000Hz. To change the value, indicate the desired frequency immediately followed by the f character. For example, to produce a tone at 1500Hz, specify 1500F.

· G or g - gap
This command sets the number of timer ticks (1 second = 18 ticks) of silence between individual tones. The number of timer ticks between tones is specified as a number immediately followed by G. The initial value is 0.

· D or d - duration
This command sets the length (in timer ticks) of each tone. For example, to make each tone last about a third of a second, use the command 6d.

· T or t - tempo
This command scales the duration of each tone. This allows you to change the duration of a series of tones globally, without having to change each of the individual duration commands.

A tempo value of 256 indicates normal tempo. A value of 4df lasts:

· 2 timer ticks, when the tempo is set to 128
· 4 timer ticks, when the tempo is set to 256
· 8 timer ticks, when the tempo is set to 512

Remarks:

KiXtart automatically selects the appropriate action based on the file name extension you provide.

See Also: Beep
Examples:

; * This plays the part of the James Bond theme *
PLAY "0g256t 0g8d247f 4d165f 247f 8d262f 4d165f
262f 8d277f 4d165f 277f 8d262f 4d165f 262f 8d247f
4d165f 247f 8d262f 4d165f 262f 8d277f 4d165f 277f
8d262f"


Command Quit

Quit

Action: | Exits KiXtart.
Syntax: | QUIT [error level / exit code]
Remarks: | If QUIT is followed by a numeric expression, then the value of that expression is used as the exit code of KiXtart, and you can check it using a batch file.
See Also: | Exit


Command RD

RD

Action: | Removes the directory specified.
Syntax: | RD "directory"
Remarks: | The directory must be empty for this command to succeed. Check the value of @ERROR to see if RD was successful.
See Also: | CD, Copy, Del, MD


Command ReDim

ReDim

Action: Declares dynamic-array variables, and allocates or reallocates storage space at procedure level.
Syntax: REDIM [PRESERVE] "variable1" [<,>"variableX"]
Remarks: The PRESERVE keyword preserves the data in an existing array when you change the size of the dimension.
Local variables are visible only in the current script or script segment.
See Also: Global, Dim, UBound( )
Examples:

REDIM $MyArray[20]

REDIM PRESERVE $Array[9] ; Note : preserves contents of the array.

REDIM $Var1, $Var2, $Var3


Command Return

Return

Action: | Causes script execution to continue at the statement following the last Call or Gosub statement.
Syntax: | RETURN
Remarks: | If RETURN is specified in the main script, KiXtart terminates, or if issued from within a user-defined function, exits the function immediately, and script execution continues at the next statement following the function call.
See Also: | Call, Gosub, Function


Command Run

Run

Action: Runs a command.
Syntax: RUN "command"
Remarks:

Command can be any 16-bit or 32-bit application. To run command interpreter commands, specify the correct command interpreter as part of the command.

RUN does not wait for the program to complete. Script execution continues immediately.
See Also: Shell
Example s:

RUN @LDRIVE + "\UPDATE.EXE"
RUN "%COMSPEC% /e:1024 /c DIR C:"


Command Select Case Endselect

Select Case … EndSelect

Action: A SELECT statement is an efficient way to write a series of If-Endif statements.
Syntax: SELECT
CASE expression
statement1
....
CASE expression
statement2
....
ENDSELECT
Remarks: A SELECT statement consists of one or more conditions (CASE) each of which is followed by one or more statements that are executed only if the condition evaluates to TRUE. The SELECT statement is processed from top to bottom. If an expression evaluates to TRUE, the statements immediately following it are executed, up to the next CASE statement.

Only one CASE statement is executed, regardless of how many statements evaluate to TRUE.

If expression does not contain any relational operators, the condition is considered to be true if it is numeric and if it evaluates to a value other than zero, or if it is alphanumeric and it evaluates to a string containing at least one character.

SELECT statements can be nested as many times as memory allows.
See Also: If Else Endif
Example s:

SELECT
  CASE InGroup("Domain Admins") AND @DAY = 1
     ? "Whatever…"
   CASE InGroup("Office Users")
    ? "Etc…"
     ? "Etc…"
   CASE 1
    ; this is a nice way to provide a default CASE
    ; if all other CASEs fail, this one will always be run
   ? "Hmm, you're not in one of our groups?"
ENDSELECT


Command Set

Set

Action: | Sets environment variables in the environment of the current user (HKEY_CURRENT_USER\Environment).
Syntax: | SET "variable=string"
Remarks: | After any change to the environment, KiXtart informs running programs that the change was made, prompting them to regenerate their environments. Programs that support this feature (such as Program Manager, Task Manager, and Windows Explorer) update their environments when they receive the WM_SETTINGCHANGE message. The environment of the current process (KiXtart 95) is not affected. This command does not work on Windows 9x. As an alternative, use the SHELL command to run Winset.exe. (Winset.exe is included on the Windows 9x CD.)
See Also: | SetL, SetM


Command SetL

SetL

Action: | Sets environment variables in the local environment that you see when you start a program from within a KiXtart script.
Syntax: | SETL "variable=string"
Remarks: | This command does not affect the current environment. If you start KiXtart from a batch file, any commands in the batch file that are run after KiXtart exits do not see changes made by the SET or SETL commands. If you want to run batch files or programs that depend on settings set by KiXtart, start them from KiXtart using SHELL or RUN. SETL sets the value of @ERROR.
See Also: | Set, SetM


Command SetM

SetM

Action: | Sets environment variables in the environment of the local computer (HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment).
Syntax: | SETM "variable=string"
Remarks: | After any change to the environment, KiXtart informs running programs that the change was made, prompting them to regenerate their environments. Programs that support this feature (such as Program Manager, Task Manager, and Windows Explorer) update their environments when they receive the WM_SETTINGCHANGE message. The environment of the current process (KiXtart 95) is not affected. This command does not work on Windows 9x. As an alternative, use the SHELL command to run Winset.exe. (Winset.exe is included on the Windows 9x CD.)
See Also: | Set, SetL


Command SetTime

SetTime

Action: Synchronizes the system clock of the local computer with the time on a specified source.
Syntax: SETTIME "source"
Remarks: Source can be one of the following:

A server name expressed in UNC format:
KiXtart connects to the server specified to retrieve the time.

A domain name:
KiXtart browses the domain for a server running the Time Source service.

An asterisk { * }:
KiXtart browses the local domain for any server running the Time Source service.

On Windows NT, SETTIME requires the current user to have the ‘Change the system time’ privilege.

For more information on running the Windows NT Time Source Service, see Knowledge Base article Q131715 (also available on TechNet).
Examples:

SETTIME "*"
SETTIME "\\MYTIME"
SETTIME "TIMEDOMAIN"


Command Shell

Shell

Action: Loads and runs a program.
Syntax: SHELL "command"
Remarks: Command can be any 16-bit or 32-bit application. To run command interpreter commands, specify the correct command interpreter as part of the command.

Script execution is stopped until the program exits.

If the program you want to run needs to set environment variables (as is the case with Smsls.bat, for example), you may need to specify additional environment space by using the /E parameter.

SHELL sets the value of @ERROR to the exit code of the program that is run.
See Also: Run
Examples:

SHELL @LDRIVE + "\UPDATE.EXE"
SHELL "%COMSPEC% /e:1024 /c DIR C:"
SHELL "SETW USERNAME=@USERID"
SHELL "CMD.EXE /C COPY " + @LDRIVE + "\FILE.TXT C:\"
SHELL "%COMSPEC% /C COPY Z:\FILE.TXT C:\"
SHELL "C:\WINNT\SYSTEM32\CMD /E:1024 /C " + @LDRIVE + "\SMSLS.BAT"


Command Sleep

S leep

Action: | Halts script execution for the number of seconds specified.
Syntax: | SLEEP <seconds>


Command Small

S mall

Action: | Changes the character mode to small (normal) characters.
Syntax: | SMALL
Remarks: | After using SMALL, subsequent screen output is normal. For more information, see the "Big" command.
See Also: | Big


Command Use

U se

Action: Enables you to list the current connections. Also enables you to connect a device, such as a drive or a printer, to a network resource; or to disconnect a device from a network resource.
Syntax: USE LIST
USE < * | "device" | "resource"> /DELETE [/PERSISTENT]
USE ["device"] <"resource"> [/USER:user] [/PASSWORD:password] [/PERSISTENT]
Remarks: Use USE “*” /DELETE to delete all current connections except those to a NETLOGON share and those to the drive or share from which KiXtart was started.

If a resource name contains non-alphanumeric characters (such as - or +), you must enclose the name in quotation marks.

On Windows NT only, you can use the /USER and /PASSWORD parameters, which allows you to override the security context of the current user.

Check the value of @ERROR to see if USE was successful (a value of 0 indicates success).

Examples:

USE E: "\\SERVER\PUBLIC" /PERSISTENT
USE * /DELETE
USE E: "\\SERVER\PUBLIC" /user:Yogi /password:Bear
USE E: "\\SERVER\PUBLIC"
USE LPT1: "\\SERVER\LASER" /user:testlan\USER1
USE L: /DEL
USE LIST
USE H: @HOMESHR ; connect to user's home share
IF @ERROR = 0
  H:
  CD @HOMEDIR ; change directory to user's home directory
ENDIF


Command While - Loop

W hile ... Loop

Action: | Runs a set of statements as long as an expression is true.
Syntax: | WHILE "expression" ...statements ... LOOP
Remarks: | WHILE loops can be nested as many times as memory allows.
See Also: | Do Until, For Each, For Next


KiXtart Function Reference

KiXtart Reference

Function Reference

Bold items are new to this release:

AddKey
AddPrinterConnection
AddProgramGroup
AddProgramItem
Asc
At
BackupEventLog
Box
Chr
ClearEventLog
Close
CompareFileTimes
 CreateObject
DecToHex
DelKey
DelPrinterConnection
DelProgramGroup
DelProgramItem
DelTree
DelValue
Dir
EnumGroup
 EnumIpInfo
EnumKey
EnumLocalGroup
EnumValue
Execute
Exist
ExpandEnvironmentVars
GetDiskSpace
GetFileAttr
GetFileSize
 GetFileTime
GetFileVersion
 GetObject
InGroup
InStr
 InStrRev
KbHit
KeyExist
LCase
Len
 Left
LoadHive
LoadKey
LogEvent
Logoff
LTrim
MessageBox
Open
ReadLine
ReadProfileString
ReadType
ReadValue
RedirectOutput
 Right
Rnd
RTrim
SaveKey
SendKeys
SendMessage
SetAscii
SetConsole
SetDefaultPrinter
SetFileAttr
SetFocus
 SetOption
SetSystemState
 SetTitle
SetWallpaper
ShowProgramGroup
ShutDown
 SidToName
 Split
SRnd
 Substr
 Trim
Ubound
UCase
UnloadHive
Val
 VarType
VarTypeName
WriteLine
WriteProfileString
WriteValue
         Add a key to registry
Add a connection to a network printer (NT only)
Create a new program group
Add/replace an item in current program group
Returns ASCII code of character
Place the cursor at the place indicated
Backs up an NT event log
Draws a text box
Returns ASCII representation of numeric value
Clears an NT event log
Closes an ASCII file opened with OPEN
Compares the file date and time of two files
Launches the COM/OLE Automation server
Returns the HEX equivalent given a decimal value
Delete key from registry
Remove a connection to a network printer (NT only)
Delete a program group
Delete a program item from a program group
Delete key from registry, including subkeys
Delete value of key from registry
Enumerates directories
Returns name of global group the user is member of
Enumerates TCP/IP information of network adapters
Returns name of subkey of key
Returns name of local group the user is member of
Returns name of value of key
Executes a piece of script
Checks if a file exists
Expands environment variables in a string
Returns free disk space (in Kbytes)
Retrieves attributes of a file
Returns the size (in bytes) of a file
Retrieves the date & time of a file
Returns the version string of a file
Gets a COM object from a file stored on disk
Checks for membership of user of specified group
Searches for a string within a string (left to right)
Searches for a string within a string (right to left)
Checks the console for keyboard input
Checks for the existence of a registry subkey
Returns string in lower case
Returns length of a string
Returns X characters from the left side of a string
Load a registry hive
Loads (overwrites!) key (sub keys and values)
LogEvent
Logs current user off
Strips leading spaces from string
Displays a standard Windows dialog box
Opens an ASCII file
Reads a line from an ASCII file opened with OPEN
Read string from an .ini file
Returns ASCII representation of type (eg: REG_SZ)
Returns ASCII representation of value
Redirects all output to a file
Returns X characters from the right side of a string
Returns a pseudo random number
Strips trailing spaces from string
Saves entire key (including sub keys and values)
Sends keystrokes to the focused application
Send a message to another user or workstation
Enables/disables ASCII output
Change display mode of console
Sets the default printer
Sets attributes of a file
Sets focus to a specific application
Enables/disables global settings of the interpreter
Changes the (power) state of the local system
Sets the Window title of the current console
Sets the current wallpaper
Change display status of a program group
Shutdown or reboot local or remote system
Translates a Security Identifier (SID) into a name
splits a single string into an array given a delimiter
Sets the starting point for generating pseudorandom integers
Returns a substring from a string
Strips leading and trailing spaces from a string
Returns the largest available subscript for an array
Returns string in upper case
Unload a registry hive
Returns the numerical value of a string
Returns an integer value indicating the subtype of a variable
Returns a string that provides type info. about a variable
Write a line of text to a file
Write string to an ini-file
Write single value to registry

Most functions take one or more string or numeric expressions as parameters. String parameters are indicated by double quotation marks around the parameter name. Certain functions allow for optional parameters. If you omit these parameters, the function uses a default value instead.

Return Values

Most functions return either a string or a numeric value, and can thus be used anywhere an expression is expected. Most functions also set the values of @ERROR and @SERROR, so you can verify whether or not the function was successful.

Registry Functions

All registry functions use the following format to specify registry subkeys:
[\\remote_computer_name\][Key\]Subkey

Remote_computer_name can be any valid computer name in UNC format (preceded by two backslashes). If you do not specify a remote_computer_name, the program defaults to the local registry.

Key can be any of the main registry trees: HKEY_LOCAL_MACHINE (or HKLM in short), HKEY_USERS (HKU), HKEY_CLASSES_ROOT (HKCR), HKEY_CURRENT_USER (HKCU) or HKEY_CURRENT_CONFIG (HKCC). If you do not specify a root key, KiXtart will use HKEY_CURRENT_USER as the default.

Subkey can be any valid registry subkey. If the name of a subkey contains spaces, enclose the entire expression in quotation marks.

The following examples show correct syntax for registry functions:

"\\VLEERBEER\HKEY_LOCAL_MACHINE\CONTROL"
"HKEY_CURRENT_USER\Program Groups\Games"
"Control Panel\International\Sorting Order"
"HKCU\Program Groups\Games"

Note: When gaining access to a remote registry, you can only specify either HKEY_LOCAL_MACHINE or HKEY_USERS. Also, if you want to gain access to a remote registry from Windows 9x, you must enable remote registry access. For more information, see the instructions in the Admin\Nettools\Remotreg directory on the Windows 9x CD.


Function AddKey()

AddKey( )

Action: Adds the specified subkey to the registry.
Syntax: ADDKEY ("subkey")
Parameters:

Subkey

A string that specifies the name of the subkey you want to add to the registry.

Returns:
0 | Subkey added
Error code | Function failed
See Also: DelKey( ), DelTree( ), ReadType( ), ReadValue( ), WriteValue( )
Example:

$ReturnCode = AddKey("HKEY_CURRENT_USER\EZReg")
If $ReturnCode = 0
  ? "Key added...."
Endif


Function AddPrinterConnection()

AddPrinterConnection( )

Action: Adds a connection to the specified printer for the current user.
Syntax: ADDPRINTERCONNECTION ("printer name")
Parameters:

Printer name

The (share)name of the printer to which to connect.
Remarks: This function is available only on Windows NT family, and can be used only to connect to printers on a server running the Windows NT/2000/XP operating system.

When Windows NT connects to the printer, it may copy printer driver files to the local computer. If the user does not have permission to copy files to the appropriate location, ADDPRINTERCONNECTION fails, and @ERROR returns ERROR_ACCESS_DENIED.

Returns:
0 | Printer connection established
Error code | Function failed
See Also: DelPrinterConnection( ), SetDefaultPrinter( )
Example:

If ADDPRINTERCONNECTION ("\\vleerbeer\hp laserjet 4") = 0
  ? "Added printer connection...."
Endif


Function AddProgramGroup()

AddProgramGroup( )

Action: Instructs Program Manager to create a new program group.
Syntax: ADDPROGRAMGROUP ("group name", common group flag)
Parameters:

Group name

Identifies the group window to be added.

Common group flag

Optional numeric parameter.

This parameter is available only on Windows NT. Common group flag can have the following values:

0 | Creates a personal group.
1 | Creates a common group. The current user must have administrative privileges, or the function fails.
Returns:
0 | Program group added
Error code | Function failed
See Also: AddProgramItem( ), DelProgramGroup( ), DelProgramItem( )
Example:

If AddProgramGroup("NewGroup", 0) = 0
  ? "NewGroup has created...."
Endif


Function AddProgramItem()

AddProgramItem( )

Action: Instructs Program Manager to add an icon to the active program group.
Syntax: ADDPROGRAMITEM ("command line", "name", "icon path", icon index, "default directory", minimize, replace, run in own space)
Parameters:

Command line

Specifies the command line required to run the application. This parameter is a string containing the name of the executable file for the application. It can also include the path of the application and any required parameters.

Name

Specifies the title that is displayed below the icon in the group window.

Icon path

Identifies the file name for the icon to display in the group window. This string identifies a Windows-based executable file or an icon file. If no icon path is specified, Program Manager uses the first icon in the file specified by command line if that file is an executable file.

If command line specifies a file that has been associated with a program, Program Manager uses the first icon provided in the executable file of that program. Association information is obtained from the registry. If command line specifies neither an executable file nor an associated program, Program Manager uses a default icon.

Icon index

This parameter is an integer that specifies the index of the icon in the file identified by the icon path parameter. Program Manager includes five default icons that can be used for programs not written for Windows.

Default directory

Specifies the name of the default (or working) directory. This parameter is a string.

Minimize

Optional numeric parameter. Specifies whether an application window is minimized when first displayed. Possible values for this parameter are:

0 | Default system setting
1 | Minimize

Replace (optional)

Optional numeric parameter. Specifies whether ADDPROGRAMITEM replaces an existing program item with the same name. Possible values for this parameter are:

0 | Adds a new program item without replacing the existing one. This is the default.
1 | Replaces any existing program item.

Run in own space (optional)

Optional numeric parameter. Specifies whether the program runs in its own address space. This parameter applies only to 16-bit Windows applications running on Windows NT. This parameter can have the following values:

0 | Does not run in separate address space. This is the default.
1 | Runs in separate address space.
Remarks: There is a limit of 50 items that can be added to each program group.
Returns:
0 | Program item added
Error code | Function failed
See Also: AddProgramGroup( ), DelProgramGroup( ), DelProgramItem( )
Example:

If AddProgramItem("c:\windows\regedit.exe", "RegEdit", "", 0, "c:\",0,0) = 0
  ? "Added program item 'RegEdit' to current group..."
Endif


Function ASC()

Asc( )

Action: Returns the ASCII code of the character specified.
Syntax: ASC (character)
Parameters:

Character

Character you want to know the ASCII code of.
Returns: Numeric value representing the ASCII code of the character.
See Also: Chr( ) , SetAscii( )
Example:

$ASCII = Asc( "H" )


Function AT()

At( )

Action: Places the cursor in the position indicated.
Syntax: AT (row, column)
Parameters:

Row

Specifies the row at which to position the cursor.

Column

Specifies the column at which to position the cursor.

Remarks: The cursor position is expressed in screen coordinates. A value of 0,0 represents the top left corner of the screen.

The AT command is ignored if all output has been redirected to a file using the REDIRECTOUTPUT function.

See Also: ?, Color, RedirectOutput( )
Returns: Nothing.


Function BackupEventLog()

BackupEventLog( )

Action: Backs up a Windows NT eventlog.
Syntax: BACKUPEVENTLOG ("eventlog", "backupfile")
Parameters: Eventlog

String indicating the eventlog to backup. By default, Windows NT supports three eventlogs: "Application", "Security" and "System". Optionally, the string can include the name of a remote system to backup the log from.

Backupfile

String indicating the name of the backupfile. Note: the file must not exist.
Returns:
0 | Eventlog backed up.
>0 | Errorcode.
See Also: ClearEventLog( ), LogEvent( )
Examples:

$rc=BackupEventLog("Application" , "C:\eventbackups\application.evt")

$rc=BackupEventLog("\\PDC\Application" , "C:\eventbackups\application.evt")

$rc=BackupEventLog("System" , "C:\eventbackups\system.evt")


Function Box()

Box( )

Action: Draws a box.
Syntax: BOX (top_left_row, top_left_column, bottom_right_row, bottom_right_column, "line style")
Parameters: Top_left_row, top_left_column, bottom_right_row, bottom_right_column

The four corners of the box to be drawn, expressed in screen coordinates. A value of 0,0 represents the top left corner of the screen.

Line style

Possible values for line style are:

single | Single line outline, space as filler
double | Double line, space as filler
full | Full line, space as filler
grid | Single line, cross as filler

You can also create a custom box by using a string value for line style. The string can contain as many as 9 characters, which are defined as follows.

This character in the string | Represents this portion of the box
1st | Top-left corner
2nd | Top horizontal
3rd | Top -right corner
4th | Right vertical
5th | Bottom -right corner
6th | Bottom horizontal
7th | Bottom -left corner
8th | Left vertical
9th | Filler
Remarks: The BOX command is ignored if all output is redirected to a file using the REDIRECTOUTPUT function.
Returns: Nothing.
See Also: At( ), Color, RedirectOutput( )
Example:

$rc=BOX(10, 10, 12, 15, "+-+|+-+| ")
; produces the following box:

+---+
|   |
+---+


Function CHR()

Chr( )

Action: Allows you to insert special characters in a string, such as carriage returns.
Syntax: CHR (character code)
Parameters: Character code

A numeric expression representing the character code to insert.

Returns: The string representation of the character code.
See Also: Asc( )
Example:

$CRLF=chr(13) + chr(10)
$Message= "Hello " + @USERID + $CRLF + "Welcome to our network."


Function ClearEventLog()

ClearEventLog( )

Action: Clears up a Windows NT eventlog.
Syntax: CLEAREVENTLOG ("eventlog")
Parameter: Eventlog

String indicating the eventlog to clear. By default, Windows NT supports three eventlogs: "Application", "Security" and "System". Optionally, the string can include the name of a remote system on which to clear the log.

Returns:
0 | Eventlog cleared.
>0 | Errorcode.
See Also: BackupEventLog( ) , LogEvent( )
Examples:

$rc=ClearEventLog("Application")
$rc=ClearEventLog("\\PDC\Application")
$rc=ClearEventLog("System")


Function Close()

Close( )

Action: Closes a file previously opened by the OPEN function.
Syntax: CLOSE (file number)
Parameters: File number

A numeric expression indicating the file number of the file to close. Possible values range from 1 to 10.

Returns:
0 | File Closed
-2 | Invalid File Number Specified
See Also: Open( ), ReadLine( ), WriteLine( )
Example:

If Close(3)
  Beep
  ? "Error closing file!"
ENDIF


Function CompareFileTimes()

CompareFileTimes( )

Action: Compares the date and time of two files.
Syntax: COMPAREFILETIMES ("file1", "file2")
Parameters:

File1

Identifies the first file you want to compare.

File2

Identifies the second file you want to compare.

Returns:
-3 | File2 could not be opened (see @ERROR for more information).
-2 | File1 could not be opened (see @ERROR for more information).
-1 | File1 is older than file2.
0 | File1 and file2 have the same date and time.
1 | File1 is more recent than file2.
See Also: GetFileTime( )
Example:

$Result = CompareFileTimes(@LDRIVE + "\USER.INI", "C:\WINDOWS\USER.INI")
IF $Result = 1 OR $Result = -3
  COPY @LDRIVE + "\USER.INI" "C:\WINDOWS\USER.INI"
ENDIF


Function DecToHex()

DecToHex( )

Action: Returns the hexadecimal representation of a decimal value.
Syntax: DECTOHEX (Decimal value)
Parameters: Decimal value

The value you want to have the hexadecimal representation of.

Returns: A string representing the hexadecimal value of the input value.
Example:

$Result = DexToHex(123)


Function CreateObject()

CreateObject( )

Action: CreateObject launches (if necessary) the OLE Automation server and returns a handle through which an OLE Automation object can be manipulated.
Syntax: CREATEOBJECT (“serverclassname.typename")
Parameters: ServerClassName
The name of the application providing the object.

TypeName
The type or class of the object to create.
Returns: If the function succeeds it returns the handle to the object. If the function fails, it returns 0.
See Also: GetObject( )
Example:
$ObjectHandle = CreateObject("WScript.Shell")


Function DelKey()

DelKey( )

Action: Deletes the specified subkey from the registry.
Syntax: DELKEY ("subkey")
Parameters: Subkey

A string that specifies the name of the subkey you want to delete.

Remarks: This call fails if any subkeys exist within the specified subkey.
Use DelTree if you want to delete a subkey that contains subkeys.
Returns:
0 | Subkey deleted
Error code | Function failed
See Also: AddKey( ) , DelTree( ), ReadType( ), ReadValue( ), WriteValue( )
Example:
$ReturnCode = DelKey("HKEY_CURRENT_USER\EZReg")
If $ReturnCode = 0
  ? "Key deleted...."
Endif


Function DelPrinterConnection()

DelPrinterConnection( )

Action: Deletes a connection to a printer that was established by using AddPrinterConnection.
Syntax: DELPRINTERCONNECTION ("printer name")
Parameters: Printer name

A string that specifies the name of the printer connection to delete.

Remarks: This function is only available on Windows NT/2000.

The DELPRINTERCONNECTION function does not delete any printer driver files that were copied from the server on which the printer resides when the printer connection was established.

Returns:
0 | Printer connection deleted
Error code | Function failed
See Also: AddPrinterConnection( )
Example:

If DelPrinterConnection ("hplaser4") = 0
  ? "Deleted printer connection...."
Endif


Function DelProgramGroup()

DelProgramGroup( )

Action: Instructs Program Manager to delete an existing program group.
Syntax: DELPROGRAMGROUP ("group name", common group flag)
Parameters: Group name

Identifies the group to be deleted.

Common group flag

Optional numeric parameter. This parameter is available only on Windows NT. Common group flag can have the following values:

0
Deletes a personal group.
1
Deletes a common group. The current user must have administrative privileges, otherwise the function fails.
Remarks:

When this function runs, no confirmation is asked nor warning given.

Returns:
0 | Program group deleted
Error code | Function failed
See Also: AddProgramGroup( ) , AddProgramItem( ), DelProgramItem( )
Example:

If DelProgramGroup("NewGroup", 0) = 0
  ? "NewGroup deleted...."
Endif


Function DelProgramItem()

DelProgramItem( )

Action: Instructs Program Manager to delete an item from the active program group.
Syntax: DELPROGRAMITEM ("item name")
Parameters: Item name

Specifies the item to be deleted from the active program group.

Returns:
0 | Program item deleted
Error code | Function failed
See Also: AddProgramGroup( ) , AddProgramItem( ), DelProgramGroup( )
Example:
If DelProgramItem("Whatever") = 0
  ? "ProgramItem 'Whatever' deleted from the current group...."
Endif


Function DelTree()

DelTree( )

Action: Deletes a subkey from the registry, including all the subkeys contained in the specified subkey.
Syntax: DELTREE ("subkey")
Parameters: Subkey

Specifies the subkey to be deleted from the registry.

Remarks: When this function runs, no confirmation is asked nor warning given.
Returns:
0 | Subkey deleted
Error code | Function failed
See Also: AddKey( ) , DelKey( ), ReadType( ), ReadValue( ), WriteValue( )
Example:

$ReturnCode = DelTree("HKEY_CURRENT_USER\EZReg")
If $ReturnCode = 0
  ? "Key deleted...."
Endif


Function DelValue()

DelValue( )

Action: Deletes a value entry from the registry.
Syntax: DELVALUE ("subkey", "entry")
Parameters:

Subkey

A string that specifies the name of the subkey from which you want to delete an entry.

Entry

A string that specifies the name of the entry you want to delete.

Returns:
0 | Value entry deleted
Error code | Function failed
See Also: AddKey( ) , DelKey( ), DelTree( ), ReadType( ), ReadValue( ), WriteValue( )
Example:

$ReturnCode =DelValue("HKEY_CURRENT_USER\EZReg", "Test")
If $ReturnCode = 0
  ? "Value deleted...."
Endif


Function Dir()

Dir( )

Action: Dir can be used to enumerate the files in a directory. Dir returns a string representing the name of a file, directory, or folder that matches a specified pattern. To retrieve subsequent entries in a directory, specify an empty string (“”) as the path.
Syntax: DIR ("path", index)
Parameters: Path

Optional string that specifies a file name — may include directory or folder, and drive. If path is empty (“”), Dir will return the next file of the previously opened enumeration handle. Wildcards (‘*’ and ‘?’) are supported.

Index

Optional number indicating which enumeration handle to use. The Dir function can enumerate two directories at the same time. To open the second enumeration handle, specify 1 for the index.

Returns: Returns a string representing the name of a file, directory, or folder that matches a specified pattern. An empty string ("") is returned if path is not found or to indicate that the end of the current enumration was reached. Dir also sets the value of @ERROR :
0 | Dir successful.
Error code | Function failed.
Example:

$FileName = Dir("C:\TEMP")
While $FileName <> "" and @ERROR = 0
  ? $FileName
  $FileName = Dir() ; retrieve next file
Loop


Function EnumGroup()

EnumGroup( )

Action: Enumerates all groups of which the current user is a member.
Syntax: ENUMGROUP (Index)
Parameters: Index

A numeric value representing the group whose name you want to discover (where 0 is the first subkey).

Returns:
String | Global group name
Error code | Function failed.
See Also: EnumLocalGroup( ), InGroup( )
Example:

$Index = 0
DO
  $Group = ENUMGROUP($Index)
  $Index=$Index+1
UNTIL Len($Group) = 0


Function EnumIpInfo()

EnumIpInfo( )

Action: Enables enumeration of TCP/IP information of all network adapters of the local system.
Syntax: ENUMIPINFO (index, type)
Parameters:

Index

A numeric value representing the IP information group you want to discover (where 0 is the first group).

Type

Optional parameter identifying the type of information you want to enumerate:
0 IP address
1 Subnet mask
2 Adapter description
3 Default gateway
Remarks: This function is available on Windows XP, Windows 2000 and Windows 9x, but not on Windows NT. Furthermore, this function relies on a correct installation of the IP Helper API which is installed as part of Microsoft Internet Explorer 5.0 and higher. Note that there is a known issue with installing the required DLLs on Windows 9x. Full details on this issue can be found in the Q234573 KnowledgeBase article.
Returns: A string representing the requested information.
Example:

$Result = EnumIPInfo()


Function EnumKey()

EnumKey( )

Action: Allows you to list the names of the subkeys contained in a registry key or subkey.
Syntax: ENUMKEY ("subkey", index)
Parameters: Subkey

Specifies the key or subkey for which you want to enumerate the subkeys.

Index

A numeric value representing the position of the subkey whose name you want to discover. Zero (0) represents the first subkey in the key.

Returns:
0 | Function returns a string representing the subkey in the specified key
259 | Subkey does not exist
Error code | Function failed.
See Also: EnumValue( )
Example:

$Index = 0
:Loop1
$KeyName = ENUMKEY("HKEY_CURRENT_USER\Console\", $Index)
If @ERROR = 0
  ? "Name found: $KeyName"
  $Index = $Index + 1
  goto Loop1
Endif


Function EnumLocalGroup()

ENUMLOCALGROUP( )

Action: Enumerates the local groups of which the current user is a member.
Syntax: ENUMLOCALGROUP (Index)
Parameters: Index

A numeric value representing the group whose name you want to discover (where 0 is the first subkey).

Source

Optional string value representing the server or domain whose local groups you want to query.

Remarks: Local group membership in the logondomain can be enumerated using ENUMGROUP. EnumLocalGroup is intended for local groups in other domains or on member servers.
Returns:
String | Local group name
Error code | Function failed.
See Also: EnumGroup( ), InGroup( )
Examples:

$Index = 0
DO
  $Group = ENUMLOCALGROUP($Index)
  $Index=$Index+1
UNTIL Len($Group) = 0

$Index = 0
DO
  $Group = ENUMLOCALGROUP($Index, "\\MyServer")
  $Index=$Index+1
UNTIL Len($Group) = 0


Function EnumValue()

EnumValue( )

Action: Allows you to list the names of the registry entries contained in a specific key or subkey.
Syntax: ENUMVALUE ("subkey", index)
Parameters: Subkey

Specifies the key or subkey for which you want to enumerate the value entries.

Index

A numeric value representing the position of the entry whose name you want to discover. Zero (0) represents the first entry in the subkey.
Returns:
String | Function returns a string representing the entry in the specified key or subkey.
259 | Subkey does not exist.
Error code | Function failed.
See Also: EnumKey( )
Example:

$Index = 0
:Loop1
$ValueName = ENUMVALUE ("HKEY_CURRENT_USER\Console\Configuration", $Index)
If @ERROR = 0
? "Name found: $ValueName"
  $Index = $Index + 1
goto Loop1
Endif


Function Execute()

Execute( )

Action: Executes a piece of KiXtart script code.
Syntax: EXECUTE (script code)
Parameters: Script code

A string expression representing the code to execute.

Returns: The exit code of the executed script.
Examples:

$res = Execute( '? "This is a demo of the Execute() function"' )
$res = Execute( '$$X = 10' ) ; note the extra '$'
$res = Execute( '$$X = ' + @USERID )


Function Exist()

Exist( )

Action: Checks for the existence of one or more files.
Syntax: EXIST ("file name")
Parameters: File name

Identifies the file(s) you want to locate.

Remarks: Supports wildcards.
Returns:
0 | File not found
1 | File found
Examples:

IF EXIST (@LDRIVE + “\users.txt")
  DISPLAY @LDRIVE + “\users.txt"
ENDIF

IF EXIST (@LDRIVE + “\*.INI")
  ; Etc, etc.
ENDIF


Function GetDiskSpace()

GetDiskSpace( )

Action: Returns the number of kilobytes (KB) available to the current user on a specific drive.
Syntax: GETDISKSPACE ("drive")
Parameters:

Drive

String that specifies a directory on the disk of interest. On Windows NT and on Windows 95 OSR2 and later versions, this string can be a UNC name. If this parameter is a UNC name, you must follow it with an additional backslash. For example, you would specify \\MyServer\MyShare as \\MyServer\MyShare\.

If Drive is an empty string, GetDiskSpace obtains information about the disk that contains the current directory.

On Windows NT and on Windows 95 OSR2 and later versions, Drive does not have to specify the root directory on a disk. On these platforms, the function accepts any directory on a disk.
Remarks: On Windows 95 OSR1 and earlier versions, the function can only return correct values for volumes that are smaller than 2 gigabytes in size. On Windows NT and Windows 95 OSR2 and later versions, the function always returns correct values, regardless of the size of the volume.
Returns: A number representing the number of kilobytes (KB) available to the current user on the drive specified.
Examples:

$Result = GetDiskSpace( "C:\" )
$Result = GetDiskSpace( "X:\MARKETING" )


Function GetFileAttr()

GetFileAttr( )

Action: Returns the attributes of a file.
Syntax: GETFILEATTR ("file name")
Parameters: File name

Identifies the file for which you want to retrieve the attributes.

Returns:

Zero to indicate the function failed. If the function failed, check @ERROR for details on the error. Otherwise, the return value represents the attributes of the file. The attributes can be one or more of the following values:

1 | Read only | The file or directory is read-only. Applications can read the file but cannot write to it or delete it. In the case of a directory, applications cannot delete it.
2 | Hidden | The file or directory is hidden. It is not included in an ordinary directory listing.
4 | System | The file or directory is part of, or is used exclusively by, the operating system.
16 | Directory | The filename identifies a directory.
32 | Archive | The file or directory is an archive file or directory. Applications use this attribute to mark files for backup or removal.
64 | Encrypted | The file or directory is encrypted. For a file, this means that all data streams are encrypted. For a directory, this means that encryption is the default for newly created files and subdirectories.
128 | Normal | The file or directory has no other attributes set. This attribute is valid only if used alone.
256 | Temporary | The file is being used for temporary storage. File systems attempt to keep all of the data in memory for quicker access rather than flushing the data back to mass storage. A temporary file should be deleted by the application as soon as it is no longer needed.
512 | Sparse file | The file is a sparse file.
1024 | Reparse point | The file has an associated reparse point.
2048 | Compressed | The file or directory is compressed. For a file, this means that all of the data in the file is compressed. For a directory, this means that compression is the default for newly created files and subdirectories.
4096 | Offline | The data of the file is not immediately available. Indicates that the file data has been physically moved to offline storage.
See Also: GetFileSize( ), GetFileTime( ), GetFileVersion( ), SetFileAttr( )
Example:

$Result = GetFileAttr(@LDRIVE + "\Kix32.exe")
IF GetFileAttr( "C:\TEMP" ) & 16
  ; Bitwise AND on 4th bit
  ? "C:\temp is a directory !"


Function GetFileSize()

GetFileSize( )

Action: Returns the size of a file in bytes.
Syntax: GETFILESIZE ("file name")
Parameters: File name

Identifies the file for which you want to retrieve the size.

Remarks: The maximum size of files that GetFileSize can correctly report the size of is 2,147,483,647 bytes.
Returns: Size of the file in bytes.
See Also: GetFileAttr( ) , GetFileTime( ), GetFileVersion( )
Example:

$Result = GetFileSize(@LDRIVE + "\Kix32.exe")


Function GetFileTime()

GetFileTime( )

Action: Returns the date and time information of a file.
Syntax: GETFILETIME ("file name")
Parameters:

File name

Identifies the file for which you want to retrieve the date and time information.

Remarks: The information returned represents the time the file was last written to.
Returns: A string representing the date and time of the file in the format “YYYY/MM/DD HH:MM:SS”.
See Also: CompareFileTimes( ), GetFileAttr( ) , GetFileSize( ), GetFileVersion( )
Example:

$Result = GetFileTime(@LDRIVE + "\Kix32.exe")


Function GetFileVersion()

GetFileVersion( )

Action: Returns a version information string of a file.
Syntax: GETFILEVERSION ("filename",”versionfield”)
Parameters: Filename

Identifies the file for which you want to get the version string.

Versionfield

Optional parameter identifying the specific version information field that should be retrieved.

By default, the FileVersion field is returned. Possible values for this field are :

Comments This field contains any additional information that should be displayed for diagnostic purposes.

CompanyName This field identifies the company that produced the file. For example, "Microsoft Corporation" or "Standard Microsystems Corporation, Inc."

FileDescription This field describes the file in such a way that it can be presented to users. This string may be presented in a list box when the user is choosing files to install. For example, "Keyboard driver for AT-style keyboards" or "Microsoft Word for Windows".

FileVersion This field member identifies the version of this file. For example, "3.00A" or "5.00.RC2".

InternalName This field identifies the file's internal name, if one exists. For example, this string could contain the module name for a dynamic-link library (DLL), a virtual device name for a Windows virtual device, or a device name for an MS-DOS device driver.

Language Full English name of the language of the file specified in the format defined by ISO Standard 639. (example : “0413Dutch (Standard)”).

LegalCopyright This field describes all copyright notices, trademarks, and registered trademarks that apply to the file. This should include the full text of all notices, legal symbols, copyright dates, trademark numbers, and so on. In English, this string should be in the format "Copyright Microsoft Corp. 1990–1994".

LegalTrademarks This field describes all trademarks and registered trademarks that apply to the file. This should include the full text of all notices, legal symbols, trademark numbers, and so on. In English, this string should be in the format "Windows is a trademark of Microsoft Corporation".

OriginalFilename This field identifies the original name of the file, not including a path. This enables an application to determine whether a file has been renamed by a user. This name may not be MS-DOS 8.3-format if the file is specific to a non-FAT file system.

PrivateBuild This field describes by whom, where, and why this private version of the file was built. For example, "Built by OSCAR on \OSCAR2".

ProductName This field identifies the name of the product with which this file is distributed. For example, this string could be "Microsoft Windows".

ProductVersion This field identifies the version of the product with which this file is distributed. For example, "3.00A" or "5.00.RC2".

SpecialBuild This field describes how this version of the file differs from the normal version. For example, "Private build for Olivetti solving mouse problems on M250 and M250E computers".
Remarks: The information returned by this function is the same as the version information displayed in Windows Explorer.
This function applies only to 32-bit Windows – based executable files.
Returns: A string representing the file version field.
See Also: GetFileAttr( ), GetFileSize( ), GetFileTime( )

Example:

$Result = GetFileVersion(@LDRIVE + "\Kix32.exe")
$Result = GetFileVersion(@LDRIVE + "\Kix32.exe", "ProductVersion" )


Function GetObject()

GetObject( )

Action: GetObject gets an object either from a file stored on disk and returns a handle to the object.
Syntax: GETOBJECT (“objectname" )
Parameters:

ObjectName

Full path and name of the file containing the object to retrieve. If pathname is omitted, class is required.
Returns: If the function succeeds it returns the handle to the object. If the function fails, it returns 0, and @ERROR will be set to a relevant errorcode.
See Also: CreateObject( )
Example:
$ObjectHandle = GetObject("LDAP://localhost")


Function InGroup()

InGroup( )

Action: Checks whether the current user is a member of a group.
Syntax: INGROUP ("group name")
Parameters: Group name

Identifies the group in which to check the user's membership.

Remarks: INGROUP can be used to check for groupmembership of groups that exist on the domain or server where the user is logged on, or to check for groupmembership of groups on a specific domain or server.

When checking for a local group, INGROUP identifies that the user is indirectly a member of the group by virtue of being a member of a global group which, in turn, is a member of the local group.

If you want to check for membership in a group on a specific domain or server, use the following format:

"OtherDomain\group"
–or–
"\\SomeServer\group"

For Windows 9x clients, INGROUP works on local groups only if the KiXtart RPC service is running.
Returns:
0 | The user is not a member of a group with this name.
1 | The user is a member of a global group with this name.
See Also: EnumGroup( ), EnumLocalGroup( )
Examples:

IF INGROUP("Domain Users")
  DISPLAY "z:\users.txt"
ENDIF

IF INGROUP("\\" + @WKSTA + "\Developers")
  ? "Member of local group Developers on local system"
ENDIF


Function Instr()

InStr( )

Action: Scans a string (from left to right) for the presence of a second string.
Syntax: INSTR ("string1", "string2")
Parameters:

String1

The string to search in.

String2

The string to search for.

Returns:
? | Offset of the first character of string2 found in string1
0 | String2 not present in string1
See Also: InStrRev( ), Left( ), Right( ), SubStr( )
Example:

; check if domain contains the string "TEST"
$x = INSTR(@DOMAIN, "TEST")


Function Instr()

InStrRev( )

Action: Scans a string (from right to left) for the presence of a second string.
Syntax: INSTRREV ("string1", "string2")
Parameters:

String1

The string to search in.

String2

The string to search for.

Returns:
? | Offset of the first character of string2 found in string1, counted from the end of string1
0 | String2 not present in string1
See Also: InStr( ), Left( ), Right( ), SubStr( )
Example:

; find last backslash in @CURDIR
$x = INSTRREV(@CURDIR, "\")


Function ExistKey()

KbHit( )

Action: Checks the console for keyboard input.
Syntax: KBHIT ( )
Returns:
<> 0 | Keystroke waiting in keyboard buffer.
0 | No keystroke in keyboard buffer.
See Also: Get, Sleep
Example:

If KbHit()
  Get $x ; grab the keystroke from the buffer
Endif


Function ExistKey()

KeyExist( )

Action: Checks for the existence of a registry subkey.
Syntax: KEYEXIST ("subkey")
Parameters: Subkey

Identifies the subkey you want to locate.

Remarks: KEYEXIST is a replacement to the EXISTKEY function found in previous versions of KiXtart. While functionally equivalent, the Return Codes are now inverted, resulting in behavior similar to the EXIST function.
Returns:
1 | Subkey found
0 | Subkey not found
See Also: AddKey( ), DelKey( ), DelTree( )
Example:

$ReturnCode = KeyExist("HKEY_CURRENT_USER\Console\Configuration")
If $ReturnCode
  ? "Key exists...."
Endif


Function Lcase()

Lcase( )

Action: Returns a string in lowercase.
Syntax: LCASE ("string")
Parameters:

String

The string you want to change to lowercase.

Returns: The input string in lowercase.
See Also: Ucase( )
Example:

$x = LCASE(@USERID)


Function Len()

Len( )

Action: Returns the length of a string.
Syntax: LEN ("string")
Parameters: String

The string whose length you want to discover.

Returns: The number of characters contained in the specified string.
Example: $x = LEN(@USERID)


Function LoadHive()

LoadHive( )

Action: Creates a subkey under HKEY_USERS or HKEY_LOCAL_MACHINE and stores registration information from a specified file into that subkey. This registration information is in the form of a hive. A hive is a discrete body of keys, subkeys, and values that is rooted at the top of the registry hierarchy. A hive is backed by a single file and .LOG file.
Syntax: LOADHIVE ("key", "file name")
Parameters: Key

The key you want to load the information in. This key must reside under HKEY_LOCAL_MACHINE or HKEY_USERS.

File name

Identifies the file you want to load the information from. This file specified needs to be a legal registry hive (created by SAVEKEY, or from REGEDT32.EXE).

Remarks: On Windows NT, using LOADHIVE requires Backup and Restore privileges.
Returns:
0 | Hive loaded
Error code | Function failed
See Also: LoadKey( ), SaveKey( ), UnloadHive( )
Example:

$ReturnCode = LoadHive("HKEY_USERS\EZReg", "c:\temp\tst.reg")
If $ReturnCode = 0
  ? "Hive loaded...."
Endif


Function LoadKey()

LOADKEY( )

Action: Loads a registry key (including its subkeys and values) from a file.
Syntax: LOADKEY ("subkey", "file name")
Parameters:

Subkey

The subkey in which you want to load the information. This subkey must exist for the call to be successful.

File name

Identifies the file from which to import the information. This file must be a valid registry hive file created by using the SAVEKEY function, or by using a registry editor.

Remarks: On Windows NT, using LOADKEY requires Backup and Restore privileges.
Caution: LOADKEY imports information into the registry and overwrites any existing subkey. This replaces all the subkeys and values that may already exist in the subkey you are loading. Any existing values and subkeys are lost.
Returns:
0 | Subkey loaded
Error code | Function failed
See Also: LoadHive( ), SaveKey( ), UnloadHive( )
Example:

$ReturnCode = LoadKey("HKEY_CURRENT_USER\EZReg", "c:\temp\tst.reg")
If $ReturnCode = 0
  ? "Key loaded...."
Endif


Function LogEvent()

LogEvent( )

Action: Logs an event in the Windows NT event log.
Syntax: LOGEVENT (type, ID, message, target, source)
Parameters: Type

Number representing the type of the event. Possible values:

0 | SUCCESS
1 | ERROR
2 | WARNING
4 | INFORMATION
8 | AUDIT_SUCCESS
16 | AUDIT_FAILURE

ID

Number representing the event that occurred.

Message

Message text of the event.

Target

Optional parameter representing the UNC name of the system where the event should be logged. By default, all events are logged on the local system.

Source

Optional parameter representing the source of the event. If this parameter is not specified, KiXtart will assume the KIX32.EXE as the source of the event.

Remarks: This function is only available on Windows NT/2000 clients.
Returns:
0 | Event logged
Error code | Function failed
See Also: BackupEventLog( ), ClearEventLog( )
Example:

$RC = LogEvent( 0 , 1 , "Logon script completed successfully" , "", "MyEvent" )
$RC = LogEvent( 0 , 1 , "Logon script completed successfully")
$RC = LogEvent( 1 , 1 , "Logon script failed!" , @LSERVER )


Function Logoff()

Logoff( )

Action: Logs the current user off and ends the Windows session.
Syntax: LOGOFF (force)
Parameters: Force

During a logoff operation, applications that are shut down are allowed a specific amount of time to respond to the logoff request. If the time expires, Windows displays a dialog box that allows the user to forcibly shut down the application, to retry the logoff, or to cancel the logoff request. If the Force value is true (ie : non-zero), Windows always forces applications to close and does not display the dialog box.

0 | Windows does not force applications to close.
1 | Windows always forces applications to close and does not display the dialog box.
Returns:
0 | User logged off
Error code | Function failed
See Also: Shutdown( )
Example:

$RC = LogOff(0)


Function Ltrim()

LTrim( )

Action: Strips leading spaces from an input string and returns the result.
Syntax: LTRIM ("string")
Parameters: String

The string from which to strip leading spaces.

Returns: The input string without leading spaces.
See Also: RTrim( ), Trim( )
Example:

$x = LTRIM(SUBSTR(@IPADDRESS0, 1, 3))


Function MessageBox()

MessageBox( )

Action: Displays a standard dialog box in Windows.
Syntax: MESSAGEBOX ("message", "title", style, time-out)
Parameters: Message

The message to display in the dialog box.

Title

The title of the dialog box.

Style (optional)

Optional numeric expression that is the sum of values specifying the number and type of buttons to display, the icon style to use, the identity of the default button, and the modality. The following table illustrates the values used and the meaning of each group of values.

Buttons to display

Value

Meaning

0

Display OK button only.

1

Display OK and Cancel buttons.

2

Display Abort, Retry, and Ignore buttons.

3

Display Yes, No, and Cancel buttons.

4

Display Yes and No buttons.

5

Display Retry and Cancel buttons.

Icon to display

Value

Meaning

16

Stop symbol

32

Question mark

48

Exclamation mark

64

Information symbol

Default button

Value

Meaning

0

First button is default.

256

Second button is default.

512

Third button is default.

Modality

Value

Meaning

0

Application-modal. The user must respond to the message box before continuing work in the application.

4096

System-modal. All applications are suspended until the user responds to the message box.

When adding numbers to create a final value for the argument type, use only one number from each group. If style is omitted, a default value of 0 is assumed.

Time-out (optional)

Optional numeric expression representing the number of seconds after which to close the dialog box.

Note: The time-out feature only works if the MESSAGEBOX dialog box is the active window for the duration of the time-out. If the user switches away from KiXtart and activates another application, the MESSAGEBOX dialog box is not closed.

Remarks: MESSAGEBOX displays a maximum of 1024 characters in application-modal dialog boxes. Longer messages are truncated after the 1024th character. Message strings longer than 255 characters with no intervening spaces are truncated after the 255th character. For system-modal dialog boxes, the number of characters you can display depends on screen resolution and number of lines in the message.

MESSAGEBOX breaks lines automatically at the right edge of the dialog box. If you want to set line breaks yourself, place a linefeed (ANSI character 10) before the first character of the text that is to begin each new line.

Returns: The value returned by MESSAGEBOX indicates which button was selected, as shown in the following table.

Value | Meaning
-1 | User did not respond to the dialog box within the specified time-out period.
1 | OK button selected.
2 | Cancel button selected.
3 | Abort button selected.
4 | Retry button selected.
5 | Ignore button selected.
6 | Yes button selected.
7 | No button selected.

If the dialog box contains a Cancel button, pressing esc has the same effect as choosing Cancel.

Example:

$Selection = MessageBox("Do you want to continue ?", "KiXtart", 36)
If $Selection = 6
  ? "Yes selected, continuing...."
Endif


Function Open()

Open( )

Action: Opens a text file.
Syntax: OPEN (file number, "file name", mode)
Parameters:

File number

A numeric expression indicating the file number of the file to open. Possible values range from 1 to 10.

File name

A string expression indicating the path and name of the ASCII file to open.

Mode

Optional parameter that indicates what should happen if the file does not exist. This parameter can have the following values:

0 | If the file does not exist, OPEN fails with return code 2 (default).
1 | If the file does not exist, OPEN will create a new file.
2 | Opens the file for read access (default).
4 | Opens the file for write access.

Note: These values are cumulative. So if you want to open a file for write access, and create it if it does not yet exist, you should specify 5. Notice however that a file can not be opened for read and write access at the same time.

Remarks:

OPEN opens the ASCII file specified by file name, for the internal buffer indicated by file number. KiXtart supports a maximum of ten open files, so file number must be within the range of 1 to 10.

The file-I/O functions in KiXtart (OPEN, READLINE, and CLOSE) process small configuration files. They are not intended for larger operations, such as scanning long files. For the sake of simplicity and speed, OPEN reads an entire ASCII file into memory, and subsequent READLINE commands read lines stored in memory.

Although this design is memory-intensive, it is also very fast and simple.
Returns:
-3 | File number already in use
-2 | Invalid file number specified
-1 | Invalid file name specified
0 | File opened successfully
>0 | System error
See Also: Close( ), ReadLine( ), WriteLine( )
Example:

IF Open(3, @LDRIVE + "\CONFIG\SETTINGS.INI") = 0
  $x = ReadLine(3)
  WHILE @ERROR = 0
    ? "Line read: [" + $x + "]"
    $x = ReadLine(3)
  LOOP
ENDIF


Function ReadLine()

ReadLine( )

Action: Reads a line from a file.
Syntax: READLINE (file number)
Parameters:

File number

A numeric expression indicating the file number of the file to open. Possible values range from 1 to 10.

Remarks: READLINE reads a string ending in a carriage return. If successful, the function returns the string without a carriage return. If it encounters an error, @ERROR returns an error code.
Returns:
-4 | File not open for reading
-3 | File number not open
-2 | Invalid file number specified
-1 | End of file
0 | Line read successfully
See Also: Close( ), Open( ), WriteLine( )
Example:

IF Open(3, @LDRIVE + "\CONFIG\SETTINGS.INI") = 0
  $x = ReadLine(3)
  WHILE @ERROR = 0
    ? "Line read: [" + $x + "]"
    $x = ReadLine(3)
  LOOP
  Close (3)
ELSE
  BEEP
  ? "Config file not opened, error code: [" + @ERROR + "]"
ENDIF


Function ReadProfileString()

ReadProfileString( )

Action: Retrieves a string from an initialization file.
Syntax: READPROFILESTRING ("file name", "section", "key")
Parameters: File name

A string that names the initialization file. If this parameter does not include a full path, Windows searches for the file in the Windows directory.

Section

A string that specifies the section containing the key name. If this parameter is empty, READPROFILESTRING returns all section names in the file.

Key

A string containing the key name whose associated string is to be retrieved. If this parameter is empty, all key names in the section specified by section are returned.

Remarks: This function is provided for compatibility with 16-bit Windows – based applications. Win32 – based applications store initialization information in the registry.
Returns: Function returns a string representing the value of the specified key.
See Also: WriteProfileString( )
Example:

$dev = ReadProfileString("win.ini", "Windows", "Device")
If @ERROR = 0
  ? "Windows device = " + $dev
Endif


Function ReadType()

ReadType( )

Action: Returns the ASCII representation of a registry entry data type (for example, REG_SZ).
Syntax: READTYPE ("subkey", "entry")
Parameters: Subkey

Identifies the subkey containing the entry.

Entry

Identifies the entry whose data type you want to discover.

Returns:
0 | Function returns ASCII representation of data type for specified registry entry
Error code | Function failed

The following data types can be returned:
REG_NONE
REG_SZ
REG_EXPAND_SZ
REG_BINARY
REG_DWORD
REG_DWORD_LITTLE_ENDIAN
REG_DWORD_BIG_ENDIAN
REG_LINK
REG_MULTI_SZ
REG_RESOURCE_LIST
REG_FULL_RESOURCE_DESCRIPTOR

See Also: AddKey( ) , DelKey( ), DelTree( ), ReadValue( ), WriteValue( )
Example:

$RowsType = ReadType( "HKEY_CURRENT_USER\Console\Configuration", "WindowRows")
If @ERROR = 0
  ? "Type of WindowRows: $RowsType"
Endif


Function ReadValue()

ReadValue( )

Action: Reads the value of a registry entry.
Syntax: READVALUE ("subkey", "entry")
Parameters:

Subkey

Identifies the subkey containing the entry.

Entry

Identifies the entry whose value you want to discover. To read the default entry of a key, specify an empty string as the entry name (“”).

Returns:
0 | Function returns ASCII representation of the specified registry entry
Error code | Function failed

REG_MULTI_SZ (multi-string) variables are returned with the pipe symbol ( | ) used as the separator between strings. If a string contains a pipe symbol character, it is represented by two pipe symbol characters ( || ).

REG_DWORD variables are returned in decimal format.
See Also: AddKey( ) , DelKey( ), DelTree( ), ReadType( ), ReadValue( ), WriteValue( )
Example:

$Rows = ReadValue ("HKEY_CURRENT_USER\Console\Configuration", "WindowRows")
If @ERROR = 0
  ? "Number of window-rows: $Rows"
Endif


Function RedirectOutput()

RedirectOutput( )

Action: Allows you to redirect all screen output to a file.
Syntax: REDIRECTOUTPUT ("file name", overwrite)
Parameters: File name

A string that names the file to which to redirect the output. If this parameter is an empty string (""), output is redirected to the screen.

Overwrite (optional)

Optional numeric value indicating whether to clear the output file before writing any data to it. This parameter can have the following values:

0 | New output data appended to the existing contents of file.
1 | All data in file overwritten when the output is redirected to the file.
Remarks: If all output is redirected to a file, the AT, BIG, BOX, and CLS commands are ignored.
Returns:
0 | Output redirected
Error code | Function failed

REG_MULTI_SZ (multi-string) variables are returned with the pipe symbol ( | ) used as the separator between strings. If a string contains a pipe symbol character, it is represented by two pipe symbol characters ( || ).

REG_DWORD variables are returned in decimal format.
Example:

IF RedirectOutput("logon.log") = 0
  ? "Opened 'logon.log' at " + @TIME ?
ENDIF


Function Rnd()

Rnd( )

Action: Returns a pseudo random number.
Syntax: RND (Range)
Parameters: Range (optional)

Optional parameter indicating the range for the return value (maximum and default value = 32767).

Remarks: The RND function returns a pseudorandom integer ranging from 0 to the maximum specified. Use the SRND function to seed the pseudorandom-number generator before calling RND.
Returns: Pseudo random number.
See Also: SRnd( )
Examples: $x = RND()

$x = RND(10)


Function Rtrim()

RTrim( )

Action: Strips trailing spaces from an input string and returns the result.
Syntax: RTRIM ("string")
Parameters: String

The string from which to strip trailing spaces.

Returns: The input string without trailing spaces.
See Also: LTrim( ), Trim( )
Example:

$x = RTRIM(SUBSTR(@IPADDRESS0, 1, 3))


Function SaveKey()

SaveKey( )

Action: Saves a registry key (including its subkeys and value entries) to a file.
Syntax: SAVEKEY ("subkey", "file name")
Parameters: Subkey

Identifies the subkey you want to save.

File name

Identifies the file in which to save the information.

Remarks: When this function runs, the destination file is overwritten without warning.

On Windows NT, running SAVEKEY requires Backup and Restore privileges.

Returns:
0 | Subkey saved
Error code | Function failed
See Also: LoadKey( )
Example:

$ReturnCode = SaveKey("HKEY_CURRENT_USER\EZReg", "c:\temp\tst.reg")
If $ReturnCode = 0
  ? "Key saved...."
Endif


Function SendKeys()

SendKeys( )

Action: Sends one or more keystrokes to the active window as if typed at the keyboard.
Syntax: SENDKEYS ("keys")
Parameters: Keys

String specifying the keystrokes to send.

Each key is represented by one or more characters. To specify a single keyboard character, use the character itself. For example, to represent the letter A, use "A" for string. To represent more than one character, append each additional character to the one preceding it. To represent the letters A, B, and C, use "ABC" for string. The plus sign (+), caret (^),tilde (~), and parentheses ( ) have special meanings to SendKeys. To specify one of these characters, enclose it within braces ({}). For example, to specify the plus sign, use {+}. To specify brace characters, use {{} and {}}.

To specify characters that aren't displayed when you press a key, such as ENTER or TAB, and keys that represent actions rather than characters, use the codes shown below:

BACKSPACE | {BACKSPACE}
BREAK | {BREAK}
CAPS LOCK | {CAPSLOCK}
DEL | {DEL}
DOWN ARROW | {DOWN}
END | {END}
ENTER | {ENTER}
ESC | {ESC}
HELP | {HELP}
HOME | {HOME}
INS | {INS}
LEFT ARROW | {LEFT}
NUM LOCK | {NUMLOCK}
PAGE DOWN | {PGDN}
PAGE UP | {PGUP}
PRINT SCREEN | {PRTSC}
RIGHT ARROW | {RIGHT}
TAB | {TAB}
UP ARROW | {UP}
F1 | {F1}
F2 | {F2}
F3 | {F3}
F4 | {F4}
F5 | {F5}
F6 | {F6}
F7 | {F7}
F8 | {F8}
F9 | {F9}
F10 | {F10}
F11 | {F11}
F12 | {F12}
F13 | {F13}
F14 | {F14}
F15 | {F15}
F16 | {F16}

To specify keys combined with any combination of the SHIFT, CTRL, and ALT keys, precede the key code with one or more of the following codes:

SHIFT | +
CTRL | ^
ALT | ~

To specify that any combination of SHIFT, CTRL, and ALT should be held down while several other keys are pressed, enclose the code for those keys in parentheses. For example, to specify to hold down SHIFT while E and C are pressed, use "+(EC)". To specify to hold down SHIFT while E is pressed, followed by C without SHIFT, use "+EC".

To specify repeating keys, use the form {key number}. You must put a space between key and number. For example, {LEFT 42} means press the LEFT ARROW key 42 times; {h 10} means press H 10 times.
Remarks: You can't use SendKeys to send keystrokes to an application that is not designed to run in Microsoft Windows. Sendkeys also can't send the PRINT SCREEN key {PRTSC} to any application.
Returns:
0 | Keystrokes sent
Error code | Function failed
See Also: SetFocus( )
Example:

Run("Notepad.exe")
SetFocus("Untitled – Notepad")
$ReturnCode = SendKeys("Hello World")
Sleep( 2 )
$ReturnCode
      = SendKeys("~{F4}Y")


Function SendMessage()

SendMessage( )

Action: Sends a message across the network to another user or workstation.
Syntax: SENDMESSAGE ("recipient", "message")
Parameters: Recipient

Identifies the user or workstation to which to send the message.

Message

The message to send.

Returns:
0 | Message sent
Error code | Function failed
Example:

$ReturnCode = SendMessage("ADMIN" , @USERID + " logged in at " + @TIME)
If $ReturnCode = 0
  ? "Message has been sent.."
Endif


Function SetAscii()

SetASCII( )

Action: Enables enabling/disabling of ASCII output. In KiXtart, standard console output is in Unicode, and SetASCII enables you to change this to ASCII, so you can output extended characters, such as line characters.
Syntax: SETASCII ("mode")
Parameters: Mode

String that specifies whether to turn ASCII output on or off. Specifying “ON” will turn ASCII output on, and specifying “OFF” will turn ASCII output off.

Returns:
"ON" | "OFF" Previous output state.
Example:

$previousstate = SetASCII( “ON” )

? "═══════════"  ; output ASCII line characters

$rc = SetASCII( $previousstate )

Remarks: SetASCII is only supported for backward compatibility. New scripts should use the SetOption( ) function.


Function SetConsole()

SetConsole( )

Action: Allows you to change the display state of the command-prompt window in which KiXtart is running.
Syntax: SETCONSOLE("mode")
Parameters: Mode

String that specifies the new display state. The following table shows the display states that are supported by this function.

SHOW | Show window
HIDE | Hide window
FOREGROUND | Move window to foreground
ALWAYSONTOP | Bring window to top
MINIMIZE | Minimize window
MAXIMIZE | Maximize window
Remarks: If you hide the window, it does not disappear from the system, but remains active.
Returns:
0 | Display state changed
Error code | Function failed
Example:

If SetConsole ("FOREGROUND") = 0
  ? "Console moved to foreground......"
Endif


Function SetDefaultPrinter()

SetDefaultPrinter( )

Action: Sets the default printer to which applications send print jobs.
Syntax: SETDEFAULTPRINTER ("printer name")
Parameters: Printer name

String that specifies the fully qualified name of the printer to set as the default printer. Note that if the printer involved was connected to using AddPrinterConnection, you must include both the servername and the sharename.

Returns:
0 | Default printer set
Error code | Function failed
See Also: AddPrinterConnection( )
Example:
If AddPrinterConnection ("\\vleerbeer\hp laserjet 4") = 0
   ? "Added printer connection...."
   If SetDefaultPrinter ("\\vleerbeer\hp laserjet 4") = 0
      ? "Set default printer to HP LaserJet 4...."
   Endif
Endif


Function SetFileAttr()

SetFileAttr( )

Action: Sets the attributes of a file.
Syntax: SETFILEATTR ("file name", attributes)
Parameters: File name

Identifies the file for which you want to set the attributes.

Attributes

Attributes to set for the file. The attributes can be one or more of the following values:

1 | Read only | The file or directory is read-only. Applications can read the file but cannot write to it or delete it. In the case of a directory, applications cannot delete it.
2 | Hidden | The file or directory is hidden. It is not included in an ordinary directory listing.
4 | System | The file or directory is part of, or is used exclusively by, the operating system.
32 | Archive | The file or directory is an archive file or directory. Applications use this attribute to mark files for backup or removal.
128 | Normal | The file or directory has no other attributes set. This attribute is valid only if used alone.
256 | Temporary | The file is being used for temporary storage. File systems attempt to keep all of the data in memory for quicker access rather than flushing the data back to mass storage. A temporary file should be deleted by the application as soon as it is no longer needed.
4096 | Offline | The data of the file is not immediately available. Indicates that the file data has been physically moved to offline storage.
Returns:
0 | Attributes set
Error code | Function failed
See Also: GetFileAttr( )
Example:

$Result = SetFileAttr(@LDRIVE + "\Kix32.exe", 32)


Function SetFocus()

SetFocus( )

Action: Sets the input focus to the application specified. This function is very useful in combination with the SendKeys function.
Syntax: SETFOCUS ("Title")
Parameters: Title

String specifying the title in the title bar of the application window you want to activate. In determining which application to activate, title is compared to the title string of each running application. If there is no exact match, any application whose title string begins with title is activated. If there is more than one instance of the application named by title, one instance is arbitrarily activated.

Returns:
0 | Focus set to specified application
Error code | Function failed
See Also: SendKeys( )
Example:

If SetFocus ("Untitled - Notepad") = 0
  ? "Focus set to Notepad...."
Endif


Function SetTitle()

SetTitle( )

Action: Sets the title of the current console.
Syntax: SETTITLE ("title")
Parameters: Title

String that will be used as the new title for the current console.

Remarks: The title is only active while KiXtart runs. As soon as KiXtart exits, the original title of the console will be restored.
Returns:
0 | Title set
Error code | Function failed
See Also: SetConsole( )
Example:

If SetTitle ("KiXtart Logon") = 0
  ? "Set the new title...."
Endif


Function ShowProgramGroup()

ShowProgramGroup( )

Action: Instructs Program Manager to minimize, maximize, or restore the window of an existing program group.
Syntax: SHOWPROGRAMGROUP ("group name", show command, common group flag)
Parameters: Group name

Identifies the group window to minimize, maximize, or restore.

Show command

Specifies the action Program Manager is to perform on the group window. This parameter is an integer and it must have one of the following values.

Value | Action
1 | Activates and displays the group window. If the window is minimized or maximized, Windows restores it to its original size and position.
2 | Activates the group window and displays it as an icon.
3 | Activates the group window and displays it as a maximized window.
4 | Displays the group window in its most recent size and position. The active window remains active.
5 | Activates the group window and displays it in its current size and position.
6 | Minimizes the group window.
7 | Displays the group window as an icon. The active window remains active.
8 | Displays the group window in its current state. The active window remains active.

Common group flag

Optional numeric parameter. This parameter is available only on Windows NT/2000. Common group flag can have the following values:

0 | Acts upon a personal group.
1 | Acts upon a common group. To manipulate a common group, the user must have administrative privileges, or the function fails.
Returns:
0 | Program group maximized, minimized, or restored
Error code | Function failed
See Also: AddProgramGroup( )
Example:

If ShowProgramGroup("NewGroup", 6, 0) = 0
  ? "NewGroup has been minimized...."
Endif


Function SetWallpaper()

SetWallpaper( )

Action: Sets the current wallpaper.
Syntax: SETWALLPAPER("bitmap name")
Parameters: bitmap name

String that specifies the filespec of the bitmap to set as the default wallpaper.

Remarks: The file specified must be a valid BMP file.
Returns:
0 | Wallpaper set
Error code | Function failed
Example:

If SetWallpaper ("kixtart.bmp") = 0
  ? "Set current wallpaper to KiXtart.bmp..."
Endif


Function Shutdown()

Shutdown( )

Action: Allows you to shut down or reboot a computer.
Syntax: SHUTDOWN ("computer", "message", wait, force, reboot)
Parameters: Computer

The name of the computer you want to shut down or reboot. An empty string("") indicates the local computer.

Message

String that specifies a message to display in the Shutdown dialog box.

Wait (optional)

Optional parameter specifying the time in seconds that the dialog box is displayed. While the dialog box is displayed, system shutdown can be stopped by using the Win32 AbortSystemShutdown function.

If wait is not zero, SHUTDOWN displays a dialog box on the specified computer. The dialog box, which displays the name of the user who called the function and the message specified by message, prompts the user to log off. The system beeps when the dialog box is created.

The dialog box remains on top of other windows and can be moved but not closed. A timer counts down the time remaining before a forced shutdown. If the user logs off, the system shuts down immediately. Otherwise, the computer is shut down when the timer expires.

If wait is zero, the computer shuts down without displaying the dialog box, and the shutdown cannot be stopped by AbortSystemShutdown.

Force

Specifies whether applications with unsaved changes are forcibly closed. If force is not zero, applications are closed. If force is zero, a dialog box is displayed prompting the user to close the applications.

Reboot (optional)

Optional parameter specifying whether the computer is to restart immediately after shutting down. If reboot is 1, the computer restarts. If reboot is 0, the computer does not start.

Remarks: SHUTDOWN does not work reliably on Windows 9x due to an issue in the underlying Windows API. As a workaround, try the following command sequence:

SHELL "%windir%\RUNDLL32.EXE user.exe,ExitWindowsExec"
SHELL "%windir%\RUNDLL32.EXE user.exe,ExitWindows"

Returns:
0 | Shutdown successful
Error code | Function failed
See Also: Logoff( )
Example:

$RC = Shutdown("", "System is being rebooted to enable new settings.", 60, 0, 1)


Function SidToName()

SidToName( )

Action: Translates a Security Identifier (SID) into a name.
Syntax: SIDTONAME (“SID”)
Parameters: SID

String representation of SID to translate.

Remarks: SIDTONAME is not supported on Windows 9x.
Returns:
0 | Name corresponding to SID.
Error code | Function failed
See Also: InGroup( )
Examples:

? SidToName("S-1-1-0") ; displays 'Everyone'

If InGroup( SidToName( "S-1-5-32-544" ) )
  ? "Must mean current user is a member of local Administrators"
Endif


Function Split()

Split( )

Action: Returns a zero-based, one-dimensional array containing a specified number of substrings.
Syntax: SPLIT (“string”, “delimiter”, count)
Parameters:

String

Required. String expression containing substrings and delimiters. If expression is a zero-length string, Split returns an empty array, that is, an array with no elements and no data.

Delimiter

Optional. String character(s) used to identify substring limits. If omitted, the space character (" ") is assumed to be the delimiter. If delimiter is a zero-length string, a single-element array containing the entire expression string is returned.

Count

Optional. Number of substrings to be returned; -1 indicates that all substrings are returned.
Remarks: The Split function doesn't actually create a variable -- all it does is create an array, and the parser copies that back into whatever variable the result is being assigned to. Therefore, if you want Split to populate an array and have that array's contents available outside the current scope, you must make the variable/array global prior to populating it with the split function (Example 2).
Returns: An array containing the substrings found in the input string.
See Also: UBound( )
Examples:

; Example 1:
$Myarray = Split("aaa~~bbb~~ccc","~~")
For Each $Element In $MyArray
  ? $Element ; will display "aaa", "bbb" and "ccc"
Next

; Example 2:
Global $Array2
$Array2 = Split("aaa~~bbb~~ccc")
For Each $Element In $Array2
  ? $Element ; will display "aaa", "bbb" and "ccc"
Next


Function SRnd()

SRND( )

Action: The SRND function sets the starting point for generating a series of pseudorandom integers. To reinitialize the generator, use 1 as the seed argument. Any other value for seed sets the generator to a random starting point. RND retrieves the pseudorandom numbers that are generated. Calling RND before any call to SRND generates the same sequence as calling SRND with seed passed as 1.
Syntax: SRND (seed)
Parameters: Seed

Numeric value to seed the generator with

Returns: Nothing.
See Also: Rnd( )
Example: $rc=SRND(@MSECS)


Function Substr()

Substr( )

Action: Returns part of a string.
Syntax: SUBSTR ("string", start, length)
Parameters: String

The string from which to extract a substring.

Start

Numeric value representing the offset (from the left) in the string where the substring begins.

Length

Optional numeric value representing the length of the substring. If omitted or if there are fewer than Length characters in the text (including the character at start), all characters from the start position to the end of the string are returned.

Returns: The substring indicated by start and length.
See Also: InStr( ) , InStrRev( ), Left( ), Right( )
Example:

; get the last 2 chars of the userid
$x = SUBSTR(@USERID, LEN(@USERID) - 2, 2)


Function Ubound()

UBound( )

Action: Returns the largest available subscript for an array.
Syntax: UBOUND (array)
Parameters: Array

The array you want to know the upper boundary of.

Returns: Largest available subscript for the indicated array.
See Also: Dim , Split( )
Example:

$x = UBOUND($MyArray)


Function Ucase()

Ucase( )

Action: Returns a string in uppercase.
Syntax: UCASE ("string")
Parameters:

String

The string you want to change to uppercase.

Returns: The input string in uppercase.
See Also: Lcase( )
Example:

$x = UCASE(@USERID)


Function UnloadHive()

UnloadHive( )

Action: Unloads the specified key and subkeys from the registry.
Syntax: UNLOADHIVE ("key")
Parameters: Key

The key you want to unload. This key must have been created using LoadHive.

Remarks: On Windows NT, using UNLOADHIVE requires Backup and Restore privileges.
Returns:
0 | Key unloaded
Error code | Function failed
See Also: LoadHive( )
Example:

$ReturnCode = UnLoadHive( "HKEY_USERS\Fiets" )
If $ReturnCode = 0
  ? "Hive unloaded...."
Endif


Function Val()

Val( )

Action: Returns the numeric value of a string.
Syntax: ("string")
Parameters:

String

The string whose numeric value you want to discover. By default, Val expects the string to be in decimal format.

To determine the numeric value of a hexadecimal string, start the string with an ampersand ‘&’.

Returns: The numeric value of the input string.
Example:

$x = VAL(SUBSTR(@IPADDRESS0, 1, 3))
$x = VAL("&A34")


Function VarType()

VarType( )

Action: Returns an integer value indicating the subtype of a variable.
Syntax: VARTYPE ($variable)
Parameters: $Variable

Any type of variable.

Returns:
0 | Empty
1 | Null (no valid data)
2 | Integer
3 | Long integer
4 | Single-precision floating-point number
5 | Double-precision floating-point number
6 | Currency
7 | Date
8 | String
9 | Object Handle
10 | Error
11 | Boolean
12 | Variant (used only with arrays of Variants)
13 | A data-access object
17 | Byte
8192 | Array (can only occur in combination with one of the other values)
See Also: VarTypeName( )
Examples:

$MyVar = "AnyData"
? VarType( $MyVar ) ; will display "8" (String)

$MyArray = "a","b","c"
? VarType( $MyArray ) ; will display "8204" (Array of variants)
? VarType( $MyArray[0] ) ; will display "8" (String)


Function VarTypeName()

VarTypeName( )

Action: Returns a string that provides type information about a variable.
Syntax: VARTYPENAME ($variable)
Parameters: $Variable

Any type of variable.

Returns:
Byte | Byte value
Integer | Integer value
Long | Long integer value
Single | Single-precision floating-point value
Double | Double-precision floating-point value
Currency | Currency value
Decimal | Decimal value
Date | Date or time value
String | Character string value
Boolean | Boolean value; True or False
Empty | Uninitialized
Null | No valid data
Object | Generic object
Unknown | Unknown object type
Nothing | Object variable that doesn't yet refer to an object instance
Error | Error
[ ] | Array (can only occur in combination with one of the other values)
See Also: VarType( )
Examples:

?
      VarTypeName("KiXtart") ; Displays "String"
? VarTypeName(4) ; Displays "Integer"
? VarTypeName(37.50) ; Displays "Double"
? VarTypeName(ArrayVar) ; Displays "Variant[]"


Function WriteLine()

WriteLine( )

Action: Appends a line to the end of the file indicated by File Number. If WriteLine encounters an error, @ERROR is set to the relevant error code.
Syntax: WRITELINE (file number, “linetowrite”)
Parameters: File number

A numeric expression indicating the file number of the file to open. Possible values range from 1 to 10.

LineToWrite

The string you want to write to the file.

Remarks: WriteLine does not automatically append a <Carriage Return>, so if you want to write a <Carriage Return>, you should add it to the string (as in : $LineToWrite + Chr(13) + Chr(10)).
Returns:
-4 | File not open for writing
-3 | File number not open
-2 | Invalid file number specified
-1 | End of file
0 | Line written successfully
See Also: Close( ) , Open( ), ReadLine( )
Example:

IF Open( 3 , "C:\TEMP\LOG.TXT" , 5 ) = 0
  $x = WriteLine( 3 , "KiXtart started at " + @TIME + @CRLF )
ELSE
  BEEP
  ? "failed to open file, error code : [" + @ERROR + "]"
ENDIF


Function WriteProfileString()

WriteProfileString( )

Action: Copies a string to an initialization file.
Syntax: WRITEPROFILESTRING ("file name", "section", "key", "string")
Parameters: File name

String identifying the initialization file.

Section

String containing the name of the section of the initialization file where string is copied. If the section does not exist, it is created. The section name is not case-sensitive, and can contain any combination of uppercase and lowercase letters.

Key

String containing the name of the key to associate with string. If the key does not exist in the specified section, it is created. If this parameter is empty, the entire section, including all entries within the section, is deleted.

String

String to write to the file. If this parameter is empty, the key identified by key is deleted.

Note: On Windows 9x, use of the tab character (\t) is not supported as part of this parameter

Remarks: This function is provided for compatibility with 16-bit Windows-based applications. Win32-based applications store initialization information in the registry.
Returns:
0 | Profile string written
Error code | Function failed
See Also: ReadProfileString( )
Example:

$IniFile=substr('%WINDIR%,1,2)+'\SMS.INI'
if exist($IniFile)
$result=writeprofilestring($IniFile,'Sight','Allow Takeover','Yes')
$result=writeprofilestring($IniFile,'Sight','Allow Reboot','Yes')
$result=writeprofilestring($IniFile,'Sight','Allow File
      Transfer','Yes')
$result=writeprofilestring($IniFile,'Sight','Allow Chat','Yes')
$result=writeprofilestring($IniFile,'Sight','Allow Remote
      Execute','Yes')
endif ; file exists


Function WriteValue()

WriteValue( )

Action: Assigns a value to a registry entry.
Syntax: WRITEVALUE ("subkey", "entry", "expression", "data type")
Parameters: Subkey

Identifies the subkey where you want to write a value entry.

Entry

The name of the entry. To write to the (default) entry of a key, specify an empty string as the entry name ("").

Expression

The data to store as the value of the entry.

REG_MULTI_SZ (multi-string) variables are returned with the pipe symbol ( | ) used as the separator between strings. If a string contains a pipe symbol character, it is represented by two pipe symbol characters ( || ).

Data type

Identifies the data type of the entry. The following data types are supported:
REG_NONE
REG_SZ
REG_EXPAND_SZ
REG_BINARY
REG_DWORD
REG_DWORD_LITTLE_ENDIAN
REG_DWORD_BIG_ENDIAN
REG_LINK
REG_MULTI_SZ
REG_RESOURCE_LIST
REG_FULL_RESOURCE_DESCRIPTOR
Returns:
0 | Value successfully written
Error code | Function failed
See Also: AddKey( ) , DelKey( ), DelTree( ), ReadType( ), ReadValue( )
Example:

$RC=WriteValue("EZReg\Test", "A MultiString variable", "Line 1|Line 2|Line 3 with a || in it|" "REG_MULTI_SZ")
If @ERROR = 0
  ? "Value written to the registry"
Endif


Command Exit

Debug

Action: | Activates or deactivates debug mode during runtime.
Syntax: | DEBUG "ON" | "OFF"
Remarks: | DEBUG ON is ignored if debug mode has been disabled using SetOption( “DisableDebugging”, “On”).
See Also: | SetOption( )


Function ExpandEnvironmentVars()

ExpandEnvironmentVars( )

Action: Expands any environment variables inside a string to the corresponding plain text value.
Syntax: EXPANDENVIRONMENTVARS ("string")
Parameter: String

The string you want to expand.

Returns: The expanded string.
Example: $Value = ReadValue( "HKLM\System\CurrentControlset\Control\Windows", "SystemDirectory")
? ExpandEnvironmentVars( $Value )


Function Substr()

Left( )

Action: Returns a specified number of characters from the left side of a string.
Syntax: LEFT ("string", length)
Parameters: String

String expression from which the leftmost characters are returned.

Length

Numeric expression indicating how many characters to return. If 0, a zero-length string is returned. If greater than or equal to the number of characters in string, the entire string is returned.

Returns: The substring requested.
See Also: InStr( ) , InStrRev( ), Right( ), SubStr( )
Example:

; get the first 2 chars of the user's ID
$x = LEFT(@USERID, 2)


Function Substr()

Right( )

Action: Returns a specified number of characters from the right side of a string.
Syntax: RIGHT ("string", length)
Parameters: String

String expression from which the rightmost characters are returned.

Length

Numeric expression indicating how many characters to return. If 0, a zero-length string is returned. If greater than or equal to the number of characters in string, the entire string is returned.

Returns: The substring requested.
See Also: InStr( ) , InStrRev( ), Left( ), SubStr( )
Example:

; get the last 2 chars of the user's ID
$x = RIGHT(@USERID, 2)


Function SetOption()

SetOption( )

Action: SetOption can be used to configure certain options of the KiXtart script engine.
Syntax: SETOPTION ("option","value")
Parameters:

The options and possible values are described in the following table:

Option | Value | Description
ASCII ON
OFF 		Default console output is in Unicode. Setting the ASCII option to ON changes the output to ASCII, so you can output extended characters, such as line characters.
CaseSensitivity ON
OFF 		By default, all string comparisons are case-insensitive. Setting the CaseSensitivity option to ON instructs KiXtart to make all subsequent string comparisons case-sensitive.
DisableDebugging | ON | Disables debugging (effectively disables the DEBUG ON command). Once disabled, debugging can not be re-enabled.
HideCursor ON
OFF 		Hides or shows the console cursor.
Returns: SetOption returns the previous state of the option.
Example:

$previousstate = SetOption( "ASCII", "ON" )

? "═══════════" ; output ASCII line characters

$rc=SetOption( "ASCII", $previousstate )


Function SetSystemState()

SetSystemState( )

Action: Changes the (power) state of the computer.
Syntax: SETSYSTEMSTATE (mode, force)
Parameters: Mode

Optional parameter specifying one of the following modes:

Value | Meaning
0 | Lock system (supported on Windows NT/2000/XP only).
1 | Standby.
2 | Hibernate.
3 | Power Off.

Force

Specifies whether applications with unsaved changes are forcibly closed. If force is not zero, applications are closed. If force is zero, a dialog box is displayed prompting the user to close the applications.
Returns:
0 | Function succeeded
Error code | Function failed
Example:

; Force system to standby mode
$RC = SetSystemState(1,1)


Function Rtrim()

Trim( )

Action: Strips leading and trailing spaces from an input string and returns the result.
Syntax: TRIM ("string")
Parameters: String

The string from which to strip the spaces from.

Returns: The input string without leading or trailing spaces.
See Also: LTrim( ), RTrim( )
Example:

$x = TRIM(SUBSTR(@IPADDRESS0, 1, 3))