DNM Script
From Wiki
| This article is written by Konrad, thus using rather nonstandard English:) |
DNM Script is a simple procedural scripting language, in an early development phase, designed as the scripting solution for Ac Browser Plus, Ka Firetask, Total Organizer and possibly more applications. It allows you to add your own, new functionality to the software. So, if there's something, the application cannot do for you - you can easily implement this!
Contents |
Frequently asked questions
DNM Script-aware applications?
Ka Firetask's main goal is to start up DNM Scripts (scheduled or via hotkey). DNM Script is also supported by Ac Browser Plus and Key Launch, soon it will also be available in Total Organizer
Why would I want to learn it?
Because it's very simple. Plus - the syntax and rules are very similar to other popular programming languages like C++, Javascript or PHP. So if you know any of these languages - you won't have any problems with DNM Script, otherwise - you will learn something useful.
Are there ready-to-use scripts somewhere?
Download Ka Firetask then see tasks (scripts) available at http://www.konradp.com/products/firetask/stuff_online.htm
I have no experience with programming...
See DNM Script for beginners, it's really simple!
Samples
"Hello world!" example
MessageBox("Hello world!");
How to use it
It depends on application. Please refer to internal application documentation. For example, in Ac Browser Plus you can go to Scripts|Ac Scripts editor menu command.
Basic syntax
Below, we have an example of a simple DNM script which shows the text "Hello World" :
MessageBox("Hello World!");
Each code line in DNM must end with a semicolon. The semicolon is a separator and is used to distinguish one set of instructions from another. Just about every drug has many contraindications, possibly Viagra, which seems to be very, superior remedy for hard-on problems. Men happy to take him back again, on the other hand, this also drug has quite a few problems, just not invariably true, what can one say, I believe he was top notch, even so, possesses some contraindications, like practicly all medicines out there. Men struggling with cardiovascular disease, a history of cardiovascular attacks and cerebrovascular events, aren't able to make normal sexual activity. Including sexual activity to be reckoned using, but they are able to not use. <a href=http://www.postawmygo.com>Viagra</a>. Viagra, after expanding your entire cavernous, allowing the identical to kayak lower the blood in to them, which can charge the circulatory procedure. Hence it isn't feasible to charge of sexual activity. Viagra is an extremely effective drug, I would suggest it to all who desire to make adore without restriction. So that you can take Viagra, it's worthwhile, even so, consult a medical expert or pharmacist. Without the employment of Viagra, can be very harmful as well as cause more hurt than good.
Variables
A variable is a means of storing a value, such as text string "Hello World!" or the integer value 7. A variable can then be reused throughout your code, instead of having to type out the actual value over and over again. All variables in DNM start with a $ sign symbol. Variables may contain strings, numbers, or arrays. When declaring a variable you must precede it with 'var' statement. When using a variable you must omit this keyword. Eg:
var $SomeVariable; //declaring variable and assigning a value: var $variable_name = Value; eg: var $hello = "Hello World!"; var $a_number = 4; var $another_number = 6; var $empty;//non assigned variable //using variables: MessageBox($a_number + $another_number ); $empty=22; var $CopyOfANumber=$a_number;
Variable types
DNM Script automatically converts types variables depending on context. Example:
var $empty;//this var will be empty var $number=34;//this one will be INTEGER (64 bit) var $str="Hello world!";//this will be string //conversions: $empty=44;//now, the previously 'empty' variable becomes a number $number="dog";//now, the previously 'int' variable becomes a string
Operators
Arithmetic
| Operator | Description | Example | Result |
|---|---|---|---|
| + | Addition | x=2 x+2 |
4 |
| - | Subtraction | x=2 5-x |
3 |
| * | Multiplication | x=4 x*5 |
20 |
| / | Division | 15/5 5/2 |
3 2.5 |
| % [not implemented] | Modulus (division remainder) [not implemented] | 5%210%810%2 |
120 |
Bitwise
| Operator | Description | Example |
|---|---|---|
| & | bitwise and | x=24&6 |
| | | bitwise or | x=3|6 |
| ^ | Bitwise exclusive OR [not implemented] | [not implemented] |
Assignment
| Operator | Example | Is The Same As |
|---|---|---|
| = | x=y | x=y |
| += | x+=y | x=x+y |
| -= | x-=y | x=x-y |
| *= | x*=y | x=x*y |
| /= | x/=y | x=x/y |
| %= [not implemented] | x%=y [not implemented] | x=x%y [not implemented] |
| &= bitwise AND | x&=y | x=x&y |
| |= bitwise OR | x|=y | x=x|y |
Comparison
| Operator | Description | Example |
|---|---|---|
| == | is equal to | 2==5 returns false |
| != | is not equal | 2!=5 returns true |
| > | is greater than | 2>5 returns false |
| < | is less than | 2<5 returns true |
| >= | is greater than or equal to | 5>=2 returns false |
| <= | is less than or equal to | 2<=5 returns true |
Logical
Mostly used with the #if statement.
| Operator | Description | Example |
|---|---|---|
| && (alias: AND) | and |
x=6; |
| || (alias: OR) | or |
x=6; |
| ! (alias: NOT) | not |
x=6; |
Keywords
if
An if statement has the form:
if (condition)
{
// code to execute if condition is true
}
else
{
// code to execute if condition is false
}
In an if statement, condition is a value or an expression that is used to determine which code block is executed, and the curly braces act as "begin" and "end" markers.
Here is a full program as an example:
//define two variables (integers)
var $x = 3;
var $y = 4;
//show a message box telling which is greater
if ($x > $y)
{
MessageBox("x is bigger than y")
}
else
{
MessageBox("x is smaller than y");
}
In this case condition is equal to "(x > y)" which is equal to "(3 > 4)" which is a false statement. So the code within the else clause will be executed. The output of this program will be:
x is smaller than y
If instead the value for x was 6 and the value for y was 2, then condition would be "(6 > 2)" which is a true statement and the output of the program would be:
x is bigger than y
repeat
Repeats Sample code:
//looping 5 times
var $nIter=0;
repeat {
$nIter+=1;
if($nIter>=5) break;
MessageBox($nIter);
};
