nncron.tab examples

nnCron and nnCron LITE discussion

nncron.tab examples

Postby papa_san » Tue, 01 Mar 2005, 15:05

Hi everybody

I would like to know if there is a place with a lot of example cron tasks?

I don't have a forth background and find the syntax very difficult to understand.

My preferred way to learn is by example :)

I'm especialy interested in working with string variables and find that this is not straight forward if you have a perl / vb background.

Most examples are only with numeric value's.

Here's a non functioning task that should start tasks and set parameters based on the location where my laptop gets connected.

A small batch get's my default gateway (more elegant way surely exists ) and then I try to do a case statement


#( task_00001
NoActive
CREATE location_gw 256 ALLOT
Action:
StartIn: "D:\Program Files\nnCron"
SWHide NormalPriority
START-APPW: "%COMSPEC% /c ipgw.bat > ipgw.txt"
PAUSE: 1000
PAD 54 S" ipgw.txt" FREAD location_gw PLACE
location_gw COUNT 37 /STRING location_gw PLACE
\ here I hope location_gw is still on the stack
CASE
"147.151.72.226" OF
5000 BalloonTime !
1 BalloonIcon !
BALLOON: "WhereAmI" "At work: Location1"
ENDOF
"10.170.32.1" OF
5000 BalloonTime !
1 BalloonIcon !
BALLOON: "WhereAmI" "At work: Location2"
ENDOF
"10.170.102.1" OF
5000 BalloonTime !
1 BalloonIcon !
BALLOON: "WhereAmI" "At work: Location3"
ENDOF
"10.170.46.254" OF
5000 BalloonTime !
1 BalloonIcon !
BALLOON: "WhereAmI" "At work: Location4"
ENDOF
"169.192.1.1" OF
5000 BalloonTime !
1 BalloonIcon !
BALLOON: "WhereAmI" "At home: good2Bhere!"
ENDOF
DUP OF
5000 BalloonTime !
1 BalloonIcon !
BALLOON: "WhereAmI" " Im somewhere else! %location_gw COUNT%"
ENDOF
ENDCASE

)#


The forth code I find on the internet looks entirely different again from what I find in my crontab.

Regards,

Papa
papa_san
 
Posts: 1
Joined: Tue, 01 Mar 2005, 14:35

Postby VK » Tue, 01 Mar 2005, 15:31

I was trying to put as much examples as possible in the nnCron docs. In fact every important word in the docs has an useful example.

Your task will not work because CASE ... OF ... ENDOF ... ENDCASE works with numerical values, not with strings.

Try to use one of the words which are described in these topics: http://www.nncron.ru/help/EN/add_info/f ... tr_compare or http://www.nncron.ru/help/EN/add_info/f ... #str_works .
CU
VK
User avatar
VK
 
Posts: 680
Joined: Wed, 14 Jul 2004, 19:17

convert IP

Postby kakmyc » Fri, 03 Jun 2005, 10:16

Your task will not work because CASE ... OF ... ENDOF ... ENDCASE works with numerical values, not with strings.


You can convert dot-delimited IP to 4-byte number.
kakmyc
 
Posts: 1
Joined: Fri, 03 Jun 2005, 10:13


Return to nnCron forum (English)

Who is online

Users browsing this forum: No registered users and 1 guest

cron