Hamster-SKripte: functions (general)
Function groups:
Functions bzgl. Variables
Numeric functions
Zeichenketten/String-functions
Datum/Zeit-functions
Mistake treatment
Files and catalogues
List
Input and issue
Zeitgeber/Scheduler
DFÜ-network
Other functions
Functions bzgl. Variables
Sets (< variable >, < expression >)
<Variable> = <expression>
If the <variable> places on the value <expression>.
If <expression> can also be written as a <variable> =.Return value: result of <expression>
Var ($a)
Sets ($a, 42)
$a = 42
Varset (< variable >, < expression >)
If a variable declares. In contrast to 'Var' the value
can be assigned of the variables with 'varset' also immediately by <expression>See also "var"
Return value: result of <expression>.
VarSet ($a, 42)
Inc (< variable >, < count >)
Inc (< variable >)
Dec (< variable >, < count >)
Dec (< variable >)
Raises or
decreases <variable> around the amount from <count> or around 1 if <count> is not given(indicated).Return value: raised or decreased
<variable>Inc ($a)
Dec ($a, 2)
Numeric functions
True
Represents the logical Worth true.
Return value: 1
$a = true
False
Represents the logical Worth wrong.
Return value: 0
$a = false
Isint (< expression >)
Tests whether the expression of the type Int is.
Return value: True=Wahr or False=Falsch
$result = iif (isint ($a), $a, 0)
Int (< expression >)
If a character string converts in a numeric honorable value. If the character string begins with the marks " 0x ", she is considered as hexadezimal coded.
Return value: honorable variable. If the character string contains no honorable value, it is returned 0.
$a = "1"
$b = 2
$c = $a + $b * - > "12"
$d = int ($a) + $b * - > 3
Print (int (" 0xFF ")) * - > 255
Paragraph (< number >)
Supplies the amount without forerunner from <number>.
Return value: Honorable.
Print (paragraph (42)) * - > 42
Print (paragraph (-42)) * - > 42
Sgn (< number >)
Supplies-1 if <number> is negative, +1 if <number> is positive and 0 if <number> 0 is.
Return value: Honorable.
Print (sgn (42)) * - > 1
Print (sgn (-42)) * - >-1
Zeichenketten/String-functions
Isstr (< expression >)
Test whether the expression of the type String is.
Return value: True=Wahr or False=Falsch
$result = iif (isstr ($a), $a, " 0x " +hex ($a))
Ord (< string >)
If supplies ASCII-code of the first mark of a character string.
Return value: number of the ASCII-code or 0 if <string> is empty.
Print (ord ("*")) * - > 42
Chr (< number >)
If the ASCII-mark supplies in the position <number> and is therefore the counterfunction from "ord".
Return value: character string with a mark.
Print (chr (42)) * - > "*"
Str (< number >, < length >, < leadchar >)
...
Str (< number >)
Converts a nummerischen value to a character string. If the length <length> exists, the character string is filled up from the left beginning with the mark <leadchar> on the given length. (Standard for < leadchar > is "0").
Return value: String.
$a = 42
Print (str ($a)) * - > "42"
Print (str ($a, 5)) * - > "00042"
Print (str ($a, 5, " ")) * - > "42"
Practise witchcraft (< number >, < digits >)
Practise witchcraft (< number >])
Converts a numeric value to a character string in hexadezimaler manner of writing. If the value <digits> exists, the character string with the mark "0" is filled up.
Return value: character string.
$a = 42
Print (practise witchcraft ($a, 42)) * - > " 002 A "
Print (int (" 0x " + practise witchcraft (42))) * - > 42
Len (< string >)
If supplies the length of a character string
Return value: Honorable.
Print (len ("ABC")) * - > 3
Pos (< substr >, < string >, < startpos >])
Pos (< substr >, < string >)
If the position of the partial character string <substr> supplies in the character string <string>. If a start position <startpos> is given(indicated), it is searched from these positions in the character string.
Return value: position or 0, if partial character string not found.
Print (pos ("b", "abcde")) * - > 2
Print (pos ("b", "abcde", 3)) * - > 0
Copy (< string >, < startpos >, < length >])
Copy (< string >, < startpos >)
If supplies a partial character string <string> from position <startpos> with the length <length>. If the length <length> is not given(indicated), the rest(remainder) of the character string is supplied.
Return value: character string.
Print (copy ("abcde", 3, 1)) * - > "c"
Print (copy ("abcde", 3)) * - > "cde"
Delete (< string >, < startpos >, < length >])
Delete (< string >, < startpos >)
Deletes in the character string <string> from position <startpos>. If the length <length> is not given(indicated), all marks are deleted up to end of the character string, apart from that soviele marks as given(indicated).
Return value:: character string.
Print (delete ("abcde", 3, 1)) * - > "abde"
Print (delete ("abcde", 3)) * - > "from"
$s = delete ($s, 1, 1) * delete 1st char of $s
Trim (< string >, < trimchars >)
Trim (< string >)
Removes all leading and following marks in the character string <string>, as far as they are contained in <trimchars>. Lacks <trimchars>, all leading and following blanks are removed.
Return value:: character string.
Print (trim ("42")) * - > "42"
$WHITESPACE = " " + chr (9)
Print (trim ($line, $WHITESPACE))
Lowercase (< string >)
If the character string <string> converts in small letter.
Return value: character string.
Print (lowercase ("AbCd")) * - > "abcd"
Uppercase (< string >)
If the character string <string> converts in capital letter.
Return value: character string
Print (uppercase ("AbCd")) * - > "ABCD"
Replace (< string >, < find >, < replace >, < all >, < ignorecase >)
...
Replace (< string >, < find >, < replace >)
Addiction and replaces for the character string <find> in the character string <string> with the character string <replace>. If value is <all> True=Wahr, all found character strings are replaced, apart from that only the first occurence. If is the value <case> True=Wahr it is not considered big / kleinschreibweise.
Return value: character string
Print (replace ("abcABCabc", "b", " [X] ")) * - > " a [X] cABCabc "
Print (replace ("abcABCabc", "b", " [X] ", true)) * - > " a [X] cABCa [X] c "
Print (replace ("abcABCabc", "b", " [X] ", true, true)) * - > " a [X] approx. [X] Approx. [X] c "
Eval (< string >)
Applies the content of the character string <string> as a numeric expression and supplies the result back.
Return value: Honorable
Print ("4" + "+" + "2") * - > "4+2"
Print (eval ("4" + "+" + "2")) * - > 6
RE_Match (< string >, < regex >)
If supplies TRUE if <string> fits to the regular expression (PCRE). Indication: capitalization and use of small letters is ignored normally.
Return value: TRUE (1) or FALSE (0)
$answer = "abc4efg2hij"
If (RE_Match ($answer, " 4.2"))
Print ("OK".)
Endif
RE_Extract (< string >, < regex >)
Supplies the part from <string> which fits to the regular expression (PCRE-style). Indication: capitalization and use of small letters is ignored normally.
Return value: character string (is empty if nothing was found)
$answer = "abc4efg2hij"
Print (RE_Extract ($answer, " 4.2")) * - > " 4efg2 "
Print (RE_Extract ($answer, "A.*C")) * - > "ABC"
Print (RE_Extract ($answer, " (?-i) A.*C ")) * - > " "
RE_Parse (< string >, < regex >, < var1 > [, <var2>...])
Divides <string> in groups according to the regular expression. The groups are stored in the separate variables <varX>. Indication: capitalization and use of small letters is ignored normally.
Return value: TRUE (1): =OK, FALSE (0): = mistake
$line = " Subject: This is a test "
RE_Parse ($line, " (\S +:)\s + (. *) ", $a, $b) * - > $a = " Subject: ", $b = " This is a test "
RE_Split (< string >, < regex >, < var1 >, < var2 > [, <var3>...])
If a character string splits in separate sections according to the regular expression on. The sections are stored in the separate variables <varX>. Indication: capitalization and use of small letters is ignored normally.
Return value: TRUE (1): = OK, FALSE (0): =Fehler
$line = " this is a test "
RE_Split ($line, "+", $a, $b) * - > $a = "This", $b = " is a test "
RE_Split ($line, "+", $a, $b, $c) * - > $a = "This", $b = "is", $c = " a test "
Time-functions
Quirks
If the time supplies in Millisekunden since the start of Windows.
Return value: Honorable.
$start = quirks
*.
$stop = quirks
Print (" time: ", $stop - $start, "ms".)
Times
If the current time in the Unix supplies format. (Seconds since the 01/01/1970)
Return value: Honorable
$now = times
$yesterday = $now - 2460*60
Timegmt
If the current GMT in the Unix supplies format. (Seconds since the 01/01/1970)
Return value: Honorable
$nowgmt = timegmt
Decodetime (< times >, < yyyy >, < mm >, < dd >, < hh >, < nn >, < ss >, < wd >)
...
Decodetime (< times >, < yyyy >)
Kovnvertiert the Unix - time format year, month, day, hour(lesson), minute, second and weekday. Variables: <yyyy> (year), <mm> (months), <dd> (day), <hh> (Grant respite), <nn> (minute), <ss> (second), <wd> (day week; 1=Sonntag..., 7=Sonnabend).
Return value: <times>
Var ($hrs, $min, $sec)
Decodetime (times, 0, 0, 0, $hrs, $min, $sec)
Print (" Current time: ", $hrs, ":", $min, ":", $sec)
Encodetime (< yyyy >, < mm >, < dd >, < hh >, < nn >, < ss >)
If the Unix-time supplies back. Parameter: <yyyy> (year), <mm> (months), <dd> (day), <hh> (Grant respite), <nn> (minute), <ss> (second)
Return value: <times>
Encodetime (2000, 12, 31, 23, 59, 59)
Mistake treatment
ErrCatch (< on/off >)
ErrCatch
With <on/off> like TRUE (< > 0) becomes the internal mistake business abgeschalte. Then the hamster does not finish the script in the mistake case. In this case measures must be met in the script to the mistake treatment to mistake treatment. Of the mistake status "ErrNum" can be questioned by the script with the function, in case of a mistake a value incomparably becomes a zero zurückgeliefert.
Return value: 0 / False: Switched off (standard; if script in the mistake case), 1 / stops True: Turned on
$OldErrCatch = ErrCatch
ErrCatch (True)
Print (42/0) * division by zero causes error
If (ErrNum < > 0)
Print (" Error: ", ErrNum, " ", ErrMsg)
Endif
ErrCatch ($OldErrCatch)
ErrNum
If the last mistake number supplies back.
Respect: the mistake numbers are dependent on version.
Return value: Honorable (=0:Kein mistake, < > 0: mistake)
If (ErrNum < > 0)
*.
Endif
ErrMsg
If the last mistake message supplies back.
Return value: character string
Print (ErrMsg)
ErrModule
Supplies the name of the module which has caused the mistake.
Return value: character string
Print (ErrModule)
ErrLineNo
Liefer the number of the line which has caused the mistake.
Return value: Honorable
Print (ErrLineNo)
ErrLine
If supplies the line which has caused the mistake.
Return value: character string: String
Print (ErrLine)
ErrSender
Supplies the name of the script-object which has caused the mistake.
Return value: character string
Print (ErrSender)
Files and catalogues
Execute (< cmdline >, < workdir >, < show >, < wait >, < exitcode >)
If the program <cmdline> incl. if necessary suspended parameters starts in the working directory <workdir>. The variable <show> fixes the qualities of the program window. (0=unsichtbar, 1=normal, 2=minimiert, 3=maximiert). If the variable <wait> is like True=Wahr, the script waits for the end of the called program, otherwise the execution of the script is continued directly, while the called program works in the background. The variable <exitcode> contains the ending code of the called program.
Return value: Honorable (0=Kein mistake, < > 0=Fehler)
Execute (" notepad.exe myfile.cfg ")
IniRead (< filename >, < section >, < ident >, < default >)
Select from the .INI-file <filename> from the section <section> the value of the key <indent>. If no file name is given(indicated), the file "HScripts.ini" is applied. If no section <section> is given(indicated), the section " [all] " is applied. If the wished entry is not contained in the INI-file, becomes the value <default> zurückgeliefert.
Return value: character string
$answer = IniRead ("MyScript.ini", "answer", "last", "42")
$LastConnected = int (IniRead (" ", """, LastConnected ", 0))
IniWrite (< filename >, < section >, < ident >, < value >)
Places or changes in the INI-file <filename> in the section <section> the value for <ident> on the new value <value>. If no file name is given(indicated), the file "HScripts.ini" is applied. If no section <section> is given(indicated), the section " [all] " is applied.
Return value: character string
IniWrite ("MyScript.ini", "answer", "last", $answer)
IniWrite (""" ",", LastConnected ", times)
FileExists (< filename >)
Tests whether the file exists <filename>. The jokers "?" And "*" are admitted in the file name.
Return value: Honorable (1=existiert, 0=ist not existing(exist))
If (! Fileexists ("myfile.cfg"))
Error (" Wrong configuration! ")
Endif
FileSize (< filename >)
If the length of the file <filename> supplies in bytes.
Return value: Honorable (-1 in the mistake case)
Print (FileSize (HamPath + "Hamster.exe"))
File time (< filename >)
If the time of the last writing access to the file <filename> supplies in the Unix-format.
Return value: Honorable (-1 in the mistake case)
Print (" Your Hamster's age: ", times - file time (HamPath + "Hamster.exe") ", seconds ")
FileDelete (< filename >)
If she deletes file <filename>.
Return value: 0: OK, < > 0: mistake
FileDelete ("MyScript.tmp")
FileRename (< oldname >, < newname >)
If the file <oldname> names in <newname> around.
Return value: 0: OK, < > 0: mistake
FileRename ("MyScript.dat", "MyScript.bak")
FileCopy (< oldname >, < newname >)
If the file <oldname> copies to <newname>.
Return value: 0: OK, < > 0: mistake
FileCopy ("MyScript.dat", "MyScript.bak")
DirExists (< dirname >)
Tests whether the catalogue <dirname> it exists. Provided that no absolute path is given(indicated), the relative information refers to the current working directory.
Return value: Honorable (1=existiert, 0=nicht existing(exist))
If (! Direxists ("mydir"))
*.
Endif
DirMake (< dirname >)
If a catalogue with the name <dirname> creates. Provided that no absolute path is given(indicated), the relative information refers to the current working directory.
Return value: 0: OK, < > 0: mistake
DirMake (HamPath + "MyScript")
DirRemove (< dirname >)
If this deletes catalogue <dirname> if it is empty. Provided that no absolute path is given(indicated), the relative information refers to the current working directory.
Return value: 0: OK, < > 0: mistake
DirRemove (HamPath + "MyScript")
DirChange (< dirname >)
If the catalogue <dirname> places as a current working directory.
Indication: It is more meaningful normally to apply instead absolute catalogue information.
Return value: 0: OK, < > 0: mistake
DirChange (HamPath + "MyScript")
DirCurrent
If the current working directory supplies back.
Return value: character string
Print (DirCurrent)
DirWindows
Liefer the name of the Windows-catalogue.
Return value: character string
Print (DirWindows)
DirSystem
Liefer the name of the Windows system-catalogue.
Return value: character string
Print (DirSystem)
See also: ListLoad, ListSave, craft files, ListDirs.
List
ListAlloc (< sorted >, < duplicates >)
...
ListAlloc
If a new list creates and supplies the associated trades back. Of this trades is expected as a parameter in all other lists-functions. Before the script end it must be released again by means of "ListFree" to avoid warehouse holes.
If the variable <sorted> is like TRUE (< > 0), the list is automatically sorted on adding new entries. If <duplicates> is like TRUE (< > 0), double entries are allowed, only once otherwise entries are taken(accepted) in the list. Indication: presupposition for the duplicate-recognition is a sorted list.
Return value:: > =0: Act for the list,-1: too many lists openly.
$list = ListAlloc
ListFree (< craft >)
If the list deletes and gives their(her) storage space and the trades again freely. See also "ListAlloc".
Return value: 0: OK,-1: acts incorrect
Listfree ($list)
ListExists (< craft >, < index >)
ListExists (< craft >)
Tests whether this trades to craft <craft> is valid and - provided that given(indicated) - whether the entry No <index> exists in the list.
Return value: 1 / True: validly; 0 / False: invalid
Sub DoSomethingWithList ($list)
If (! ListExists ($list)
Error (" list lacks! ")
Endif
*.
Endsub
ListClear (< craft >)
Deletes all entries of a list.
Return value: 0: OK;-1: acts incorrect
ListClear ($list)
ListCount (< craft >)
If supplies the number of the lists entries.
Return value: Honorable
Print (ListCount ($list))
ListGet (< craft >, < index >)
Supplies a lists entry to the Index <index>. The counting of the entries begins with 0 and goes to ListCount-1.
Return value: character string (empty, if entry No < index > not existed)
$i = 0
While ($i < ListCount ($list))
Print ($i, ":", ListGet ($list, $i))
Inc ($i)
Endwhile
Craft sets (< craft >, < index >, < value >)
Craft sets (< craft >, < index >)
Sets the lists entry with Index <index> on the value <value>. If the corresponding lists entry should not exist yet, he is put on what allows the use of a craft as an Array-substitute. Should be handed over nobody <value>, the entry receives a Leerstring assigned.
Return value: <value>
Craft sets ($list, 42, " The answer! ")
ListGetTag (< craft >, < index >)
If the "day" supplies quality of the lists entry with No <index>. This quality exists in addition to character string content of every lists entry and contains a number. If so far not set, becomes 0 zurückgeliefert.
Return value: Honorable
$entry_itself = ListGet ($list, 42)
$tag_of_entry = ListGetTag ($list, 42)
Craft set day (< craft >, < index >, < sit >)
If the "day" sets variable for the lists entry with the Index to No <index>.
Return value: <sit>
$index = ListAdd ($list, " The answer! ")
Craft set day ($list, $index, 42)
ListGetKey (< craft >, < key >)
If the list contains character strings in the form of "Schlüssel=Wert", this function supplies the value to the key <key>.
Return value: character string
* Sea(lake) example under ListSetKey
ListSetKey (< craft >, < key >, < value >)
ListSetKey (< craft >, < key >)
If the list contains character strings in the form of "Schlüssel=Wert", this function sets the value to the key <key> on <value> or on an empty character string.
Return value: <value>
$list = ListCreate
ListSetKey ($list, "RTFM", " Read the f... Manual! ")
ListSetKey ($list, "SCNR", " Sorry, could riveted resist! ")
Print (ListGetKey ($list, "SCNR"))
ListAdd (< craft >, < value >)
ListAdd (< craft >)
Adds at the end of the list a lists entry.
Return value: Index of the new entry.
$index = ListAdd ($list, $text)
ListDelete (< craft >, < index >)
Deletes the lists entry with the Index <index>, the remaining entries walk correspondingly.
Return value: 0
$index = ListAdd ($list, $text)
ListInsert (< craft >, < index >, < value >)
ListInsert (< craft >, < index >)
Inserts a lists entry with the Index <index> of the list <craft> with the content <value>, the following entries move correspondingly.
Return value: 0
ListInsert ($list, 0, $text)
Craft place (< craft >)
If she sorts list <craft>.
Returns: 0
Craft place ($list)
Craft set text (< craft >, < text >)
If she deletes list <craft> and adds the text <text> in lines separated by CR+LF of the list.
Return value: <text>
Craft set text ($list, $article)
Print (ListGet ($list, 0)) * - > the First line from $article
ListGetText (< craft >)
Supplies the content of the whole list as a character string, besides the separate entries (lines) of the list are separated only with CR/LF of each other.
Return value: character string
$article = ListGetText ($list)
ListIndexOf (< craft >, < value >)
Addiction in the list the entry <value> and supplies his(its) Index back.
Return value: > =0: Index,-1: not found
Craft set text ($list, $article)
$EndOfHdr = ListIndexOf ($list, " ")
ListLoad (< craft >, < textfile >)
If the list <craft> fills with the content of the text file <textfile> in lines.
Return value: 0: OK,-1: list incorrectly or file not found
ListLoad ($list, "MyScript.cfg")
ListSave (< craft >, < textfile >)
If the list <craft> stores in the text file <textfile>.
Return value: 0: OK,-1: list incorrectly
ListSave ($list, "MyScript.cfg")
Craft files (< craft >, < filemask >, < fullpath >)
Craft files (< craft >, < filemask >)
If the list <lists> fills with the file names from the catalogue <file-mask>.
If the variable <fullpath> is like TRUE (< > 0), the files inclusive path are specified, otherwise only the file names.
Return value: > =0: OK (number of the files), < 0: file (en) not found
Craft files ($list, HamPath + " Mails\Mail. Out\*.msg ", true)
ListDirs (< craft >, < filemask >, < fullpath >)
ListDirs (< craft >, < filemask >)
If the list <lists> fills with the catalogue names from the catalogue <file-mask>.
If the variable <fullpath> is like TRUE (< > 0), the complete paths are specified, otherwise only the catalogue names.
Return value: > =0: OK (number of the catalogues), < 0: catalogue (e) not found
ListDirs ($list, HamPath + " Mails\*. ")
ListRasEntries (< craft >)
If the list fills with DFÜ-Netzwerk-Einträgen (telephone directory of the DFÜ-network).
Return value: > =0: OK (number of the entries), < 0: list incorrectly
Var ($RasConnection)
$RasConnection = SelectRasConnection
If ($RasConnection < > " ")
Print ("chooses", $RasConnection)
*.
Endif
Quit
Sub SelectRasConnection
Var ($RasList, $RasSelIndex, $RasSelName)
$RasSelName = " "
$RasList = ListAlloc
If (ListRasEntries ($RasList) > 0)
$RasSelIndex = craft box ($RasList, " select them(her): ")
If ($RasSelIndex > = 0)
$RasSelName = ListGet ($RasList, $RasSelIndex)
Endif
Endif
ListFree ($RasList)
Return ($RasSelName)
Endsub
Input and issue
Print (< text > [, <text>...])
Spends the contained text in the hamster's protocol. (Black on knows).
Return value: <text>.
Print (" And the correct answer is: ", $answer)
Warning (< text > [, <text>...])
Causes same like 'print', however, the text is yellow lays under and looks thereby more remarkable
Return value: <text>.
Warning (" brain malfunctioning! No ideas more! Example terminiert! ")
Addlog (< text >, x [, ZeigeSkriptname])
Causes same like 'print', only the sort of the entry with the variables x can be fixed arbitrarily. The parameter ZeigeSkriptname whether the script name with in the log appears.
Valid values for x:
1=Debug,
2=Detail,
3=Info,
4=System,
5=Warning,
6=Error
Return value: <text>.
Warning (" brain malfunctioning! No ideas more! Example terminiert! ")
MsgBox (< text >, < caption >, < designs >)
...
MsgBox (< text >)
If indicates a text box with the text <text> and the heading <caption>.
<Design> fixes the type and the switches(counter) of the text box. (Standard: "information" and "OK" switch(counter)).
Types: 0x40 (information), 0x30 (warning), 0x20 (question), 0x10 (mistake)
Switch(counter): 0x0 (OK), 0x1 (OK+Abbrechen), 0x2 (Abbrechen+Wiederholen+Ignorieren), 0x3 (Ja+Nein+Abbrechen), 0x4 (Ja+Nein), 0x5 (Wiederholen+Abbrechen)
For the preselection of the switches(counter): 0x100 for the second switch(counter) 0x200 for the third switch(counter).
Return value: 0 = (mistake), 1=OK, 2=Abbruch, 3=Abbruch, 4=Wiederholen, 5=Ignorieren, 6=Ja, 7=Nein
If (MsgBox (" What is your(their) question? ", " ", 0x20|0x4) = 6)
Error (" Unexpected answer. ")
Else
MsgBox (" Forget it... ")
Endif
Input box (< text >, < caption >, < default >, < code >)
...
Input box (< text >)
Indicates in a text input box the text <text> with the heading <caption>. The input line becomes with the text <default> vorbelegt.
If the variable <code> after return is 1 (True) became the switch(counter) OK otherwise the switch(counter) "break off" operates.
Return value: character string (empty if switch(counter) "Break off" was operated.
$answer = input box (" What's the answer...? ", """, 42 ", $ok)
InputPW (< text >, < caption >, < default >, < code >)
...
InputPW (< text >)
Indicates in a text input box the text <text> with the heading <caption>. The input line is represented with the text <default> vorbelegt, but with asterisk veiled.
If the variable <code> after return is 1 (True) became the switch(counter) OK otherwise the switch(counter) "break off" operates.
Return value: character string (empty if switch(counter) "Break off" was operated)
$answer = input box (" What's the answer...? ", """, 42 ", $ok)
Craft box (< craft >, < text >, < caption >, < default >, < code >)
...
Craft box (< craft >, < text >)
If indicates a craft box with the text <text> and the heading <caption> and allows the choice from the list <craft>. The variable <default> fixes which lists entry vorausgewählt is indicated. Standard is-1, of the same meaning with " No preselection ".
If the variable <code> after return is 1 (True), the switch(counter) OK was operated, otherwise the switch(counter) "Break off".
Return value: Index of the selected entry.
Var ($list, $selindex)
$list = ListAlloc
ListAdd ($list, "41")
ListAdd ($list, "42")
ListAdd ($list, "43")
$selindex = craft box ($list, " What's the answer...? ")
Print (iif ($selindex=1, " Correct! ", " Wrong! "))
ListFree ($list)
Zeitgeber/Scheduler
AtClear
Deletes all entries of the Schedulers.
Return value: 0
* Sea(lake) example under AtAdd
AtAdd (< subname >, < from >, < til >, < wdays >, < repeat >, < immediate >)
...
AtAdd (< subname >, < from >)
Adds to the Scheduler an entry.
The variable <subname> must contain the name auszuführenden Subroutine (see also "sub") which should be implemented to the gewüschten moment.
The variables <from> and <til> must contain the period in the "HH.MM" format in which the Subroutine should be implemented cyclic.
The variable <wdays> must contain the Wochenentage as seven marks long character string in which the Subrotiene is to be implemented. Every mark May implement the condition 1 (=Ausführen) or 0 (=nicht) accept and represents - beginning with Monday - a weekday.
The variable <rep> must contain the time interval during minutes after which the execution the Subroutine should be repeated.
The variable <immediate> decides whether the Subroutine is started immediately on adding or only at the end of the time for the first cycle. Standard is True = " immediately starting ".
Indication: a cycle always begins with the current minute
Return value: Index for the Schedulereintrag.
AtClear
AtAdd (getmails, "00:00", "06:00", "1111100", 60, true)
AtAdd (getmails, "06:00", "18:00", "1111100", 15, true)
AtAdd (getmails, "18:00", "24:00", "1111100", 60, true)
AtAdd (getmails, "12:00", " ", "0000011")
AtAdd (getnews, "03:15")
AtAdd (getnews, "18:45")
AtExecute
Quit
Sub getmails
*.
Endsub
Sub getnews
*.
Endsub
AtExecute (< time-out >)
AtExecute
Waits, since one the Subroutinen which were added with "AtAdd" to the Scheduler, a value has incomparably run off(expired) 0 zurückliefert or to which in the variables <time-out> fixed time.
Return value:-1=timeout, > 0:Rückgabewert the Subroutine implemented finally.
* Sea(lake) example under AtAdd
DFÜ-network
RasGetConnection
Supplies denNamen of the current network-connection DFÜ back.
Return value: character string (empty if not existing(exist)).
Print (RasGetConnection)
RasIsConnected
Tests whether a network-connection DFÜ exists(consists).
Return value: 1 (True) if, 0 (False) if no.
If (! RasIsConnected)
* Dial.
Endif
RasDial (< name >, < user >, < fit >, < connid >)
...
RasDial (< name >)
If a network-connection DFÜ with the name
<name> places under use of user's name <user> and password <fit> here. Then the variable <connid> contains the trades for the connection. The name of the network-connection DFÜ already must under "workplace" - have been defined > "DFÜ-network" (telephone directory of the network DFÜ). (Big manner of writing and small manner of writing pay attention)Indication: this function does not become from the password - to specific functions of the hamster supports! Moreover the functions "HamRasDial" and "HamRasHangup" would have to be applied instead.
Return value: 0:Verbindung constructed; > 0: mistake-code of the DFÜ-network;-1:DFÜ network does not install
$try = 1
While (RasDial ("MyProvider", "MyUsername", "MyPassword")! = 0)
If ($try > = 3)
Error (" Dialing failed! ")
Endif
Inc ($try)
Sleep (10000)
Endwhile
RasHangup (< connid >)
RasHangup
Finishes network-connections DFÜ. If the variable <connid> is not given(indicated), become all DFÜ - finishes connections.
Return value: 0: OK; > 0: mistake-code;-1: DFÜ-network does not install
RasHangup
RasGetIP
If she supplies (in most cases dynamic) IP-address which has been assigned while connecting on the DFÜ-network by the provider.
Return value: IP-address as a character string (empty if not existing(exist)).
Print (RasGetIP)
See the also function: ListRasEntries
Other functions
Iif (< condition >, < true-result >, < false-result >)
If the result of the expression <true-result> supplies back if the condition <condition> is true, otherwise the result of the expression <false-result>.
Return value: result according to the condition <condition>.
Print (iif ($Antwort = "42", " correct! ", " wrong! "))
Icase (< value >, < compare1 >, < result1 > [, <c2>, <r2>...])
If the variable <value> compares to the value <compare1> and supplies - if identically - the result <result1> back. Otherwise become all combinations < compare * > / < result * >-durchgetestet. >-die character string "Else" can be used for the value < compare * as a special value. The result belonging to it becomes zurückgeliefert when no fitting value < compare * > was found for the variable <value>.
Returns: result <result> or 0 if no value < compare * > for the variable <value> was found and no Else's-twig was applied.
$word = icase ($digit, _
0, "Zero", 1, "One", 2, "Two", 3, "Three", 4, "Four", _
5, "Five", 6, "Six", 7, "Seven", 8, "Eight", 9, "Nine", _
Else, " user, we have a problem! " _
)
Gosub (< identifier >)
If the program execution branches out to the Subroutine with the label "label". The Subroutine must be finished with the order "return".
Return value: return value the Subroutine.
Print (gosub (test))
Quit
Label (test)
*.
Return (42)
Paramcount
If the number supplies with the script by the start handed over parameter
Paramstr (< index >)
Supplies these, to the script by the start vomitted, parameter with the running number <index> back. Besides, the first parameter has the Index '1', with '0' becomes the script name zurückgeliefert