Professional Documents
Culture Documents
GUIDE
Location in script tree (Required)
Example: [Dashboard\Toyota\Corolla - 93C56]
Must always be started with a "[" and end with a "]" and must use backslash "\" there is no semicolon used.
Notes: If 2 or more entries appear of the same name on the same tier, the first one located will be the only one
shown, e.g. you had a second file pointing to [Dashboard\Toyota\Corolla - 93C56] then the scripts file name is used
to sort, and whichever one comes alphabetically first will be displayed,
This is also true for 2 files on the same tier, (Dashboard would be tier 1, Toyota tier 2, and so on). so say you had a
file pointing to [Dashboard\Honda\Corolla - 93C56] (No such vehicle exists its only an example), as it comes first, the
vehicle listed under Toyota would not be shown, this is something to be aware of with your naming convention.
Size (Required)
Example: Size(280,320);
the2 numbers must be separated by a comma "," and must be followed by a semicolon.
Notes: The size of the apply and close buttons must be added to the size of the form, they are 40 pixels high, and to
not be cut off the form should be at least 240 pixels wide
The area they take up along the bottom expands as wide as you make the form remaining centered,
A neat looking padding is about 5 pixels between groups and the edges of the form.
Script Info
Example: !This script was written by me.
Must start with "!" does not require anything after it, only works one line at a time, but can be used as many times as
you would like.
This is the text shown in the Info tab while viewing the script tree, It will be displayed followed by the file location of
the script file
Notes: A space is automatically added at the start of the text when displayed, and adding an additional line with
only a "!" following your text separates it nicely from the file location.
Script Picture
Example: @brain.bmp
@Toyota\brain.bmp
@C:\\Users\brain.bmp
Must start with "@" does not require anything after it, only the first use will be shown
This is the image shown in the image tab of the script tree, It will be scaled to fit in the tab, by default it points to the
Doc directory inside the ETsmart folder, however it also works for folders inside the Doc directory and for files
located elsewhere on your computer.
Must start with a "#" does not require anything after it, only the first use will be shown
When used an additional hyperlink will appear at the top of the form saying "Additional Information" this link can be
used to open any file type on your computer, with the limitation that it ignores anything after the file type, so
"brain.exe" will work "brain.exe -s" will not, you can however work around this by pointing it to a batch file.
Note that it cannot open folders, at this time there is no known way to open a folder
Execute:
Form (Required)
Example:
Form
{
Group("Mileage",5,5,140,50)
{
Digit(Distance," ",5,18,90);
Label(lb1,"Km",110,20);
}
}
Must start with the word "Form" followed by "{" and ended with "}"
This part describes the how you will be displaying the various groups, text and functions that will make up the user
interface to your calculator, these functions will be discussed in further detail below, inside this function like all
functions, you want to make sure the number of opening brackets is equal to the number of closing brackets.
Group
Example:
Group("Mileage",5,5,140,50)
{
Digit(Distance," ",5,18,90);
Label(lb1,"Km",110,20);
}
Must start with the word "Group" followed by a "(" and ended with ")"
This draws an outlined box to group various text or number boxes, checkboxes, etc. all items inside of it are
referenced to the group box as opposed the form.
Picture
Example: Picture(Logo,"Toyota.bmp",180,5,0,0);
Must start with the word "Picture" followed by "(" and ended with ");"
By default references the folder: Etsmart\Calculators\Pictures , This function can be used as many times as you
please, but in general is used to display the Manufacturers logo or script authors logo.
Currently the only valid image types are BMP, and Jpeg / jpg.
Label
Example: Label(lb1,"Km",110,20);
Must start with the word "Label" followed by "(" and ended with ");"
By default the text entered in quotes will be shown, however you can assign it to show any text you like later on in
the program, (Discussed later). if you have 2 labels that overlap, the one referenced last will sit on top of the one
referenced earlier.
Digit
Example: Digit(Distance," ",5,18,90);
Must start with the word "Digit" followed by "(" and end with ");"
Creates a field that only numbers can be displayed or entered into, Can be used as many times as you like.
If the variable is never given a value in the software it will remain blank and show no value.
Hexdigit
Example: Hexdigit( Pin," ",5,38,50,6);
Must start with the word "Hexdigit" followed by "(" and end with ");"
Creates a field that only hexadecimal can be displayed or entered into, Can be used as many times as you like.
If the variable is never given a value in the software it will remain blank and show no value.
String
Example: String(Vin," ",5,58,110);
Must start with the word "String" followed by "(" and end with ");"
Creates a field that text can be displayed or entered into, Can be used as many times as you like. data entered into it
must be ascii characters.
Checkbox
Example: CheckBox(Write,"Write Hours",70,140);
Must start with the word "Checkbox" followed by "(" and end with ");"
Draws a checkbox that can be used to control or show an on/off, yes/no option.
If the variable is never given a value in the software it will show unticked.
Combobox
Example: ComboBox(Type,"Type",20,25,120,"Tachometer","Speedometer");
Must start with the word "Combobox" followed by "(" and end with ");"
Draws a drop down combo box that can be used to present a list of selectable text options,
Listbox??
Onshow
This part of the software is run when the calculator is first opened and only runs once, generally it is used for things
like reading the current mileage off the bin file, and testing whether the file is valid,
OnChange
This part of the software is run whenever the calculator is opened and the user selects or edits anything in the hex
file, could be used for something like calculating a files checksum while you edit something not added to the script.
OnApply
This part of the software is run whenever the apply button is pressed, this part generally runs the bulk of the
calculation, writing back your edited value
In all 3 of the above segments any variable not controlling something in Form will not carry across to another, so
setting Var1 = 20; in onshow, then trying to read it in onapply will not work, if you want to accomplish something like
this, add a digit, hexdigit, or string that can hold what you require and offset it outside of the form.
Any code outside of these 3 areas will be ignored, meaning you can use it for large text blocks,
Updating Text
Example: Message = "Hello";
Message = "Hello" + " " + "World";
Message = #i.Var1;
Message is the variable being modified
At the most basic level, the first example makes the label display the word hello,
Following the second example you can combine bits of text, say in a part number, you need to add a letter in
the middle; you can do it using this method
For the third example, the scripts have the option of combining hex or a variable to a few different outputs:
You can mix and match these, e.g. "Vin: " + #c.Var1 + #c.Var2 + #c.Var3 + " " and so on,
Notes: For the conversion options, the letters must remain lower case
Colour
Example: Message.Color = 0xFF0000;
The 6 hex numbers represent the 3 colour channels, red green and blue. It can only be used on labels
Bold
Example: Message.Bold = 1;
0 = Regular
1 + = Bold
Alignment
Example: Message.Alignment = 1;
Bit math
To move around and modify values, there are a few functions to help
AND "&"
And is used to mask of one number from another, e.g. Var1 = 0x123456 & 0xFF; Would return 0x56 because the
larger part of the number does not match the mask, to make it more clear involves looking in binary, 0xF is 1111 in
binary, in other words if you where to and it with any single digit hex value it would pass, if you say picked 0x7 as
your mask (0111 in binary) any number greater than 7 would be cropped off.
OR "|"
Or is used to combine values together, commonly used in the shift left example. e.g. Var1 = 0x1234 | 0xFFFF; would
return 0xFFFF, or Var1 = 0x1030 | 0x0204; would return 0x1234, To look at it in binary, 0x4 is 0100, anf 0xF is 1111,
so when "Or'd" together, the 1's in F fill the 0's and you have 0xF returned.
XOR "^"
Xor is used to invert numbers or in checksum's, the most common use is Var1 = 0x1234 ^ 0xFFFF; to invert a number,
in this case it is similar to writing Var1 = 0xFFFF - 0x1234; however there is a benefit in that if instead the number
was larger say 0x12345, it would return an unexpected value as the number will wrap around rather than become a
negative, becoming something like 0xFFFFDCBA,
The proper use of Xor is that were ever 2 bits in the same location are equal it returns a 0, where they are not equal
it returns a 1, e.g. Var1 = 0xF ^ 0xA; 1111 ^ 1010 returns 0101 or 0x5.
Reading and Writing
Example: @0x00 = 1;
Var1 = @0x00;
To read or write a value in etsmart you need to use "@" to tell it to treat it as a location rather than a value,
In both cases it only reads or writes 1 byte at a time, and the lowest byte for writes, e.g. @0x00 = 1234; would write
0x34,
Variables
Example: Var1 = 0;
you can treat variables like buckets to store data, you can fill or empty a bucket to a given value, or fill another
bucket to match the same value, but in this same respect changing the value of one will not affect any of the others,
and if you don't assign a value to one before using it, it can upset things as you don't control how much you started
with.
In most cases you will be using "Var" to define all your variables, this is a reserved word and it will treat Var followed
by any number as a variable, e.g. Var1001, however you can also use any variables you set up in your form, e.g. Vin.
The largest value a variable can hold is 0xFFFF FFFF FFFF FFF, leading zero's before this are ok, but adding a 16th digit
will make it overflow, and should the last value be F, will fail,
Mismatch
Example: @0x00.mismatch = 1;
Controls whether a byte is high-lighted as a mismatch from the original, by default the bytes will change colour, but
this can be used to force a byte to remain the normal colour,
VAR
STR
DIM
IF
ELSE
WHILE
Page
pagecontrol
ts
DIM?
!=
<=