Automation with Scripts


For the automation of the hamster the use of Scripten offers itself. On this page here I would like to describe the hamster-own Scriptsprache and to point examples out for the use of * vbs and * to pl Scripten.

Meanwhile a small file developed to the Scripten for the WSH and Perl. This file needs now a new page, which is to be found here: The Script archive

By the use of the hamster-own Scriptsprache, which is constantly developed further by Juergen Haible, it is possible to let the hamster operate independently. Since Hamster-1.3.17 there is a new Hamsterscriptsprache, which will replace the old here avowed Scriptsprache in later future. This Scripte appears likewise in the Scriptarchiv, since they can be nevertheless very extensive.

Instruction Assertion with example
quit The execution of a Scriptes stops
restart The Script starts again from the front.
call A further Script starts within a Scriptes. If the Sub Script is terminated, the Ausgangsscript is continued to execute.
Example: call " scriptname.hsc "
wait.delay A number of milliseconds waits (1/1000 second).
Example: wait.delay 5000 (waits 5 seconds)
wait.until Waits up to the set point in time. The time must be indicated in the format " hh.mm " (hour minute).
Example: wait.until 02,00 08,00 12,00 18,00 21.00
wait.idle Waits, to all current processes, for example: mail.pull, news.pull etc. are terminated.
mail.pull Starts a Unterprozess, which gets first Mails of the Mailserver and transmits then Mails, if Mails are available. If after mail.pull no variable is set, all POP3 and SMTP server entered in the hamster are included. If a variable is set, also only this server is used. 
If several servers are entered, they are by semicolons from each other to separation those server must be exactly the same written, as in the list of the hamster adjustments (server name + "," + port).
Examples: mail.pull
mail.pull " mail.aaa.com, pop3;mail.bbb.com, pop3;mail.aaa.com, smtp "
fetchmail Starts a process, which gets Mails of the indicated POP3-Server. (server, port). If user (user) and password (pass) are indicated, they are used with the Login for the server. If nothing is entered, the passwords are used, which are entered with the respective servers into the hamster Settings. 
Also the extra user/passwords can be used under file/configuration/password (User="$(number) ", pass =""). a user under " DestUser " are indicated, to become the fetched Mails in the mailbox of this user stored, otherwise in " the admin" mailbox.
Examples:
fetchmail " pop3.serv.er " " " " " " " " " 
fetchmail " pop3.serv.er " " pop3 " " john.doe " " secret " " John "
fetchmail " pop3.serv.er " " 10110 " " $7 " " " " jane "
sendmail A process, the Mails starts to the indicated SMTP server transmits (server, port). If with " FromSelection " nothing is entered, all Mails is transmitted out../hamster/Mails/Mail.Out /. With " FromSelection " if an Mail address is entered (regular expression), only the Mails is transmitted, with which the " Envelope From " corresponds. That is the line quite above in the Mail, which look in such a way: !MAIL From: mymail@provider.com (who opened already times a Mail in /Mail.Out /, knows, what I mean)
Examples: 
sendmail " smtp1.serv.er " " smtp " " more john\.doe@serv\.er " 
sendmail " smtp2.serv.er " " " " "
news.post Starts a process, which postet new articles to the new server, if which in /News.Out / are situated. Made behind news.post no entry, all NNTP servers are used, which are indicated in the hamster. Even if servers are indicated, only these are used. (server, port)
Example: news post office " "
news.post " news1.serv.er, nntp;news2.serv.er, NNTP "
news.pull Starts a process, which fetches new articles from the new server. One makes behind news.pull no entry, all NNTP servers are used, which are indicated in the hamster. Even if servers are indicated, only these are used. (server, port)
Example: news.pull " news1.serv.er, nntp;news2.serv.er, NNTP "
news.purge Starts the " Purge process ", it wants to mean that in the volume of data one clears up. With a parameter behind it can be determined, with which data is to be cleared up
Examples:
news.purge (without specification of a number the entire volume of data, as under the Settings, is timed gepurged)
news.purge X
X=Zahl of 1-7 (1 = only article, 2 = only History entries, 3 = articles and History, 4 = only Killfile log entries, 5 = articles and Killfile log entries, 6 = History and Killfile log entries, 7 = all options deletes)
news.rebuildhistory Starts a process, which deletes and on the basis the Message ID's of the available articles in the volume of data structures the available History (" \Groups\Hist40?.dat ") again.
Note: This process needs some time and should be only started, if it is really necessary. Absolutely set a wait.idle behind this instruction!
news.rebuildgloballists /server/allpulls.txt and /server/alldescs.txt structure the files again, which are needed for subscribing new groups with their day LINES.
setlogin temporarly the user and its password for a data-communications connection or a server (Mail or News) sets. It means temporary that these adjustments are not stored in a file, but only in the memory remains, until the hamster is again closed. If instead of the user and/or the password a question mark is set ("?"), hamster asks if necessary for that necessary entry. Also here the extra user/passwords (" $1 ") cannot be used thereby the data openly readably in the file to be located.
Example:
setlogin " data-communications connection " " M.Meier " " secret! "
setlogin " more news.serv.er " " DoeJane " " 42 "
setlogin " more mail.serv.er " " $11 " " "
ras.dial this function structures a data-communications connection. The user name and the password can be also empty-let. Then the data are used, which are stored under file/configuration/passwords in the respective data-communications connection. Is to be paid attention to accurate way of writing data-communications connecting names! If the connection establishment fails, the Script stops.
Example:
ras.dial " data-communications connection " " user name " " password "
ras.dial " data-communications connection "
ras.hangup closes the data-communications connection, which was structured by racing dials.
Example: ras.hangup
msgbox a message window with the indicated message opens.
xample: msgbox " Script terminated "
start.wait starts an external program. The Script waits, until this program is terminated.
Example: start WAIT " before dial.bat "
start.nowait functioned like start WAIT, with the difference that the Script does not wait, until the program is terminated.
Example: start.nowait " after connected.bat "
message calls some functions from the hamster menu ' file ' and ' local '.
1 terminates the hamster (file/exit)
2 resetting Counter and log (file/cClear counters+log)
3 0=stop, 1=start start/stop local NNTP server
4 0=stop, 1=start start/stop local POP3-server
5 0=stop, 1=start start/stop local SMTP server
6 0=verstecken, 1=zeigen hide/shows main window
7 0=verstecken, 1=zeigen
hide/shown Tray Icon of examples: message 2 - or message 3 0

These instruction meaningfully linked result in many possibilities, which are to be partly described now. Behind the lozenge (#) the respective comment is to it. It is most favorable, if the collecting main (demo Default.hsc) is used. This must be edited and renamed however. You can give these * hsc Scripte its own name to everyone, so that you also detect it, if you call it in the hamster over Script/scriptname.hsc. Importantly: The Scripte can be called only if she were again started in the hamster directory to be situated and the hamsters after creation of a new Scriptes. demo default.hsc is grey deposited thereby and cannot not be used.

Beispielscripte:

# Script: Default.hsc (Mail&News get and transmit)

# wait, until all current processes are terminated:
wait.idle

# entire News article supply clear up
news.purge

# wait, until clearing up is terminated:
wait.idle

# data-communications connection to T-Online manufacture
ras.dial "T-Online PPP"

# Mails fetch/transmit and new articles transmit, afterwards wait:
mail.pull
news.post
wait.idle

# News fetch and then wait, until it is terminated:
news.pull
wait.idle

# data-communications connection separate
ras.hangup

 

# Script: P+P.hsc (only News get and transmit)

# wait, until all current processes are terminated:
wait.idle

# data-communications connection to T-Online manufacture
ras.dial "T-Online PPP"

# new article transmit and wait:
news.post
wait.idle

# new articles fetch and wait:
news.pull
wait.idle

# data-communications connection separate
ras.hangup

 

# Script: Post.hsc (only News transmit)

# wait, until all current processes are terminated:
wait.idle

# data-communications connection to T-Online manufacture
ras.dial "T-Online PPP"

# new article transmit and wait:
news.post
wait.idle

# data-communications connection separate
ras.hangup

 

# Script: MailStunde.hsc (each hour of Mails fetches and transmits)

# wait, until all current processes are terminated:
wait.idle

# data-communications connection to T-Online manufacture
ras.dial "T-Online PPP"

# Mails fetch, transmit and wait:
mail.pull
wait.idle

## data-communications connection separate
ras.hangup

# one hour wait and the Script still times from the front start
wait.delay 3600000
restart

 

# Script: MailFetchSend.hsc (Mails of certain servers fetch/transmit)

# wait, until all current processes are terminated:
wait.idle

# data-communications connection to T-Online manufacture
ras.dial "T-Online PPP"

# Mails of GMX only fetch, Mails at T-Online only transmit and wait:
fetchmail "pop.gmx.net" "POP3" "User" "Password" ""
sendmail "mailto.btx.dtag.de" "SMTP" "micha-wr@t-online\.de"
wait.idle

# data-communications connection separate
ras.hangup

 

# Script: Message.hsc (post/fetch with temporarly deactivated local servers)

# wait, until all current processes are terminated:
wait.idle

# data-communications connection to T-Online manufacture
ras.dial "T-Online PPP"

# Mails of GMX only fetch, Mails at T-Online only transmit and wait,
# off beforehand the local SMTP server switch, thus nobody more Mails flow blank
message 5 0
fetchmail "pop.gmx.net" "POP3" "User" "Password" "admin"
sendmail "mailto.btx.dtag.de" "SMTP" "micha-wr@t-online\.de"
message 5 1
wait.idle

# News post and fetch, beforehand local NNTP server deactivate:
message 3 0
news.post "news.btx.dtag.de,nntp"
news.pull "news.btx.dtag.de,nntp"
message 3 1

# data-communications connection separate
ras.hangup

Here I thank you still times for the initiative of Michael sounding hatchet, which supported this page with the Scripten lively and. Who would like itself to take part, transmit nevertheless simply still some * HSC Beispielscripte by Mail to me, so that I can take up her on this page with.

 

with the VB Scripten is similar it, only that with this type of Scripten the possibilities are much larger. In the hamster directory a file is situated named ' demo session.vbs ', which represents the standard file for the use of this type of Scripten. Open this file thus in a text editor (note PAD) and edit it in the crucial places under ' Preferences ', since the data are defined there to the a selection by data-communications. Example:

'Demo-Session.vbs

'Preferences
Const RASDIAL_CONNECTION     = "T-Online PPP"     'Name of RAS-conn; "" = disable dialing
Const RASDIAL_USERNAME       = ""   'Username for RAS-conn; "" = use Hamster-setting
Const RASDIAL_PASSWORD       = ""          'Password for RAS-conn; "" = use Hamster-setting
Const PURGE_BEFORE_TRANSFER  = False      'True = enable purging

'[...]

In order to be able to operate with VB Scripten, the Windows Scripting host is necessary. These can download yourself you on the web page of Microsoft. In the installation of the Internet Explorers 5 participates this also according to standard.

The exact start page to the WSH: MS Windows Scripting Host

In Scripts archive you find many VB Scripte, which already created different. You can let the Scripte execute also time-controlled, if you merge her in the task planner.

 

Hamster can be controlled also with Perl Scripten. In addition a Beispielscript is situated named ' demo session.pl ' in the hamster directory. This must be edited likewise still in the correct places.

# Demo-Session.pl

use Win32::OLE;
use Win32::Event;

# Preferences
$RASDIAL_CONNECTION = "T-Online PPP"; # Name of RAS-conn; "" = disable dialing
$RASDIAL_USERNAME = ""; # Username for RAS-conn; "" = use Hamster-setting
$RASDIAL_PASSWORD = ""; # Password for RAS-conn; "" = use Hamster-setting
$PURGE_BEFORE_TRANSFER = 0; # 1 = enable purging

# [...]

In order to be able to use the Perl Scripte, you must install a Perl interpreter. These can download yourself you for example of http://www.activestate.com .


Accounts| autoscripts| configuring| Links| mail filters| newsreader| OE5faq| scoring| scripts| Settings| tips| tools
New English Help Files | Hamster Index