| |
This reference is currently incomplete in version 3.0.

Simulanics
Visual S++ Studio
Lanuage Reference
http://www.simulanics.com
Contents:
Part 1: Simulanics S++ 32-bit Scripting Language
1.1 >
Variables
1.2 > Constants
1.3
> Scripting Functions
1.4 > Callback Functions
1.5 > API
1.6 > Objects
1.1 Variables
There are three variable types in S++ Scripting. 'Long' variables contain
integer values and 'String' variables contain a string (a set of characters,
integers, or a mix). The third variable type is called a 'Boolean' variable
and returns either TRUE or FALSE. Boolean variables can return an integer value
also (please refer to below).
• Declaring a variable type:
False = 0 : True = 1 or higher
long [variablename]
string [variablename]
• The value of a variable can be set with "=" , "+="
, "-=" , "*=" and "/=":
These operators all have a different function. Example code:
variable=1 *the variable value is set to 1*
variable+=1 *adds 1 to the variable value*
variable-=1 *substracts 1 from the variable value*
variable*=2 *multiply the variable value by 2*
variable/=2 *divide the variable value by 2/*
• To read the value of an existing variable, put the name between
percent (%) signs (ie %variablename%).
This can be done anywhere in a script and between a string enclosed by quotations!
Example code:
string temp
function SForm1_Load
{
temp = "test"
msgbox "%temp%",
simokonly, "Example"
}
(i.e. x = "%SForm1.STextbox1.Text%"
)
** The above example sets the variable 'x' equal to the value of a textbox on
form1.
There are also predefined variables built into the S++ Compiler. These
variables are constants which means that their values are predefined and cannot
be changed! Use them as any other Variable:
%appcomments%
%appcompanyname%
%appexename%
%appfiledescription%
%appprevinstance%
%appproductname%
%apppath%
%clipboard%
%time%
%date%
%exename%
%apppath%
1.2 Constants
At the moment, you cannot add customized constants but here is a
list of some predefined S++ constants:
[Windows System Constants]
simwinkey - retrieves the Windows Product Serial Number (used to activate
windows)
[Messagebox Callback/Structure Constants]
simbuttonok
simbuttoncancel
simbuttonabort
simbuttonretry
simbuttonignore
simbuttonyes
simbuttonno
[Messagebox Style Constants]
• When
a variable is set to a messagebox value, it returns an integer dependent upon
the value clicked by the user.
simokonly - Returns a value of '1'.
simokcancel - 'Ok' = 1, 'Cancel' = 2
simabortretryignore - 'Abort' = 3, 'Retry' = 4, 'Ignore' =
5
simyesnocancel - 'Yes' = 6, 'No' = 7, 'Cancel' = 2
simyesno - 'Yes' = 6, 'No' = 7
simretrycancel - 'Retry' = 4, 'Cancel' = 2
simapplicationmodal - Is an 'OK' box and returns '1'
simcritical - Messagebox containing the Warning
icon , returns '1'
simquestion - Messagebox containing the Question mark
icon, returns '1'
simexclamation - Messagebox containing the Exclamation
point icon, returns '1'
siminformation - Messagebox containing the Information
Icon, returns '1'
[Window Style Constants (SForm#.Chform)]
• Use the Integrated Window Styler on the project
explorer to generate and insert Form Style code with ease.
s_border -no form border
s_caption - no form caption bar
s_child - make a child form (ie as part of an MDI parent)
s_disabled - form is disabled
s_dlgframe - form is a dialog/tool window
s_group - form is part of a group
s_hscroll - form has horizontal scrollbars
s_maximize - form is maximized
s_maximizebox - disable and remove the form's maximize
button
s_minimize - form is minimized
s_minimizebox - disable and remove the form's minimize
button
s_overlapped - form cannot be overlapped as MDI child
s_popup - form is a popup window
s_sysmenu - remove the system menu and buttons from form's
caption bar
s_tabstop - tab is disabled to switch between active controls
on a form
s_visible - form is initially invisible
s_vscroll - form has vertical scrollbars
[Color Constants]
simwhite
simblue
simgreen
simmagenta
simblack
simyellow
1.3 Scripting Functions
Here are the built-in scripting functions:
SForm#.Chform [Window Style Constants]
Replace # with a number of the Form you want to change.
openfile "[filename]" "[input]or[output]"
Open a file [filename] for input or output
printinfile "[text]"
If the file was opened for output, then you can print something into this
file. Use "\n" for new lines.
getfromfile [variablename]
Gets the whole contents of a file and wraps it into the specified variable.
closefile
Closes a file. Do this after manipulating a file.
if "[Value]" == "[Value]"
{
}
else [Optional]
{
}
see also:
if "[Value]" != "[Value]"
if "[Value]" < "[Value]"
if "[Value]" > "[Value]"
stop
The script will stop here to process, but if a new event occurs, the new
function will be called.
goto [Label]
Goes to a defined label in the script such as: "IamALabel:"
• Labels are defined on one line with a case sensitive name ending with
a colon (:).
shell "[PathAndFile]"
Run a shell command such as: shell "C:\winnt\system32\command.com"
shellandwait.hide "[PathAndFile]"
Run a shell command invisibly and wait for it to finish
executing before continuing.
shellandwait.show "[PathAndFile]"
Run a shell command visibly and wait for it to finish executing
before continuing.
chdir "[Path]"
Changes the DOS path to [Path]
chdrive "[Drive]"
Changes the DOS Drive to [Path]
filecopy "[PathAndFile]","[PathtoAndFile]"
Copys a file from the [PathAndFile] to the new path [PathtoAndFile]
kill "[PathAndFile]"
USE CAUTION!
Delete a File. Wildcards may also be used ( *.txt - deletes ALL text files,
*.* - deletes ALL files)
mkdir "[Path]"
Make a new directory on the specified path.
rmdir "[Path]"
Remove [Path] directory. The directory must be empty to delete. Use the
Kill statement to delete the files within.
randomize
Randomize to get other results with the function rnd(Argument)
activateapp "[Caption]"
Activate an application or window by specifing its Titlebar Caption
dosout "[CommandLine]"
Executes a dos/console command line string and retrieves the value from
the STDIN/STOUT controllers.
end
Terminates the application!
unload
Unloads the current active Form
sendkeys "[Arguments]"
Send keys to the keyboard to type whitout typing ;)
call [FunctionName]
Calls an existing function you declared!
debugon
Shows all errors in the script!
debugoff
if you set this option no error will be popup! until you set doerros again!
beep
Beep
hangup
Disconnects a RAS connection
dragme
Makes the form surface 'draggable'
msgbox "[Message]",[Style],"[Caption]"
produces a messagebox > Warning! Also a callback function!
wait [milliseconds]
stops the program for a specified time.
[Console Commands]
init "[Console Caption]"
Initializes the Console Window.
color
"[Background as Console Colors]", "[Foreground as
Console Colors]"
Sets console background and foreground colors.
cls
Clears the screen.
sout "[Text]",
"[True/False-Terminate line
with NewLine]"
Prints text to the console.
sget [variablename]
Waits for input and stores the result in [variablename].
free
Free
the console window.
end
Terminates the console
application.
Console Colors - each of the following colors may be "brightened" by adding the letter "H" before them... (ie. Hblack, Hblue, Hred, Hwhite)
(i.e. STextBox.MaxLength = 3)
also there is:
screen.function
[Arguments]
**screen.height, screen.width, etc.
Copyright © 2000-2008. Simulanics Technologies. Matthew Combatti.
http://www.simulanics.com.
All Rights Reserved.