Version 3.12 - Batch file interpreter for Windows


Table of contents

1. Program purpose

2. System requirements
3. Using BTEWin
4. Script commands
5. Variables and variable functions
6. Questions and answers
7. License and disclaimer
8. Thanks
9. Contact information


1. Program purpose


The main purpose of BTEWin is to
provide an alternative to the use of classic DOS batch files in Windows(tm), providing a set of functions specific for the new environment.  This program doesn't try to be the definitive scripting solution for the Windows environment, instead it tries to be as easy to use as possible, but without renouncing to some advanced features.

To serve as an introduction, for example with BTEWin you can do the following things:

-Run applications or open documents with great control over these tasks.
-Manipulate windows; you can move them, close them, hide them, ...
-Control applications through keystrokes simulation and sending window messages.
-Save, restore and change display resolutions.
-Evaluate and compare expressions.
-Decide what to do using conditional and flow control commands.
-Create your own little utilities, because BTEWin lets you create standalone executable files from its own batch files.
...

The main objective for this project has always been simplicity; there are other programs of this kind that are more powerful and flexible
; without going any further, Windows Scripting Host, that supports ActiveX scripting engines like VBScript and JavaScript; or applications like KiXtart, that offer wider possibilities, but always at the expense of higher complexity. Anyway, it is always possible to combine the capabilities of BTEWin with any of the previously mentioned alternatives and, of course, with conventional batch files.


2. System requirements

Windows 9x, Me, NT, 2000, XP or later.


3. Using BTEWin


The kernel of BTEWin consists of only one executable file called BTEExec.exe that can be used in several ways. It acts as a
n interpreter/executor for the .bte script files; BTEWin registers the .bte extension for its own use, so it will be very easy to edit or execute them. You don't have to take care of anything special when using it in the standard Windows manner; you just have to write a script using the available commands and save it with the .bte extension. BTEWin script files are simple text files that contain the commands to be executed. The installer registers the .bte filetype and adds an entry to the explorer's "New" sub-menu, so it is very easy to create a new .bte file; just right-click, select "New-BTEWin batch file", choose "Edit", and write your commands, it is very much the same as creating standard batch files.

With BTEWin you will also be able to create "Standalone" executable files,  just right-click over the desired .bte file and select the option “Make executable”; a dialog will pop-up
with some options to choose from; when you have finished, choose ok, and enter a filename. It's that simple. (Please note that not all versions of the product have this feature enabled.)

There's an additional method to feed script commands to BTEExec.exe; it is activated through the use of the --cmdline or --cmd command line switches, and it allows execution of script commands directly from the command line. The following example will describe it crearly:

BTEExec.exe --cmdline messagebox first command^delay 10^myfile.exe
BTEExec.exe --cmd separator &alertbox Hello World&delay 40


As you may have noticed, in the first example the commands are separated by the ^ symbol, which is the command separator by default. The second example shows the use of the Separator command, that can be used exclusively from the command line, and it is mainly used to avoid conflicts with certain command shells.
Please note that the following commands will not work if we use this method: Goto, Gosub, Patchfile, Patchmem, Binarywrite, Createlink, and generally all commands that make use of sub-scripts.


*NEW*
: Version 3.00 of the product introduces a last method for running script commands, it is the internal command prompt mode. This mode is accessed through the use of the --prompt commands(optional) command line switch. This is specially useful for testing purposes, and it has the same limitations that the command line mode has. To use it, just type the desired commands and type enter to execute them. There's also a history that will remember the most recently used command lines, twenty to be precise.

 It has to be noted that there are a few additional commands specifically designed to be used with the internal command prompt:

Dir
/A:RSHD(optional) filespec(optional) : This is similar to the typical DOS 'dir', but it is simpler and doesn't accept any additional command line switches.
Help command(optional) : This opens the BTEWin manual and selects a specific help topic if the optional command parameter is supplied.
Alias ON/OFF : Enables disables aliases. Aliases are enabled by default. Read below for details.

Aliases are command redefinitions, expressions that will be replaced by user defined text before the actual command lines get executed. The BTEWin command prompt supports aliases, they are stored by default in the file 'Alias.ini' that can be located in the installation folder. There's a special variable that is used with aliases; it is $args , and it will be replaced by the actual command arguments. Just look at the included 'test' example for more information. This ends the explanations about the internal command prompt.

Command line switches supported by BTEExec.exe

Function

Example

--bte Execute a BTEWin batch file bteexec.exe --bte btefile.bte
--btenoicon Same as --bte, but without tray icon bteexec --btenoicon btefile.bte
--cmd / --cmdline Execute from the command line bteexec.exe --cmd messagebox Hello World
--cmdlinenoicon Same as --cmd, but without tray icon bteexec.exe --cmdnoicon messagebox Hello World
--makeexe Build standalone executable bteexec.exe --makeexe btefile.bte
--makewshexe Build standalone executable (WSH) bteexec.exe --makewshexe script.js
--prompt Run from the internal command prompt bteexec.exe --prompt echo Optional command

Using BTEWin, executable files can be run in two different ways. The standard way is accomplished simply by creating a line with the command line that you want to use; this way makes use of the CreateProcess Windows function, and you can even execute files that don’t have executable extension but are still true executables. The second way uses ShellExecuteEx, and with this method, you can start just every single file that has an associated program in your system. In the following example; notepad.exe, calc.exe and calc.old will use the first method, and readme.txt will be opened using the program associated to the .txt extension. As you should have figured by now, the first method is preferable for true executables, and the @@ one is required in case you want to open other kind of files. The second method is particularly useful used in conjunction with .lnk files.

Example 1 :
 
notepad.exe
calc.exe
calc.old
@@readme.txt
waitforprogram@@
 

Example 2 :

notepad.exe %_CMDLINE
"c:\program files\myexe.exe"

In this case, notepad.exe is executed, and all the command line parameters used when calling BTEWin will be passed to the program. Look at the list of internal variable names for more information about variables and variable functions. Conventional environment variables can also be used. When you specify a path with spaces between words, you must enclose it in quotas, as you can see in the second line.

Example 3 :

if (notepad.exe) messagebox Notepad has been executed  ELSE  messagebox Error executing Notepad
delay 20
calc.exe
Waitforprogram
Messagebox Calc.exe has finished

In this example, there will be a pause of 2 seconds between the execution of notepad.exe and calc.exe. The Waitforprogram command will pause execution until calc.exe has finished. Note the use of the If command for executing notepad. Notepad.exe is executed, and if it has been successfully executed, it returns true; every command returns a value that can be used with If, and this value will be true when the command has been correctly executed and false when something has failed. In the example, if notepad.exe has been executed correctly the first message box pops up. When for any reason the If command returns false, the ELSE command will be executed, if there is one; it is not mandatory. A complete list of available commands and its usage is included in the next section. To temporarily disable commands, you don't need to remove the line, you can put a ';' at the beginning of the line you wish to disable. This can also be used to add comments.

Now comes the following question: What happens if our batch file locks up, enters an infinite loop, we want to stop it, know what's going on, ...?. This is not a problem, as we'll see now.

BTEWin creates a taskbar icon for each script file running. If we leave the mouse over the icon, we will know the owner of the icon, and we will be able to do some actions right clicking over it:

             Here we can see the icons created by BTEWin. The left icon reflects the pause status of the batch file.
        This is the menu that shows up when we right click over the icon or the messages window with the mouse. Let's see all the options explained in detail.

Show messages window
: shows/hides the BTEWin messages window.
Command logging: starts/stops logging commands to the messages window.
Copy selection: copies the selected lines to the clipboard.
Clear window:
clears the contents of the messages window.
Auto scroll:
turns auto scroll on/off for the messages window.
Step by step
: turns on/off step by step execution.
Pause: temporarily stops the script's execution.
About: shows an informative dialog box about the application.
Quit: exits the script immediately.

The output of commands like echo and all error messages are directed to the messages window; it also serves for debugging purposes, since command logging can be shown through it. The messages window will be shown automatically when an echo text command is executed, and it can be manually shown/hidden double clicking on the tray icon or selecting the appropriate option from the menu. Here follows a sample screenshot with command logging activated.

   


To end this section, the Make executable Options dialog contents will be explained. Please note that a license is required to use this feature.

   

Encryption:
The purpose of this feature is to encrypt the data in the executable that's going to be created, so it will be unreadable if a visual examination is performed.

Icon:
Click over the icon to choose a different one. The icon that appears in the screenshot is the default one.

Run IconPro: BTEWin can't extract or modify icons from executable files by itself, so I've integrated a slightly modified version of the widely known IconPro tool to acomplish this task. To use it just press the "Run IconPro" button, and when you're done extracting and/or editing the desired icon select the "File->Create ICO for BTEWin" menu option and close IconPro; after that the icon will be automatically selected in BTEWin without the need of any further steps. It is advisable to remove all icon formats but the desired one since only one format will be visible; I've added an "Edit->Remove all Formats but this One" menu entry to make this task easier. Finally note that IconPro is not my work and its sources are publically available.

User control:
The only option available is 'Disable menus and tray icon'. Standalone executables operate by default exactly as the original batch files that they were created from; this means that the tray icon and the messages window menus will be available, and debugging is still possible as a result, so if we want to make the executable a 'black box' we can do so by choosing this option and additionally using encryption for the maximum security.

Save/Restore version data: Saves/Restores the 'File description', 'Organization', 'Copyright', 'Product name' and 'Version' fields so they won't need to be typed again when building new executables.

Packer support:
Read the 7zip/Packer command description for an explanation. Note that if a file is specified in the 'Packed data' field, the packer file will be embedded by default, even if such option is unchecked.

Exclude packed data from checksum calculation: This option will reduce the time required to create and launch executables that contain a large amount of packed data. As a price, with this option selected the integrity check will not be as secure.

Windows Scripting Host: This group of options makes possible to embed a VBScript, JavaScript or other script file into the resulting executable. The options that appear grayed out are only available when the 'Make Executable' option is used from the context menu of a *.vbs or *.js file; in this case the 'Script file' field is filled in automatically, and a BTEWin batch file that executes the script is generated internally according to the selected options.

Note that standalone executables are totally static (don't use any kind of runtime); they only require the standard windows libraries to be available. This means that a standalone executable can be distributed without requiring any additional files to be included with it. Support is guaranteed for Windows versions over Windows 95 OSR2.


4. Script commands


Commands are not case sensitive. Use only one command per line. Note that several commands, like Patch, Mount, ... , will show extended information through the messages window.

Flow control commands

Quit
: Exits the script at that point.
Errorlevel number
: Returns true if %ERRORLEVEL%=number. None of the internal commands use this value, it only has significance when calling external processes. This is mainly a conceptual decision, but it can change in the future. It has to be noted that to be able to use the exit value of a program, it is required that it has finished, so normally to use
Errorlevel we have to wait for the process to end using Waitforprogram; this has to be this way because Windows is a multitasking environment.
 
Example
:
 

myprogram.exe
if(errorlevel 2) messagebox error executing myprogram.exe
 

Laststatus : Returns the same value as the last executed command.
Exit status : Exits the script with the specified status code. This value can be useful if BTEWin is run from DOS batch files, or in any situation where the environment variable ERRORLEVEL is significative. By default, BTEWin always exits with status=0, unless the script is prematurely ended from the context menu; in this situation status=1.
Pause
: Temporarily stops execution. To resume execution is mandatory to use the resume option from the taskbar's icon context menu.
Goto label : Branch to a specified line inside the script file.
Gosub label
: This command is used in combination with return. It is almost the same as
Goto, but if Return is used, the execution continues after the line that performed the jump. Gosub calls can be nested up to 1024 levels of depth.

Example
:

gosub subroutine
quit
:subroutine
return

Return
: Can be executed only if a
Gosub command has been run before. Return branches to the line immediately following the Gosub caller.
If (Command1) Command2 ELSE Command 3
: Execute another command depending on what Command1 returns. When Command1 returns true, Command2 is executed, and if it returns false, Command3 is executed instead.
The behavior of this command can be changed using '!', If !(Command1) Command2, will execute Command2 if Command1 returns false.
Please note that since this command can be anidated, you should enclose Command2 in brackets because otherwise the ELSE command may not be assigned correctly.

Examples :

if(file1.exe) if(file2.exe) ELSE file3.exe . In this line, file3.exe will be executed if file1.exe fails*.
if(file1.exe) {if(file2.exe) ELSE file3.exe} ELSE file4.exe . Now, file4.exe will be executed if file1.exe fails, and file3.exe will only be executed if file1.exe succeeds and then file2.exe fails*.

*Fails means that the file couldn't be successfully executed; for example it could simply be that the file doesn't exist.

Iff (Command) : This command is similar to If but it works over multiple lines instead of a single one. An example is the best way to understand it :

iff(file 1.exe)
 echo The condition is true
 echo so this part will be executed
else
 echo The condition is false
 echo so this part will be executed
endiff


Note that I've used spaces in front of the echo lines, but this is only for clarity and is not required at all. The most important thing to have in mind is that iff must always finish with an endiff command.
Else : Else is only used as part of Iff, so the lines that come after it will be executed if the condition is false.
Endiff : Read the explanation for the Iff command. Endiff can only be used in conjunction with Iff.

While (Command1) Command2 : Execute
s Command2 as long as Command1 returns true; or false, if "While !(Command1) Command2" is used. Note the '!', that makes the difference. You shouldn't use Goto or Gosub commands as Command1 or Command2; if you need to run a group of commands you should build a loop using If and Goto/Gosub. Example : While !(Appactivate "Title") delay 5 .
For  /A:RSHD(optional)  filespec  DO command : For will execute the given command for every file that matches the pattern given by the filespec parameter. It is possible to include files with certain attributes by using the optional /A command line switch. By default directories, system or hidden files will not be included.

Several special variables can be included as part of command. Please note that these variables are case sensitive, and can be used only as part of command, and, if the command is a Gosub label , these variables can also be used in the subroutine.
 

'For' variables

Content

$w Filename with full path
$f Filename
$n Filename without extension
$x File extension
$p File path
$d Same as $p but directories are unchanged


Example 1 :

for %_WINDOWSDIR\*.txt DO echo %@FILEATTRIBS[$w] %@FILEDATE[$w] %@FILETIME[$w] $w

Example 2 :

for %_WINDOWSDIR\*.txt DO gosub dothejob
pause
exit
:dothejob
echo %@FILEATTRIBS[$w] %@FILEDATE[$w] %@FILETIME[$w] $w
return

Example 3 :

for %_WINDOWSDIR\*.txt DO gosub dothejob
:dothejob
echo %@FILEATTRIBS[$w] %@FILEDATE[$w] %@FILETIME[$w] $w
return

Note that in the last example, the subroutine will be called for each file that matches the pattern, but since no exit command is provided after the for one, the subroutine will be executed a last time, but now it has not been called from the for command, so the variables will not be replaced.

Skip number of lines : This command is similar to goto, but instead of jumping to a concrete label the jump is performed over a specified number of lines. This command should be avoided unless necessary, because it can make edition very tricky.
Logoff : This command logs the current user off.
Shutdown : This command will shutdown the computer.
Reboot : Shuts down
Windows and restarts the computer.
Poweroff : Shuts down Windows and turns off the computer power if possible.
Powersuspend : Sets the system power state to suspended mode if possible.
Powerhibernate : Sets the system power state to hibernated mode if possible.
Forcelogoff, Forceshutdown, Forcereboot, Forcepoweroff, Forcepowersuspend, Forcepowerhibernate : These commands do the same as the previous ones, but they don't wait for applications to terminate, which could cause loss of data.
Lockworkstation : Locks the workstation's display, protecting it from unauthorized use (only for NT based operating systems).
Autoscroll on/off : Activates/deactivates auto scrolling for the messages window. This can also be done from the context menu.
Step on/off
: Activates/deactivates step by step execution. The same thing can be done from the context menu.
Rem text : This command does nothing; it can be used to put commentaries or disable other commands, but it is better to use ";" to do so.
Disabletraymenu : Disables the BTEWin tray icon's context menu. This is generally not recommended.
Enabletraymenu : Enables the BTEWin tray icon's context menu if it was previously disabled.
Separator new command separator : Changes the default command separator. The default separator is ^ , but it may conflict with certain command shells, so this command must be used immediately after the --cmdline / --cmd switch in case of problems.
Example : Bteexec.exe --cmdline separator &messagebox The default separator is now %@CHAR[38]&messagebox Press OK to exit
Mutex
: This command creates a unique global mutex object, that will be valid until the script ends. This means that if the same batch file (or standalone executable) is executed again, the mutex object creation will fail, so it will be possible to exit the script at that point if we don't want to allow two instances of the same script running at the same time. Example : if !(mutex)quit .
Messageslimit number : This commands makes possible to set the maximum number of lines that will be shown simultaneously in the messages window. The default limit is 100000, and if this command is used without parameters the default value will be set. To remove the limit use -1.
Errorcontrol on/off : This command makes possible to specify if Windows will take care of critical errors or not (
critical-error-handler message boxes will be displayed or not). The 'on' value is the default and means that Windows will handle such errors; if 'off' is specified, errors should be handled by the script if necessary. Example : errorcontrol off .

Program execution commands / modifiers

Allocconsole
: Creates a console. Character mode apps will share the new console unless Newconsole is specified in Process.
Freeconsole
: Destroys the console created using Allocconsole.
Hide
console
: Hides the console that must have been previously created using Allocconsole. Note that it will remain hidden until you use the Showconsole command.
Show
console
: Shows the console that must have been previously created using Allocconsole; note that the console is shown by default.
Activateconsole : Brings up the focus to the console previously created using Allocconsole.
Run command line : Runs the specified command line. This should be useful only in the situation where an internal command name matches an external command (filename) you are trying to execute.
Process (Max Min Hidden) (Normal Idle Realtime High)
(Newconsole) (Suspended) : This command sets the window and priority options for the next application executed. Once the application has been executed, these options are restored to their default values. This command doesn't work with @@ lines, that are launched using ShellExecuteEx. The first three options, are related to the program's main window presentation, and we can only choose one of them, or none if we want to use normal presentation. The same applies to the priority options. We can only choose one option for the priority value, or leave it blank for normal priority. It has to be taken into consideration that some applications ignore these values, and set their own ones, so this can become a placebo command in that kind of situation. Newconsole only has sense in case that Allocconsole had been used before; if it is used a new console will be created for the new app. Finally, the option Suspended creates the process in suspended mode, without proceeding to its execution. It is necessary to use the Resume command to let the process continue. Usually , there's no reason to use Suspended to create a process.

Example 1
: Process Max , Example 2 : Process Max High

Wait Process Id : Suspends execution until the desired process has completed its initialization. The Process Id parameter is optional; if it is not specified the command will work with the last executed process. This command can be useful when you want to send keystrokes, or in any situation where you want to be sure that the application is ready to receive input. This command does not work with @@.
Wait@@
: Suspends execution until the desired process has completed its initialization. This command is specific for executables that have been launched using ShellExecuteEx (@@).
Suspend : Suspends the last executed process. This command does not work with @@.
Resume
: Resumes the last executed process if it has been suspended before. This command does not work with @@.
Kill Process Id
: Terminates the given process; look at the variable functions section to learn how to obtain a Process Id.
Workingdir "directory name"
: Sets the working directory for the next application executed. This does not apply to commands preceded by @@.
Waitforprogram time in minutes, process id : Waits for the last executed program, and does not resume execution until it has finished. Both parameters are optional; if no parameters are specified the time value will be set to infinite.
The Process Id parameter is also optional; if it is not specified the command will work with the last executed process. Please note that to use the process identifier parameter you must first specify the time; in this situation use -1 as the time value to wait indefinitely. This command does not apply for programs started using ShellExecuteEx, i.e. @@program.exe.
Waitforprogram
@@ time in minutes : Waits for the last executed program, and does not resume execution until it has finished. The time parameter is optional; if no parameters are specified the time value will be set to infinite. This command is specific for programs started using ShellExecuteEx, i.e. @@program.exe.
CloseProcHandle : Closes the handles that are used with the waitforprogram, waitforprogram@@ and other commands/variables. This should only be useful in the case that a paranoid programmer is checking for open handles to his own process and refusing to run if they are found. If this is the case use it right after the executable has been launched.
SetPriority Priority Class (Normal Idle Realtime High), Process Id (optional) : Sets the priority class for the last executed process or for the desired one if the optional process id parameter is specified.

Clipboard commands

Emptyclipboard : As it says, it will empty the clipboard.
Copytoclipboard text : Will copy the given text to the clipboard. This may be useful to pass parameters to some programs that do not accept command line input. You can use _CLIPBOARD to read the clipboard. Example
: set MYVAR=%_CLIPBOARD .

Mouse commands

Movemouse X-position, Y-position : Moves the mouse to the specified coordinates. Note that these coordinates aren't the same as the screen ones; the lower right corner of the screen corresponds to 65535,65535 no matter what screen resolution has been set. It is easy to calculate mouse coordinates based on screen ones. For example, let’s suppose that we are using 1024x768 as the screen resolution. Now we want to move the mouse to 20,30 on the screen, we just have to know the relation between mouse and screen coordinates, and that simply involves doing 65535/1024 and 65535/768; now we have to multiply the X and Y screen coordinates using the proportions we have calculated  20*(65535/1024),30*(65535/768), and all the work is done. The included Mousepos utility will ease things showing the actual screen and mouse coordinates for the cursor.
Mouseclick X-position, Y-position
: Issues a mouse click at the given mouse coordinates. Read the Movemouse explanation for more information. The X-position and Y-position parameters are optional; if they are not included, the operation will be performed at the actual cursor's position.
Mousedblclick X-position, Y-position : Issues a mouse double-click at the given mouse coordinates. Read the Movemouse explanation for more info. The X-position and Y-position parameters are optional; if they are not included, the operation will be performed at the actual cursor's position.
Mouserightclick X-position, Y-position : Issues a mouse right-click at the given mouse coordinates. Read the Movemouse explanation for more info. The X-position and Y-position parameters are optional; if they are not included, the operation will be performed at the actual cursor's position.

Variable related commands

Expansion on/off/numeric value : This command controls the expansion of variables (both internal and environment ones) and variable functions. By default expansion is enabled, and can be disabled (and enabled later) by using this command. Expansion on fully enables expansion, Expansion off fully disables expansion. The numeric value is a 2 digit number; if the first digit is 1, then expansion of variables gets disabled. If the second digit is 1 then expansion of variable functions is disabled. A value of 2 in any of the digits disables expansion only in anidated expressions. Example: Expansion 11 disables expansion completely, so it is the same as using off. If this command is used without any parameters expansion will be fully enabled.
Inputbox text
: This command shows a dialog box asking for user input. The text that can be specified as the argument is the pre-defined value for the user input. The entered text is stored in the internal variable USERTEXT. The title for the dialog can be changed using Inputboxtitle new title before calling Inputbox.
Set variable=content : Loads ‘content’ into the given internal variable.
Setenvvar variable=content : Loads ‘content’ into the given environment variable.
Setenv variable=content : The same as Setenvvar.
Env variable=content : The same as Setenvvar.
Compare logical expression
: Evaluates the given expression and returns true or false. Supported operators are >, <, >=, <=, = . Strings can be compared, but they must be delimited with closing quotas. The only operator available for comparing strings is = .
Example 1 : Compare 12>20 will return false, since 20>12. This
command is very useful for use with variables and If; let’s see another example using variables
Example 2 : If(Compare %@DISKFREE[C:]>20000000) Messagebox You have more than 20 megabytes. free in drive C.
Example 3 : If(Compare %_MEMAVAILPERCENT<80) Freemem 20000000 ELSE Messagebox You don’t need to free memory
Example 4 : If(Compare "%%MYVARIABLE%%"="HELLO") Messagebox The variable MYVARIABLE contains HELLO
Quoting on/off : This command makes possible to use certain special characters in if/iff constructions and variable functions. If it is set to on, then the text that is enclosed in quotas will not be scanned for delimiting characters: '(' , ')' in if/iff and '[' , ']' in variable functions. This can be easily seen with some examples:
Example 1 (doesn't work):
echo %@CRC32[c:\].txt]
Example 2 (works fine):
quoting on
echo %@CRC32["c:\].txt"]


Video related
commands

Setvidmode X-resolution, Y-resolution, bits per pixel, refresh : This
command changes the screen resolution to the specified values. The refresh parameter is optional; if it is not specified, the default refresh rate for the given video mode will be used. If the X-res, Y-res or color depth values are incorrectly set, it won't do anything, but if the refresh frequency is too high or low, the monitor can be damaged. Please be sure that the values used will work before doing anything else, and in case of doubt don't use the refresh value. Example : Setvidmode 1024,768,16,70 . This command will set the screen at 1024x768 with 16 bits color depth and a refresh frequency of 70Hz.
Pushvidmode : Saves the actual video mode that can be recalled later using Popvidmode.
Popvidmode :
Restores the video mode saved using Pushvidmode.
Scrnsave
: Starts the default
Windows screen saver, if there is a default one. Tip: you can also execute screen savers manually; screen savers have the .scr extension, and are only conventional executables that start working when they are launched with the /s parameter in the command line.
Screensaver ON/OFF : Enables/Disables the screensaver.

Window control commands

Minimizewindow "Window title" : Minimizes the specified window. Supports wildcards, so this command can operate on a range of windows instead of only one. Wildcards are supported by all window control
commands, unless the opposite is specified. Classes can also be used instead of  titles; to do so just put CLASS: before the actual class name, for example CLASS:12345 ; this also applies to all commands.
Maximizewindow "Window title" : Maximizes the specified window.
Normalizewindow "Window title" : Normalizes (restores) the specified window. Supports wildcards.
Movewindow "Window title" , X position, Y position , X size , Y size : Moves the specified window to the specified screen position and optionally resizes it. Y position and Y size can be omitted.
Centerwindow "Window title" : Centers the specified window on the screen.
Hidewindow "Window title"
: Hides the specified window. Note that it will remain hidden until you use the Showwindow command.
Showwindow "Window title"
: Shows the specified window.
Close "Window title"
: Closes the specified application based on its window title. It is better to use the Closewin command instead. Use this command if Closewin doesn't work.
Closewin "Window title" : Closes the specified application using its system menu close command. This option is prefered over Close since some applications don't quit properly when they receive the WM_QUIT message.
Close
all "Window title" : The same as Closewin.
Stayontop "Window title"
: Sets the stay on top status for that window.
Stayontopoff "Window title" : Removes the stay on top status.
Appactivate "Window title" : Brings up the focus to the specified window. This is important when using the Keystack command, to ensure that the keystrokes will go to the right place.
Targetwindow "Window title" : This command can be used
as an alternative to Appactivate and is also used in combination with several other commands. If we specify the target window using this command, that window will be activated before each keystroke will be sent to it. Using Targetwindow with no parameters disables it. This command returns true if the specified window exists.
Parentwindow "Window title"
: This command makes possible to work with child windows. Commands like targetwindow, movewindow, ..., will use the window specified by this command as its parent when operating. Using parentwindow without parameters disables it. It is important to note that the effect of this command will be valid only for the next command that operates with windows. As a final note, it should be noted that this command can be used multiple times to search through the window hierarchy.
Waittimer time in seconds : When used, this command sets the wait time limit for the Waiforwindow and Waitfornewwindow commands. Both will return false when the time limit is reached.
Waitforwindow "Window title" : Waits for the specified window to close before continuing.
Waitfornewwindow "Window title" : Waits for a window with the given name to be created before returning.
Windowexists “Window title” : Returns true if the specified window exists.
Transparency percentage,"Window title" : Sets the level of transparency for the given window. The percentage value must be in the range 0-100. 0=no transparency (100% opacity), 100=full transparency (0% opacity). Example: transparency 50,CLASS:Shell_TrayWnd .

Keyboard commands

Keystack
keystrokes : Simulates keyboard input. Control keys and special codes must be enclosed in brackets, and are not case sensitive.
 

Modifiers / special combinations

Key equivalents / functions

% ALT
^ CTRL
+ SHIFT
( ) Keys can be enclosed in parentheses, so the %, ^ and + modifiers can act over several keys at a time
{sleep number} Pauses for the given number of seconds
{string number} Repeats string as many times as number states; string can't be any of the reserved words


Special keys must be enclosed
in brackets; the following table describes them.
 

Keystack parameters

Key equivalents

{%} , {^} , {+} % , ^ , +
{SPACE} SPACE
{ENTER} or ~ or {RETURN} ENTER
{BACKSPACE} or {BS} or {BKSP} BACKSPACE
{DELETE} or {DEL} DELETE
{UP} Cursor up
{DOWN} Cursor down
{LEFT} Cursor left
{RIGHT} Cursor right
{HOME} HOME
{END} END
{PAGEUP} or {PGUP} or {PRIOR} PGUP
{PAGEDOWN} or {PGDN} or {NEXT} PGDN
{ESCAPE} or {ESC} ESCAPE
{INSERT} or {INS} INS
{NUMLOCK} NUM LOCK
{CAPSLOCK} or {CAPS} CAPS LOCK
{SCROLLLOCK} or {SCRLK} SCROLL LOCK
{TAB} TAB
{PRINTSCREEN} or {PRTSC} PRINT SCREEN
{LWIN} Left Windows key
{RWIN} Right Windows key
{APPS} Applications key
{ATTN} ATTN
{CRSEL} CRSEL
{EXSEL} EXSEL
{EREOFF} Erase EOF
{PLAY} PLAY
{ZOOM} ZOOM
{PA1} PA1
{SELECT} SELECT
{EXECUTE} EXECUTE
{SNAPSHOT} SNAPSHOT / SYSREQ
{BELL} BELL
{CLEAR} or {FORMFEED} or {FF} CLEAR / FORMFEED
{LINEFEED} or {LF} LINE FEED
{NEWLINE} or {NL} NEW LINE
{SEPARATOR} SEPARATOR
{F1} - {F24} Function keys F1 - F24
{BREAK} Ctrl+Break
{PAUSE} PAUSE
{NUMPAD0} - {NUMPAD 9} Numeric keypad 0 - 9 keys
{NUMPADMULTIPLY} or {NUMPAD*} Numeric keypad multiply
{NUMPADADD} or {NUMPAD+} Numeric keypad add
{NUMPADSUBSTRACT} or {NUMPAD-} Numeric keypad subtract
{NUMPADDIVIDE} or {NUMPAD/} Numeric keypad divide
{NUMPADDECIMAL} or {NUMPAD.} Numeric keypad decimal
{SHIFTDOWN} , {SHIFTUP} Holds down / releases the Shift key
{ALTDOWN} , {ALTUP} Holds down / releases the Alt key
{CONTROLDOWN} , {CONTROLUP} Holds down / releases the Control key
{LWINDOWN} , {LWINUP} Holds down / releases the Left Windows key
{RWINDOWN} , {RWINUP} Holds down / releases the Right Windows key
{APPSDOWN} , {APPSUP} Holds down / releases de Apps key


Examples
:

Keystack 3{+}2{ENTER} ;types the expression and sends ENTER.
Keystack 3{+}2{
sleep 3}{+}4 ;types 3+2, waits three seconds, and types 4.
Keystack {HELLO 3}; types HELLO 3 times.
%A ;modifies the A key with ALT, the % symbolizes ALT.
^A ;modifies the A key with CTRL, which is symbolized by ^.

Capslock on/off : With on as the argument, activates Caps Lock if it is not already active.
Scrolllock on/off : The same as Capslock but with the Scroll Lock key.
Numlock on/off : Turns Number Lock on/off. This doesn't always work.
Blockinput on/off : Locks/Unlocks keyboard and mouse input. Once the input is locked it can be unlocked by a subsequent call to this command, by pressing Ctrl-Alt-Del, or just by exiting the script.

IsKeyDown modifiers+key
: Checks if the given key + optional modifiers is pressed. This command only supports a subset of special keys from what the Keystack command offers. The following table describes the possibilities :
 

IsKeyDown modifiers

Key equivalents

% ALT
^ CTRL
+ SHIFT
& Windows keys (LWIN or RWIN)
IsKeyDown parameters

Key equivalents

{SPACE} SPACE
{ENTER} ENTER
{ESC} ESCAPE
{UP} Cursor up
{DOWN} Cursor down
{LEFT} Cursor left
{RIGHT} Cursor right
{F1} - {F12} Function keys F1 - F12

Examples :

if (iskeydown %+x) echo
Shift+Alt+x pressed
if (iskeydown y) echo y is pressed
if (iskeydown {F4}) echo F4
pressed
if (iskeydown &{F5}) echo
WIN+F5 pressed


Please note that this command reads the keyboard in a non destructive manner, so this may cause undesired input in another applications; because of this it is recommended to set pretty uncommon key combinations to avoid problems in such situations.
 

Memory related commands

Freemem amount of memory in bytes : Allocates and then frees the specified amount of memory. The amount of memory is specified in bytes, and the conversion factor is 1 MB=1000000 bytes. If the value is set intelligently, having in mind the physical memory installed and the applications running, this may help to defragment memory and enable some applications that require large contiguous blocks of memory to work; specially if we have been working with the computer for a while this may make rebooting innecesary. In the real world this command, and many other programs that claim to be able to free memory are of little use, some kind of placebo software. See the internal variables section for more information.

Message output commands

Echo ON/OFF Text : Echo writes the specified text on the BTEWin messages window. This command can also be used to activate / deactivate command logging. Echo ON turns command logging on, and Echo OFF deactivates it. The messages window is not automatically shown using Echo ON / Echo OFF, but it is when using Echo Text.
Cls
: Clears the messages window.
Beep
: Emits a short sound using the computer speaker.
Messagebox text : Will popup a messagebox with the text given as the argument.
Messageboxyesno text : If yes is pressed this
command returns true; false will be returned if you press no. This can be used with If to make decisions.
Messageboxtimer time in seconds, yes/no : This command sets a timeout value and an optional response for the next messagebox or messageboxyesno command to be executed. Example: messageboxtimer 15,yes .
Setcaption text : Changes the title of the windows created with Messagebox type commands.
Set
icon information / stop / warning : Changes the icon style of the next Messagebox command. The change is not persistent.
Conout text : Outputs the given text to the console. If there isn't an associated console it opens one automatically.
Contxtclr foreground color, background color : This command sets the color combination for console text output. Both parameters are optional; if none of them are specified defaults are restored (white text over black background). Foreground and background color parameters can be a combination of the following values (not case sensitive) :
r=red , g=green , b=blue , w=white , c=cyan , y=yellow , i=intensity. Note that w, c and y can also be represented by combinations of r g b.
Example: contxtclr gi .
Consize colums, rows : Sets the screen buffer size for the console. If the command is called without parameters, then it defaults to 80x25.
Alertbox text : Creates a non-interactive dialog box showing the specified text. If this command is called without an argument the dialog box that has been previously created using this command will be closed. This command does not interrupt the script's flow so it may be better to use it in some situations instead of Messagebox ... . The title for the dialog can be changed using Alertboxtitle new title before calling Alertbox.
Alertboxfont font name, size(optional), weight(optional), italic(optional) : Changes the text font and size for the window created with the Alertbox command. For more information read the description for the Setfont command.
Setfont font name, size(optional), weight(optional), italic(optional) : Changes the messages window text font and size. Example: setfont Courier New, 12 . Setfont also restores the original tab sizes (see below). The default font is Courier New, the default size is 8 and the default weight is 200. Some of the weight values supported by the Windows API are the following :

Weight

Description

200 Extra Light
300 Light
400 Normal
500 Medium
600 Semi Bold
700 Bold
800 Extra Bold
900 Heavy

The italic value can be 0 for disabled or 1 for enabled.

Settabsize number tab size, time tab size, status tab size : Sets the size of the messages' window tabs. This is mostly useful to make room for text display when needed. Example: Settabsize 0, 0, 0 will colapse all the tabs except the Command / Message one, that will take the full window width. 

Time related commands

Settime hh:mm:ss : Sets the computer clock's time to the desired value. Use only the character ':' as a separator.
Setdate dd-mm-yy
: Sets the computer clock's date to the desired value. Use only the character '-' as a separator.
Starttimer
: Starts a timer that can be stopped with Stoptimer or viewed without stopping it with Elapsedtime.
Stoptimer : Stops the timer started with Starttimer and outputs the elapsed time to the messages window. This is useful to see how long does it take a script or a part of it to run.
Elapsedtime : Outputs the time that has passed since the timer was started to the messages window, but does not stop it.
Alarm minutes(optional) : This
command can be used with or without a parameter. When it is first launched, the time in minutes should be specified; subsequent executions without any parameter will return true if the alarm has expired and false if the timer hasn’t reached zero. This is intended to be used in conjunction with If.
Alarm2 minutes(optional) : Works the same as Alarm, and is totally independent.
Alarm3
minutes(optional) : Works the same as Alarm, and is totally independent.
Delay time in 1/10 of a second : Will pause the script execution for the given amount of time.
Sleep time in 1/1000 of a second : Will pause the script execution for the given amount of time.

Logging commands

Log  filename
: Logs every line executed to the file specified. If the file name is not given c:\BTEWin.log is used by default. The format of every logged line is "[Date Time] executed line".
Logfile filename : The same as Log.
Logfileoff : Deactivates file logging.

Filesystem commands

Filetowrite filename : Sets the file that will be used with the Writeline command.
Writeline text : Writes a line to the file specified with Filetowrite.
Write content
: Writes the data specified by content to the file specified with Filetowrite.
Binwrite
: This command will write data in binary format. The data must follow the command and be in hexadecimal format and must also be
delimited by a begin-end subscript. The following example will leave things clear.

Example
:

filetowrite c:\myfile.bin
binwrite
 begin
 
000100201133114411002200
  a02132441125821a2b091021
 end

The lines containing the data can be of any length smaller than 1024 characters. The bytes can be separated by spaces, for example, to improve its readability.

Textwrite
: This command will write data in text format. The data must be delimited by a begin-end subscript.

Example
:

filetowrite c:\myfile.
txt
textwrite
begin
This is a test
                   to check textwrite
end

Note that the spaces at the beginning of the lines will be included. This command is useful to avoid the use of multiple write or writeline commands.
Copy
source file  target file /a : It is similar to the DOS Copy command, but doesn't accept wildcards or directories. If the optional /a switch is used, the source file contents will be appended to the target file.
Xcopy source file/directory  target file/directory /y /s : Xcopy eliminates the limitations found in Copy. This command supports wildcards and can copy files as well as directories. Use /y to automatically answer yes to all confirmation prompts and to hide all progress and error indicators. Use the /s switch to copy subdirectories when using wildcards.

Examples :

Xcopy c:\test d:\
. This command will copy the source directory with all of its subdirectories to the destination one.
Xcopy e:\source\*.* f:\test\ . This example will copy all the files found in e:\source, but not the subdirectories.
Xcopy e:\source\*.* f:\test\ /s
. This example will copy all the files found in e:\source, including the subdirectories.

Move source file/directory  target file/directory /y /s : Moves one file/directory to another file/directory. This command supports wildcards. Use /y to automatically answer yes to all confirmation prompts and to hide all progress and error indicators. Use the /s switch to move subdirectories when using wildcards.
MoveOnReboot source file  target file /y : This is useful to replace files that are in use. This command does not move the file until the operating system is restarted. If the target file already exists, use the /y switch to replace it.
Del file : Deletes the given file. This command accepts wildcards.
Delete file : The same as Del.
Recycle file : Sends the given file to the recycle bin. This command accepts wildcards. Use /y to automatically answer yes to all confirmation prompts and to hide all progress and error indicators.
Deltree director
y /y
: Deletes the given directory and all its content. Use /y to automatically answer yes to all confirmation prompts and to hide all progress and error indicators.
Rename
original name  new name
: Changes the name of the file referenced by 'original name' to 'new name'. This command doesn't support wildcards.
Ren
original name  new name : The same as Rename.
Forcecopy, Forcedel, Forcerename : These variants of the copy, del, and rename commands, change the attributes of the destination files to let the operations perform. The Forcerename command will delete
the target file if it exists, so be careful.
Create filename size : This command creates a file with the given name and size. The file will be filled with zeroes.
Rmdir directory : Removes the given directory if it is empty.
Rd directory : The same as Rmdir.
Mkdir directory
: Creates the specified directory.
Md directory : The same as Mkdir.
Chdir
directory : Changes the working directory. This command supports wildcards.
Cd directory : The same as Chdir.
Pushdir
: Pushdir saves the current directory so it can be recalled later using Popdir.
Popdir : Restores the working directory saved by Pushdir.
Touch file : Sets the file date and time to the current ones. This command supports wildcards.
Fileexists filename : Returns true if the specified file exists or false if it does not. Useful to be used with If.
System
shell command : Executes a command shell command. This involves launching the default command shell, for example command.com. The starting directory for the command shell will not be the current directory in most cases, so using _CURRENTDIR is recommended for file operations.

Example : System dir %_CURRENTDIR /s /p
Example : System dir %_CURRENTDIR | list   ; this will work if you are using 4DOS as your command shell.

Load CD/DVD drive letter
: Loads (closes) the tray of the given CD/DVD drive. Supports wildcards. Example 1 : Load d: , Example 2 : Load * .
Eject CD/DVD drive
letter : Ejects (opens) the tray of the given CD/DVD drive. Supports wildcards. Example 1 : Eject d: , Example 2 : Eject * .
 
Patch
: This command represents a complete binary search-replace engine. It can be used with multiple search-replace commands, or using absolute offsets. Here comes a detailed explanation.

Example 1: 

patch
 begin
  f=game.sav
  ms=00 03 00 00 00 FF
  mr=xx  20 xx xx xx xx
 end

The main thing to have in mind, is that this command uses its own sub-script, that must be delimited by begin-end. The following table describes all the available commands.

  Begin 
  F=filename 
  FS=filesize
  O=offset in HEX
  S=string in HEX 
  R=string in HEX 
  I=string in HEX 
  MS=string in HEX 
  MR=string in HEX 
  End 
Beginning of the script. Must be used.
The file we want to modify.
The desired filesize that should match for the script to continue.
Absolute offset.
The search string.
The replace string.
The inject string. Note that after injection the offset is incremented by the length of the written data.
Multiple search string.
Multiple replace string.
End of the script. Must be used.


We can use wildcards, showed by XX (not case sensitive). If we use them in the search string, it means that these values will be ignored, any value will be allowed in that place. If we use them in the replace string, it means that these values will not be replaced, the original values will remain.

Example 2 : 

patch
 begin
  f=game1.sav
  ms=0003000000FF
  mr=xx20xxxxxxxx
  f=game2.sav
  o=12fd
  s=xx 12 12 xx 34 fe
  r=xx xx xx 23 xx xx 
 end

You must understand that this command should only be used when you know exactly what you're doing. If this command is used without knowledge the results can be disastrous. It can be very useful to make little modifications to files during installations, and for game cheats.

Patchfile
: The same as Patch.

Patchok
: Returns true if all the patches have been applied succesfully. Of course, this command applies to the last executed Patch sub-script.

Patchfileok : The same as Patchok.

Patchmem Process Id
: This command makes possible to inject/replace code in the last executed process (except if it has been launched using ShellExecuteEx) or in the desired process when the optional Process Id parameter is specified. To get the identifier of the process that created a particular window use the variable function @PROCESSID["Window Title"] . Please note that the suspend and resume commands can't operate when patching a process other than the last executed one, so don't use them in that situation.

Example : 

myprogram.exe
patchmem
 begin
  o=45F7C0
  s=00 03 00 00 00 FF
  r=00 20 01 01 xx xx
 end

This command works almost the same as patch, and multiple searches are now supported; if a limit is not specified or is set to zero, the patcher will search for the string through the entire process memory.  The limit is not absolute but relative to the specified offset; if the offset is set to 0 for multiple searches, it will be replaced by the base of the first commited region of memory, and the limit will be relative to that value.

  Begin 
  Wait
  Suspend
  O=offset in hexadecimal
  L=limit for multiple searches in HEX
  S=string in HEX 
  R=string in HEX 
  MS=string in HEX 
  MR=string in HEX 
  Resume
  End 
Beginning of the script. Must be used.
Waits for process initialization to finish.
Suspends process execution.
Offset in memory.
The patcher will not travel in memory more than this number of bytes.
The search string.
The replace string.
Multiple search string.
Multiple replace string.
Resumes process execution.
End of the script. Must be used.

We can use wildcards, showed by XX (not case sensitive). If we use them in the search string, it means that these values will be ignored, any value will be allowed in that place. Wildcards can also be used in the replace string, meaning that these values will not be changed from its original status.

The Wait, Suspend and Resume commands can be used inside or outside of the script, they will do exactly the same.

This command should be used only when you know exactly what you're doing; the results can be disastrous if it is used without knowledge.

Patchmemok : Returns true if all the strings have been replaced succesfully.

SetPEsum filename : Computes and fixes if necessary the PE checksum for the given file. The filename argument should refer to a file that is in the Portable Executable (PE) format.
Lockfile filename : This commands opens the given file in exclusive mode, so subsequent tries to open it from another processes will fail. To close the file just execute the Lockfile command again but without any parameters. Only one file can be opened by this command at a time.
Saveok :  Returns true if the user has pressed the save button when the @SAVE[filename] variable function has been used.
Browseok
: Returns true if the user has pressed the open button when the @BROWSE[filename] variable function has been used.
Browsefolderok : Returns true if the user has pressed the open button when the @BROWSEFOLDER[filename] variable function has been used.
Installdirok : Returns true if the user has pressed the ok button when the @INSTALLDIR[folder] variable function has been used.
Installdirtitle dialog title : This command sets a new title for the dialog created by the @INSTALLDIR[] variable function .
Filefilter Description,extensions : This is the optional file filter for the @SAVE[...] and @BROWSE[...] variable functions. The change remains while the script is running; to revert back to the default filter use the command again without any parameters. Example: Filefilter Executable files (.exe;.dll;.ocx),*.exe;*.dll;*.ocx

7Zip arguments : The BTEWin distribution includes a copy of  Igor Pavlov's 7-Zip standalone command line archiver (7za.exe). When BTEWin is executing a batch file, this copy will be run directly when the 7Zip command is used, but the true purpose of this feature is to allow distribution of packed data embedded into standalone executables, so the 7za.exe file will be embedded into the final standalone executable if a file containing packed data is chosen in the "Make executable Options" dialog or the corresponding checkbox is selected. Note that since version 3.09 other packers can be easily embedded; to do so copy the executables to the "Packers" folder under the install dir and select the appropriate file when building executables.

Example: 7zip t "%_BTEFILE"
This example only makes sense for standalone executables containing packed data.

Packer arguments
: This command does exactly the same as the 7Zip one, but it has been added to avoid naming confusion if different packers are used when building standalone executables.

WSHExtract filename
: This command extracts the script file that must have been previously embedded when building a standalone executable.

Example:

set scriptfile=%@UNIQUEFILE[%tmp%\script.vbs]
wshextract %%scriptfile%%
wscript %%scriptfile%%
waitforprogram
del %%scriptfile%%

DDE commands

Ddeexec server,topic,[Dde command]
: Tries to connect to the specified server and then requests the given command. Note that dde commands must be enclosed in square brackets [] . Example : Ddeexec progman, progman, [ShowGroup(Main,1)]  .This opens the main program manager group.

Network commands

AddConnection Remote Name, Password, Local Name
: This command connects a local device to a network resource. A successful connection is persistent, meaning that Windows automatically restores the connection during subsequent logon operations. Password is optional. Example : Addconnection \\SERVER\SHARE, x: .
Use the Net utility supplied with Windows NT based operating systems to get additional functionality. Its  use can be combined with waitforprogram and if(errorlevel xx) to decide actions. Type "net help" at the command prompt to obtain more information.
CancelConnection
Resource Name, Force : This command breaks an existing network connection. Force is optional and is specified to force disconnection. Example : CancelConnection x: , force .
Isconnected
: Returns true if there is at least an active RAS (Remote Access Service) connection.
Disconnect
: Will close all the open RAS connections. Use it with care.

DownloadURL URL to be downloaded  File Name : Downloads bits from the Internet and saves them to the given file.
 
Message sending commands

Sendmessage message, first parameter, second parameter
: This command sends the appropriate message to the window previously specified using Targetwindow. All the parameters must be hexadecimal numbers. Example : Sendmessage 112 , F030 , 0 .
The previous example will maximize the window specified by Targetwindow.

The following table shows the values of some common messages that can be sent with this command.

Message types Hex values
WM_COMMAND 111
WM_SYSCOMMAND 112
WM_CUT 300
WM_COPY 301
WM_PASTE 302
WM_CLEAR 303
WM_UNDO 304

To obtain full information about all standard messages and parameters please consult the Windows API documentation. To find out the proper messages and parameters for the applications that you want to control it's useful to have some reverse engineering skills, but in some cases it may be enough with the use of some API spy tools.

S
enddlgitemmessage control id, message, first parameter, second parameter : This command does the same as Sendmessage, but it sends the message to a particular dialog item (i.e.: a button, a check box, an edit control, ...) within the window specified by Targetwindow. All the parameters must be hexadecimal numbers, including the control id.
Setdlgitemtext control id, text :
Sets the text for the given dialog item; the target window will be the one specified using Targetwindow. The control id value must be expressed in hexadecimal format.
Keysend keystrokes
: This command is similar to Keystack, but there are a few important differences; first of all, this command sends the keystrokes exclusively to the window specified with Targetwindow. In second place, it has to be noted that the keystrokes that are sent using this command are software ones, and may be distinguished by an application from hardware ones, and  subsequently ignored. The last difference with keystack is that modifiers (Alt, Ctrl, Shift) are not supported.

Registry commands

Delregval registry value
: Deletes the given registry value. Example : Delregval HKEY_LOCAL_MACHINE\Software\BTEWin test\BTEWin value .
Delregkey registry key
: Deletes the given registry subkey. Example : Delregkey HKEY_LOCAL_MACHINE\Software\BTEWin test .
Setinival ini file,section name,key name,string
: Copies a string into the specified section of the specified ini file.

Input commands

Inputboxok : Returns true if the user has pressed ok in the last Inputbox command or @INPUTBOX[] variable function.
Selectionboxok : Returns true if the user has pressed ok in the last @SELECTIONBOX[] variable function.
Inputboxtitle text : This command sets a new title for the dialog created by Inputbox or @INPUTBOX[] .
Selectionboxtitle text : This command sets a new title for the dialog created by @SELECTIONBOX[] .
Alertboxtitle text : This command sets a new title for the dialog created by Alertbox.

Daemon Tools commands

Mount device,disc image file
: Mounts the given disc image file in the desired device. This command requires Daemon Tools to be installed.
The device value can also be set to *, so the image file will be mounted in all available drives. Example : Mount *,mycd.iso .
Unmount device : Unmounts the image that is currently mounted in the given device. This command requires Daemon Tools to be installed.
The device value can also be set to *, so all images will be unmounted.
Daemonoptions SECUROM SAFEDISC LASERLOK HIDECDR RMPS
AUDIO ALLEMU : Sets the appropriate options for Daemon Tools. These options can also be disabled by appending off to them. Allemu controls all the emulation options at once. Example : Daemonoptions audiooff . These options can be combined as desired.
Daemondrives number of virtual drives
: Sets the number of virtual CD/DVD drives emulated by Daemon Tools.
Daemonid Vendor, Model, Revision
: Sets the name of the virtual SCSI devices emulated by Daemon Tools. There's a limit of 8 characters for the vendor string, 16 characters for the model string and 4 characters for the revision string.
Daemonvolume device,volume level
: Sets the cd audio playback volume for the given device. The device value can be set to *, so the same value will be set for all devices. The volume level value can also be set to ON or OFF, so volume control will be enabled or disabled without changing its value. By default manual volume control is enabled with this command. The volume level value must be in the range 0-255. Example
: Daemonvolume 0, 255 .
Daemonregion device, DVD region
: Sets the DVD region for the given device. The device value can be set to *, so the DVD region will be set for all devices. The DVD region must be in the range 0-8 , being 0=none.
Daemonletter device, drive letter : Changes the letter for the given virtual device if possible. Example : Daemonletter 0, X .
Pushdaemon
: Saves the complete Daemon Tools status for a later recall using Popdaemon. Everything is saved, included the mounted images, number of devices, emulation parameters, ...
Popdaemon : Restores the complete Daemon Tools status that must have been previously saved by a call to Pushdaemon.
Daemonlibrary control library path : This command is used to specify the control library path manually. If the specified library does not exists or can't be loaded, the program will try to detect it automatically.
Freedaemon : Unloads the control library if it has been loaded before. If the 'Daemonlibrary' command has been used previously, it will need to be called again after using this command.

Miscellaneous
commands

Createlink
: This command makes possible to create shell links (shortcuts) through the use of the following sub-script :

  Begin 
  L=filename for the link
  P=original object's pathname
  D=description (optional)
  I=pathname of icon file (optional)
  N=icon index (if I has been used) 
  W=working directory (start directory)
  S=MAX/MIN (window presentation)
  H=hotkey (numerical value)
  End 
Beginning of the script. Must be used.
The filename for the link file itself. Should end with .lnk or .pif
The original object's pathname.
Description for the shortcut; this is not the name of the shortcut.
We can use it if we don't want to use the default icon.
Icon index, i.e. 0,1, ... Only necessary if we want to use a different icon from the first one.
The working directory, i.e. the startup directory for our object. This is optional, too.
Should only be used if we don't want to use normal presentation.
You'll need the key codes to be able to use this.
End of the script. Must be used.

Example :

createlink
begin
l=%_DESKTOPDIR\BTEWin link creation test.lnk
p=%_WINDOWSDIR\calc.exe
end


This example will create a link to the Windows' calculator on the desktop.

Playmedia filename
: Playmedia uses the mci functions to play the given media file. No controls like pause and advance will be available, and any Windows media supported file can be played. Note that audio files can’t be easily stopped if started with this command, since there is no window associated; this is not an issue with video files.
Print filename : Prints the filename given as a parameter using the associated aplication.
IsNT : Returns true if we are running under Windows NT, 2000, XP or similar.
Is9x : Returns true if we are running under Windows 95, 98, Millenium or similar.
Autoplay on/off : This command turns on/off Autoplay for data CDs. The change is persistent.
Setwavevolume device, volume : Sets the wave volume value for the desired device. The volume must be in the range 0-255, and the device parameter is optional; if it is not specified 0 will be used.
MixerSet device, component type, control type, value : This command makes possible to set the properties of a control associated with an audio line. The device parameter represents the desired soundcard, being 0 the first one. The component and control types require a more detailed description :

Component types

Audio lines

ANALOG Analog source.
AUX or AUXILIARY A source originating from the auxiliary audio line.
CD or COMPACTDISC A source originating from the output of an internal audio CD.
DIGITAL A digital source.
HEADPHONES An adjustable destination intended to drive headphones.
LINE or LINEOUT A line-level source.
MASTER or SPEAKERS or SPK An adjustable destination intended to drive speakers.
MICROPHONE A microphone recording source.
MONITOR A destination used for a monitor.
PCSPEAKER A source originating from personal computer speaker.
SYNTH or SYNTHESIZER A source originating from the output of an internal synthesizer.
TELEPHONE A source originating from an incoming telephone line.
WAVE or WAVEOUT A source originating from the waveform-audio output digital-to-analog converter (DAC).
Control types

Meaning / Usage

BASS Bass
EQUALIZER Equalizer
LOUDNESS Loudness (1/0) 1=ON, 0=OFF
MONO Mono (1/0) 1=ON, 0=OFF
MUTE Mute (1/0) 1=ON, 0=OFF
ONOFF OnOff
PAN Pan
QSOUNDPAN QSoundPan
STEREOENH StereoEnh
TREBLE Treble
VOL or VOLUME Volume

Finally, the value parameter is the actual setting; the available range is (0-255), but for certain control types the available values are only 1=ON or 0=OFF. Note that the value parameter can also reflect variations (-/+), so it is possible, for example, to increase the actual value by 10 using +10.

Examples:

mixerset 0,master,vol,125
mixerset 0,master,mute,1
mixerset 0,master,vol,-10

Monitor on/off : Switches the screen power on/off.
ButtonMenu : This command shows a dialog that contains a number of buttons that will store a given value into a variable if pressed. This is achieved through the use of this sub-script :

  Begin 
  T=title for the dialog
  I=text for the button
  C=content
  End 
Beginning of the script. Must be used.
The title for the dialog containing the buttons.
The text to show for the given button.
The text that will be stored in the %_BUTTONCMD variable if the button is pressed
End of the script. Must be used.

Example :

buttonmenu
begin
t=Select an option
i=Launch Notepad.exe
c=notepad.exe
i=Launch Calc.exe
c=calc.exe
end
%_BUTTONCMD


There's a limit of 23 buttons for the dialog; also use matched i=... and c=...items, otherwise you'll get unexpected results. There's also an additional variable that will be set after the button is pressed; it is %_BUTTONSEL, that will contain the button number.

ListMenu : This command shows a dialog containing a list that will store the selected string into a variable when OK is pressed. This is achieved through the use of this sub-script :

  Begin 
  T=title for the dialog
  C=content
  End 
Beginning of the script. Must be used.
The title for the dialog containing the list..
The text that will be stored in the %_LISTCMD variable if the item is selected.
End of the script. Must be used.

There's also an additional variable that will be set after the OK button is pressed; it is %_LISTSEL, that will contain the item number. %_LISTSEL will be 0 when there's no selection or when Cancel is pressed.

Example :

listmenu
begin
t=Select an option
c=Launch Notepad.exe
c=Launch Calc.exe
c=Exit
end
if(compare %_LISTSEL=0)quit
if(compare %_LISTSEL=1)notepad.exe
if(compare %_LISTSEL=2)calc.exe
if(compare %_LISTSEL=3)quit

The example shows how to build a simple menu using this command, but for this purpose it is better to use 'Buttonmenu'.

IDECDS on/off, on/off (optional) : This command enables/disables all the available IDE CD/DVD drives connected to the system. If the second parameter is set to off, the devices are powered down. Use it at your own risk.

5. Variables and variable functions

Variables and variable functions names are case sensitive. User defined variables are also case sensitive. There's an internal limit of
1024 user defined variables, and variable names can't be larger than 256 characters. Trying to load a pre-defined variable with user values will have no effect. Environment variables obbey their own rules. For an environment variable to be expanded (replaced with its content), use the following syntax :  %MYVARIABLE% ; if it is an internal variable use %%MYVARIABLE%% instead. Finally, for pre-defined variables and variable functions just put a '%' before the name to expand them, i.e. %_PREDEFINEDVARIABLE, or %@VARIABLEFUNCTION[] . Besides that, certain environment variables are read at BTEWin's startup and can control some aspects, like the command separator. Let's see the complete list of variables and variable functions :

Environment variables with a special meaning

BTESEPARATOR
: This variable can contain a new command separator; so the separator command won't need to be used all the time.
BTEAUTOSCROLL
: If it is set to 0, autoscroll will be turned off by default.
BTEECHO
: If it is set to 1, command logging will be enabled by default.
BTELOGFILE
: If this variable contains a file name, every line executed will be logged to it.
BTEQUOTING : If it is set to 1, quoting will be enabled by default. Please read the description for the quoting command.


Variables

Path variables

_BTEFILE : Path to the script file itself or to the executable file in the case of a standalone executable.
_SRCDRV : Source drive letter of the current script file.
_SRCDIR : Path of the current script file. It can be used with
_SRCDRV to define the working directory. Example : Workingdir %_SRCDRV\%_SRCDIR\
_STARTUPDIRALL : The common (for all users) startup folder.
_STARTUPDIR : The
Windows startup folder.
_SYSTEMDIR : Windows system directory, for example C:\WINDOWS\SYSTEM.
_WINDOWSDIR
: Windows directory, for example C:\WINDOWS.
_CURRENTDIR
: Current directory. Useful to be used in conjunction with System.
_PERSONALDIR : "My Documents" folder.
_PROGRAMSDIRALL
: The common (for all users) programs folder under the start menu.
_PROGRAMSDIR
: The programs folder under the start menu.
_STARTMENUDIRALL
: The common (for all users) start menu folder.
_STARTMENUDIR
: The start menu folder.
_DESKTOPDIRALL
: The common (for all users) desktop folder.
_DESKTOPDIR
: The desktop folder.
_COOKIESDIR
: The cookies folder.
_HISTORYDIR
: Internet history folder.
_INTERNETCACHEDIR
: Internet Explorer cache folder.
_RECENTDIR
: Recent files folder.
_SENDTODIR
: The folder that contains
'Send To' menu items.
_FAVORITESDIRALL
: The folder that is used
as a common repository for all users' favorite items.
_FAVORITESDIR
: The folder that is used
as a common repository for the current user's favorite items.
_PROGRAMFILES
:
Program Files folder. A typical path is C:\Program Files .

System variables

_BTEWINVERSION
: Version of the script interpreter (BTEExec.exe).
_OSVERSION
: Windows version in text form.
USERTEXT : The text entered using the Inputbox command.
_ARGC : Number of command line arguments.
_CMDLINE : The command line used to launch the program.
_CLIPBOARD : Returns the clipboard contents (only text).
_COMPUTERNAME
: Returns the machine's name under Windows.
_USERNAME : Return the actual user name.
_FOREGROUNDWINDOW : Returns the foreground window's title.
_MEMAVAILPERCENT : Percentage of free memory.
_MEMUSEDPERCENT
: Percentage of used memory.
_MEMTOTALPHYS
: Total installed memory.
_MEMAVAILPHYS : Amount of free memory.
_PAGEFILETOTAL
: Current size of the paging file.
_PAGEFILEAVAIL : Available space for the paging file to grow.
_MEMVIRTUALTOTAL : Total virtual memory.
_MEMVIRTUALAVAIL : Available virtual memory.
_VIDMODE : The current video mode in the format X size, Y size, colours. It can be used to save the current video mode in a user variable, that can be recalled later using Setvidmode.
_RESX
: The X size of the current video mode.
_RESY
: The Y size of the current video mode.
_BPP
: The number of colours of the current video mode.
_REF : The refresh rate of the current video mode.
_CURSORPOS
: The cursor (mouse) position in screen coordinates. This is not suitable to be used with Movemouse.
_MOUSEPOS
: The cursor (mouse) position in mouse coordinates. This is suitable to be used with Movemouse.
_LASTPROCESSID
: The identifier of the last executed process.
_LASTSTATUS : Contains 1 if the last command returned true or 0 if it returned false.
_LASTMESSAGE
: Contains the last message shown in the messages window.
_AUTOPLAY
: Returns the status of Autoplay for data CDs in the form ON/OFF.
_BUTTONCMD
: This variable is set when using the ButtonMenu command and will contain the c=... value of the pressed button. Read the description about the ButtonMenu command for more information.
_BUTTONSEL : This variable is set when using the ButtonMenu command and will contain the number of the pressed button; if the first button was selected it will contain 1 and so on. If the dialog is closed _BUTTONCMD will be empty and _BUTTONSEL will contain 0.
_LISTCMD
: This variable is set when using the ListMenu command and will contain the selected text. Read the description about the ListMenu command for more information.
_LISTSEL : This variable is set when using the ListMenu command and will contain the number of the selected item; if the first item was selected it will contain 1 and so on. If the dialog is closed or Cancel is pressed _LISTCMD will be empty and _LISTSEL will contain 0.
_MAINDIR
: The folder where this software package has been installed.

Date and time variables

_DATE : The actual date.
_DATENUM : The actual date in the format 'YearMonthDay', suitable for numerical comparisons.
_TIME : The actual time.
_TIMENUM : The actual time in the format 'HoursMinutesSeconds', suitable for numerical comparisons.
_DAY : Day of the week in text format (Monday, ...).
_YEAR
: The current year.
_MONTH : Month in text format (January, ...).

Daemon Tools variables


_DAEMONDRIVES : Number of CD/DVD drives currently emulated by Daemon Tools.

Miscellaneous variables

_RAND : Generates a random number in the range 0-100.

Variable Functions

System variable functions

@ARGV[number]
: Returns the desired command line argument. Example : messagebox %@ARGV[1] .

Filesystem variable functions

@BROWSE[filename] : Opens a file selection dialog, and returns the selected file name for opening. The filename parameter is the default value. It is possible to know if the user has pressed the open or cancel button by using the Browseok command. Additionally, the default file filter can be changed by using the Filefilter command.
@BROWSEFOLDER[dialog title, initial folder] : Opens a directory selection dialog, and returns the selected directory.
@INSTALLDIR[folder name]
: Opens a dialog where a folder can be directly typed or selected; this can be used to build a typical installation.
@SAVE[filename]
: Opens a file selection dialog, and returns the selected file name for saving. The filename parameter is the default value.
It is possible to know if the user has pressed the save or cancel button by using the Saveok command. Additionally, the default file filter can be changed by using the Filefilter command.
@GETPATH[filename] : Removes the name and leaves the directory.
@GET
FILENAME[filename] : Removes the path and leaves the name; works with URLs, too.
@GETLINKPATH[shell link file]
: Tries to resolve and return the path for the given shell link file.
@DRIVETYPE[drive] : Returns the drive type in text format. The possible values are : UNKNOWN, REMOVABLE, FIXED, REMOTE, CDROM and RAMDISK. In case of error, DRIVE_NO_ROOT_DIR or an empty string will be returned.
@DRIVELETTER[]
: Shows a dialog that contains all unasigned drive letters. It returns the selected one if ok is pressed, or an empty string if cancel is pressed.
@DISKFREE[drive]
: Returns the free space in the specified drive. Example
: messagebox %@DISKFREE[c:] .
@DISKTOTAL[drive]
: The same as DISKFREE, but returns the drive size.
@DISKUSED[drive]
: Returns the used space in the specified drive.
@UNIQUEFILE[filename] : Returns the given filename if the file does not exist, or appends a number to the name (up to 9999) to guarantee that there's not a file with the same name.
@
SHORTNAME[filename]
: Returns the short (8.3) path form of the given filename.
@LONGNAME[filename] : Returns the long path form of the given filename.
@FILEDATE[
filename]
: Date of the last file modification or file creation.
@FILEDATENUM[filename]
: Date in the format YearMonthDay, suitable for comparisons.
@FILETIME[
filename] : Time of the last file modification or file creation.
@FILETIMENUM[filename] : The same as @FILETIME but without separators to allow comparisons.
@FILEATTRIBS[filename] : Will return the file attributes in the form 'RHSAD'. Attributes that are not present will be shown as '-'.
@FILESIZE[filename] : Returs the size of the given filename in decimal format.
@FOLDERSIZE[folder] : Returs the size of the given folder in decimal format.
@CRC32[filename] : Returns the CRC32 hash of the given file.
@MD5[filename] : Returns the MD5 hash of the given file.
@SHA1[filename] : Returns the SHA-1 hash of the given file.
@SHA256[filename] : Returns the SHA-256 hash of the given file.
@NFSUM[offset, size, filename] : This checksum algorithm is often used for firmwares, it simply consists on the sum of words, finally discarding the high order word of the resulting double word, so the result will be a word (16 bit value).

Internet variable functions


@GETIP[url] : The IP address belonging to the given URL. Example : messagebox %@GETIP[www.myweb.com] .
@GETNAME[IP address]
: The host name that corresponds to the given IP address. Example
: messagebox %@GETNAME[194.214.21.25] .
@ADAPTERIP[adapter number] : The IP address that is assigned to the given network adapter, or 0.0.0.0 if the adapter does not exist or does not have an assigned IP address.

Registry variable functions


@GETINIVAL[ini file,section name,key name]
: Returns the content of the given key belonging to the specified ini file.
@GETREGVAL[registry key\subkey] : Returns the content of the given registry key\subkey.
Example : messagebox %@GETREGVAL[HKEY_LOCAL_MACHINE\Software\Microsoft\DirectX\Version] .

Arithmetical variable functions

@EVAL[numerical expression]
: Evaluates the given expression and returns the result.
The following table describes the supported operators :

Operators Operations Precedence
(   Lowest
)   Highest
+ Addition Low
- Substraction Low
* Multiplication Medium
/ Division Medium
\ or % Modulus High
^ Exponentiation High
>> Bitwise shift right High
<< Bitwise shift left High
AND Bitwise AND High
XOR Bitwise XOR High
OR Bitwise OR High
asin( Arc sine Lowest
sin( Sine Lowest
acos( Arc cosine Lowest
cos( Cosine Lowest
atan( Arc tangent Lowest
tan( Tangent Lowest
abs( Absolute value Lowest
sqrt( Square root Lowest
log( Base 10 logarithm Lowest
ln( Natural logarithm Lowest
exp( exponential e to the x Lowest

WARNING: use of bitwise operators will cause decimals to be lost.

Valid expressions are, for example : acos(30) , log(10) , ln(exp(1)) , ...
Wrong expressions are : acos 30 , log 10 , ln(exp 1)

@
FEVAL[numerical expression] : The same as @EVAL, but the result is showed always in the form [-]dddd.dddd, unlike @EVAL, that may show the result in the format [-]d.dddd or e[+/-]ddd depending on the value.
@RANDOM[lower limit, upper limit] : Generates a random number in the range (lower limit, upper limit).
@ABS[number]
: Absolute value of the given number.
@CONVERT[number, actual base, desired base] : Converts a number from one number base to another.
@DEC[hexadecimal number]
: Converts a number from base 16 (hexadecimal) to base 10 (decimal).
@HEX[decimal number]
: Converts a number from base 10 (decimal) to base 16 (hexadecimal).

String variable functions

@READLINES[number
of lines, filename] : Reads the desired number of lines from the given file.
@READLINE[line number, filename] : Reads the desired line from the given file.
@BINREAD[offset, size, filename] : Reads binary data from the given filename and returns it in hexadecimal format compatible with functions like, for example, @HEXCHAR. The limit for the size parameter is 1023; if a higher value is specified it will be set to the allowed maximum.
@BINSEARCH[ASCII code/s in hex, filename] : Searches for the given string within the desired file and returns the offset where it was found or an empty string if it wasn't.

@ASCII[character] : ASCII code of the given character.
@CHAR[ASCII code
/s]
: The character/s corresponding to the given ASCII code/s. Multiple codes must be separated by spaces.

 

@CHARHEX[ASCII code/s in hex] : The character/s corresponding to the given ASCII code/s, that must be in hexadecimal format. It's not necessary to separate the codes, but it is also supported. Example: echo %@CHARHEX[54657374696E67] .
@HEXCHAR[text]
: This function translates a text string into another one formed by the corresponding ASCII codes in hexadecimal format.
@INDEX[string, text]
: Position of string within text, or -1 if it is not found.
@INDEXL[string, text]
: Position of string within text, or -1 if it is not found.
@INDEXR[string, text]
: Position of string within text, but the search starts from the end of text (right) and not or from the beginning (left); it returns -1 if it is not found.
@INSERT[position, string, text]
: Inserts string into text at the given position.
@REPLACE[string 1, string 2, text]
: Replaces all occurences of string 1 within the given text with string 2.
@LEN[text]
: Length of the given text.
@LEFT[number, text]
: Returns the number of desired characters beginning from the left of the given text.
@RIGHT[number, text]
: Returns the number of desired characters beginning from the right of the given text.
@MID[position, number, text] : Returns the number of desired characters beginning from a specific position within the given text.
@UPPER[text]
: Converts the given text to uppercase.
@
LOWER[text]
: Converts the given text to lowercase.
@LPAD[length, padding text, original text]
: This function inserts the padding text to the left of the original text until the length of the resulting string is equal to or over the desired length. Example: echo %@LPAD[2,0,F] .
@RPAD[length, padding text, original text]
: This function appends the padding text to the original text until the length of the resulting string is equal to or over the desired length. Example: echo %@RPAD[2,0,F] .
@LTRIM[character, text]
: Removes all the occurrences of 'character' starting from the left of the given text until a different character is found.
@LTRIMS[character, text]
: Removes the first occurrence of 'character' starting from the left of the given text  unless a different character is found.
@RTRIM[character, text]
: Removes all the occurrences of 'character' starting from the right of the given text  until a different character is found.
@RTRIMS[character, text]
: Removes the first occurrence of 'character' starting from the right of the given text  unless a different character is found.

Process variable functions

@PROCESSID["Window Title"]
: Tries to obtain the identifier of the process that created the given window. The window title can also contain classes and wildcards.
@THREADID["Window Title"]
: Tries to obtain the identifier of the thread that created the given window. The window title can also contain classes and wildcards.
@PIDFROMNAME[process name] : This function is similar to @PROCESSID[], but this one obtains the identifier from the process name. This function supports wildcards and the process name is not case sensitive. Depending on the operating system, the process name parameter must be a full path instead of only the name, but this can be easily solved using wildcards. Example: messagebox @PIDFROMNAME[*explorer.exe]. In the previous example the * must be used to retain compatibility between different operating systems.
@NAMEFROMPID[PID value]
: Obtains the process name from the process identifier value. The previous comment is valid here, too; the process name will be a full path or a name depending on the operating system. To get homogeneal results the @GETFILENAME[] function can be used. Example: messagebox %@GETFILENAME[%@NAMEFROMPID[%@PIDFROMNAME[*explorer*]]]

Input variable functions

@INPUTBOX[text] : This function shows a dialog box asking for user input. The text that can be specified as the argument is the pre-defined value for the user input. The entered text is also stored in the internal variable USERTEXT . The title for the dialog can be changed using Inputboxtitle new title before a line that contains @INPUTBOX[] .
@SELECTIONBOX[text]
: This function is similar to the @INPUTBOX[] one, but it features two edit controls, so the specified text will be shown in the read-only one, and the other will receive the user input. The title for the dialog can be changed using Selectionboxtitle new title before a line that contains @SELECTIONBOX[] .

Daemon Tools variable functions

@DAEMONLETTER[device]
: Returns the drive letter corresponding to the given device. Requires Daemon Tools to work.
@DAEMONIMAGE[device] : Returns the image that is currently mounted on the given device. It will only return an image name if it is mounted and ready to use, i.e. not ejected. Example
: if (compare "%@DAEMONIMAGE[0]"="") messagebox There's no image mounted on drive %@DAEMONLETTER[0] .

Mixer variable functions

@GETWAVEVOLUME[device]
: Returns the wave volume for the given device. The returned value will be in the range 0-255.
@MIXERGET[device, component type, control type]
: This function retrieves the properties of a control associated with an audio line. Read the explanation of the MixerSet command to learn about the valid values for the different parameters.

Window variable functions

@WINDOWPOS[window title]
: This function will return the coordinates and size for the given window (wildcards can be used) in the form X position, Y position , X size , Y size . If the window does not exist it will return 0,0,0,0 .


6. Q&A

Q: I want to launch an application but it needs to be started from its home dir. What can I do?
A: You can use Workingdir , but remember that you can't use the @@ parameter with this option. With @@ you can launch any kind of file, like text files, document files, ...; it will launch the associated application automatically
. This means that .lnk files can be created and executed for this purpose. Anyway, I recommend to use the first method for .exe files, because it gives more control.

Example
:

@@"c:\windows\start menu\myapp.lnk" "c:\my doc.bmp"

Q: I
am using 4DOS as my command shell and there are problems when BTEWin runs directly from the command line. What's wrong?
A: First of all, the default command separator for 4DOS is the same as the default one used by BTEWin, so you need to change one of the two. In BTEWin you can do that using the Separator command. A second problem is that you can't type pre-defined variables / variable functions literally, because 4DOS will try to expand them itself, so you must add an additional % symbol before them. Finally, I wouldn't recommend the use of internal variables under a 4DOS command line; environment variables (see Setenvvar) will save you from a lot of headaches. Please note that these problems will not show up when command.com or cmd.exe are used as command shells; this discussion only applies to 4DOS.

Examples :

bteexec --cmd echo %@CHAR[37]^pause
bteexec --cmd separator &echo %%@CHAR[37]&pause   (Only for a non-standard command shell!)

The first example will execute perfectly when running from the default command shells, but will fail when launched under 4DOS. To make it work under such environment, it has to be modified as shown in the second example.

Q:
I
am trying to run a 4DOS/4NT command line from BTEWin using the System command (or using a direct call), but certain 4DOS/4NT functions don't work as expected. How can this be fixed?
A: The problem is that BTEWin may try to expand them itself; if this is an unwanted behavior, instead of using % before the actual internal variables / variable functions, use %@CHAR[37], this will avoid expansion.

Q:
I have changed the program's icon with an editor and it doesn't work anymore.
A:
Never change the program's icon with any resource editors; once a standalone executable has been built, it can no longer be modified. If you want to use an icon other than the default one, just choose it in the "Make executable Options" dialog.


7. License and disclaimer

This program is released as freeware
for non commercial use (read below). The use of this program is done at your own risk; I will not be liable of any damage that could be caused by the use or misuse of the software, either if it is consequential, indirect, etc.

You can distribute this software package as long as it is in an unmodified form; that means in its original archived status
. You can distribute script files created for BTEWin, but I will not be responsible in any way of them, the responsibility is assumed by the user and/or the script file's creator.

You are not allowed to distribute executable files created with BTEWin or the BTEExec.exe file for commercial purposes unless you have previously obtained my express permission. If you want to make use of the package as part of a commercial product you must also contact me for permission first.

I expressly prohibit the use of this software for any kind of malicious or illegal purposes, that may include but are not limited to, for example: destroying data from other people's computers, spread trojans and/or viruses, ... . Rules of common sense should be applied here.

You can't charge a fee for the distribution of the package, unless it is justified by the cost of the media it is stored in or any other absolutely indispensable non profit cost.

If you do not agree with all these terms, you must remove the package and cease to use it.

All trademarks and other registered names mentioned in this distribution are the property of their respective owners, and appear for identification purposes only.
 

8. Thanks

Jordan Russell for Inno Setup, a great freeware installer. You can find it at http://www.jrsoftware.org
DAEMON's Home for Daemon Tools, an excellent CD/DVD emulator. Download it from http://www.daemon-tools.cc
Geocities for web page hosting. Look for http://www.geocities.com or http://es.geocities.com
Igor Pavlov for 7-Zip, possibly the packer that features the best compression ratios available at the moment. Get it from http://www.7-zip.org
Brandon LaCombe for Packman, a 32 bit PE packer that supports aPLib and LZMA compression libraries and can be found at http://packman.cjb.net


9. Contact information

Web page: http://es.geocities.com/jpisoft/
You can contact me at the following e-mail: [email protected]

 


(C) 1999-2006 JPISoft ([email protected])

Hosted by www.Geocities.ws

1