how do I get the $1, $2 ... variables into "usable"

nnCron and nnCron LITE discussion

how do I get the $1, $2 ... variables into "usable"

Postby LuckMan212 » Sun, 20 Nov 2005, 23:29

this is a supplemental question to my other question from last topic:
please help me with this simple problem.. I am confused about accessing the values of these variables and am obviously doing something wrong!! :?
Code: Select all
#( test_regexp2
NoActive
AsLoggedUser
SingleInstance
VARIABLE size_in_mb
2VARIABLE size
Action:
RE-MATCH: "c:\temp\folder:500:0" "/(.*):(\d+):(\d)/"
IF
   MSG: "$0 = %$0%" \ $0 = entire string
   MSG: "$1 = %$1%" \ $1 = folder name
   MSG: "$2 = %$2%" \ $2 = megs
   MSG: "$3 = %$3%" \ $3 = bool, 1=always check or 0=only check if procsNotRunning

   RECURSIVE DIR-SIZE: "%$1%" size 2!
   size 2@ 1048576 UM/MOD size_in_mb ! DROP
   %$2% size_in_mb @ <                       <--- this line doesn't work!
   IF
      \ folder > `$2` mb, now fork
      %$3% 1= IF                             <--- this line also doesn't work!!

      \ ... 'always check' flag is ON
      \ ... do something ...

   ELSE

      \ ... do something else ...

   THEN
THEN
)#

please help!! :cry:
LuckMan212
 
Posts: 133
Joined: Mon, 04 Jul 2005, 11:19

Postby Valery_Kondakoff » Mon, 21 Nov 2005, 00:35

Remove the percent signs when you are using postfix notation.
http://www.nncron.ru/help/EN/add_info/f ... m#evaluate

HTH!
CU
VK
User avatar
Valery_Kondakoff
Site Admin
 
Posts: 769
Joined: Thu, 01 Jul 2004, 20:49
Location: Moscow, Russia

Postby LuckMan212 » Mon, 21 Nov 2005, 01:14

remove the % signs? you mean like
Code: Select all
$2 S>NUM cur_quota !
no this does not work for me at least when I tried it I got an error.

I did find a way that works however:
for example if I use
Code: Select all
RE-MATCH: "%cur_line COUNT%" "/(.*):(\d+):(\d)/"
IF
   S" %$1%" EVAL-SUBST cur_folder PLACE
   S" %$2%" EVAL-SUBST S>NUM cur_quota !
   S" %$3%" EVAL-SUBST S>NUM force_check !
ELSE
   MSG: "Error found while parsing the following line:%crlf%%crlf%` %$0% `"
THEN

Yes this works for me but is it the "correct" way?? I am trying to learn the correct/proper/most efficient way to code these tasks so just because something works does not mean it is the "right" way..

I thank you for your time :lol:
LuckMan212
 
Posts: 133
Joined: Mon, 04 Jul 2005, 11:19


Return to nnCron forum (English)

Who is online

Users browsing this forum: No registered users and 3 guests