\ File: signature.spf (nnCron 1.88 or higher required) \ Date: 03.04.2003 \ Updated: 19.04.2005 (uptime_counter uses the new UPTIME word from time.spf plugin) \ Author: Valery Kondakoff (strauss@orc.ru) \ Description: This plugin defines new words, which write different info \ to a user specified text files. Later you can include any of these \ text files in your outgoing mail along with your signature (cookies). \ Currently you can play with: \ - your OS info and system up time \ - how many days remains to user specified date \ - how manu days were passed from user specified date \ - nnCron version info \ Have fun! \ Usage: \ writing system up time and OS info to a specified text file: \ S" filename" uptime_counter \ Example: \ #( test_uptime_counter \ NoLog \ Rule: PROC-EXIST: "thebat.exe" \ PROC-EXIST: "Xnews.exe" \ PROC-EXIST: "gedcyg.exe" OR OR \ Action: \ S" c:\temp\uptime.txt" uptime_counter \ )# \ counting the days remaining to (passed from) the specified date \ and writing the result to a file: \ S" user defined string" S" filename" day_counter \ Examples: \ #( test_day_counter \ OnceADay \ Action: \ 2002 12 31 S" Next New Year will come in " \ S" c:\temp\day_counter.txt" day_counter \ )# \ \ #( test_day_counter1 \ OnceADay \ Action: \ 2001 12 31 S" Passed since last New Year: " \ S" c:\temp\day_counter1.txt" day_counter \ )# \ writing nnCron version to a user specified text file: \ S" user defined string" S" filename" nncron_version \ Example: \ #( test_nncron_version \ Time: START-TIME \ Action: \ S" I'm using nnCron " S" c:\temp\nncron_version.txt" nncron_version \ )# \ defining WIN > OEM char encoding conversion word C" WIN2OEM" FIND NIP 0= [IF] : WIN2OEM ( a u -- a u ) 2DUP SWAP DUP CharToOemBuffA DROP ; [THEN] \ typesaver-word : N>PAD N>S PAD +ZPLACE ; \ checking if the time.spf plugin is loaded C" UPTIME" FIND NIP 0= [IF] WINAPI: QueryPerformanceCounter KERNEL32.DLL WINAPI: QueryPerformanceFrequency KERNEL32.DLL : UPTIME ( -- sec) 0 0 SP@ QueryPerformanceCounter DROP SWAP 0 0 SP@ QueryPerformanceFrequency DROP NIP UM/MOD NIP ; [THEN] \ writes system up time to a specified text file : uptime_counter \ getting up time UPTIME DUP >R 60 MOD \ SECONDS R> 60 / DUP >R 60 MOD \ MINUTES R> 60 / DUP >R 24 MOD \ HOURS R> 24 / \ DAYS \ creating output string S" OS: " PAD ZPLACE WinVersionString PAD +ZPLACE crlf PAD +ZPLACE S" System Up Time: " PAD +ZPLACE N>PAD \ DAYS S" days, " PAD +ZPLACE N>PAD \ HOURS S" hours, " PAD +ZPLACE N>PAD \ MINUTES S" minutes, " PAD +ZPLACE N>PAD \ SECONDS S" seconds." PAD +ZPLACE PAD ASCIIZ> 2SWAP FWRITE ; \ writing nncron version to a specified file : nncron_version 2SWAP \ saving the string that will be displayed before the version info PAD ZPLACE SVERSION PAD +ZPLACE PAD ASCIIZ> \ uncomment next line if you need WIN2OEM encoding conversion \ WIN2OEM 2SWAP FWRITE ; : day_spelling \ Russian language: >R R@ 10 MOD 1 > R@ 10 MOD 5 < AND R@ 100 MOD 11 > R@ 100 MOD 15 < AND NOT AND IF S" дня" ELSE R@ 10 MOD 1 = R@ 11 <> AND IF S" день" ELSE S" дней" THEN THEN R> DROP \ English language: \ 1 = \ IF \ S" day" \ ELSE \ S" days" \ THEN ; : day_counter 2SWAP PAD ZPLACE >R >R YMD>DATE CUR-DATE DATE- DUP 0< IF NEGATE THEN DUP N>S PAD +ZPLACE day_spelling PAD +ZPLACE PAD ASCIIZ> \ uncomment next line if you need WIN2OEM encoding conversion \ WIN2OEM R> R> FWRITE ;