#159781 - 2006-03-24 11:59 PM
ERROR: Unknown Command [Writelog]!
|
Quenten
Fresh Scripter
Registered: 2004-06-12
Posts: 6
|
Hello All,
I've been using a UDF for some time now which is the code below but for some reason in the past few days its seems to have just stopped working.
Hears the Error Kix is coming back with
ERROR: Unknown Command [Writelog]!
I've tried commenting out the Writelog part but it then comes back with another error which is
ERROR: expected ')'!
on line 369 which is the line that has Code:
$RC = OpenFile(5, $file, 2)
Any ideas? 
Thanks, Quenten
Code:
Function GetIPinfo() ; Purpose: Return network info on a computer where EnumIPinfo() fails. ; Uses ipconfig or winipcfg depending on @INWIN. ; Returns an array of three values: IP Addr., SN Mask, and Default Gateway. dim $IPinfo[2], $file, $RC, $Line, $pos, $loop, $x
WriteLog("Gathering IP info using GetIPinfo()") $file = "%temp%\junk.txt" if @inwin=1 shell "%comspec% /c ipconfig >$file" else shell "winipcfg /batch $file" endif $RC = OpenFile(5, $file, 2) if $RC = 0 $Line=Readline(5) $loop = 1 WHILE (@ERROR = 0 and $loop = 1) if instr($Line, "IP") > 1 and instr($Line, ". . :") > 0 and right($Line, 7) <> "0.0.0.0" $x = 0 WHILE (@ERROR = 0 and $loop = 1) $IPinfo[$x] = substr($Line, instrrev($Line, ":")+2) if $x<2 $x = $x + 1 do $Line=ReadLine(5) until $Line <> "" or @error <> 0 else $loop = 0 endif LOOP else $Line=ReadLine(5) endif LOOP $RC=Close(5) del $file endif $GetIPinfo = $IPinfo Endfunction
|
|
Top
|
|
|
|
#159782 - 2006-03-25 12:22 AM
Re: ERROR: Unknown Command [Writelog]!
|
NTDOC
Administrator
   
Registered: 2000-07-28
Posts: 11634
Loc: Space
|
|
|
Top
|
|
|
|
#159784 - 2006-03-25 04:55 AM
Re: ERROR: Unknown Command [Writelog]!
|
Quenten
Fresh Scripter
Registered: 2004-06-12
Posts: 6
|
NTDOC thanks i'll give it a try..
Les,
Well for some reason it never errored before and has been in place for around 2 months go figure.....
Thanks, Quenten
|
|
Top
|
|
|
|
#159785 - 2006-03-25 05:12 AM
Re: ERROR: Unknown Command [Writelog]!
|
Quenten
Fresh Scripter
Registered: 2004-06-12
Posts: 6
|
I've just gone over my script and I've just realised why its probably been working fine for most machines as I have my ip details first trying to be collected by using EnumIPinfo() failing that it trys to use the UDF.
All of the machines I tested my script on only have one nic, appart from the two which it seems to be now failing on.
Anyway I'm still getting an error using this UDF it says on line 14 (of the UDF)
ERROR: expected ')'!
I thought maybe it could be how i'm calling the udf hears my code Code:
; Getting IP Address Info $IPaddr = EnumIPinfo(0,0) if $IPaddr = "0.0.0.0" or $IPaddr = "" $IPinfo = GetIPinfo() $IPaddr = $IPinfo[0] $SNmask = $IPinfo[1] $Gateway = $IPinfo[2] else $SNmask = EnumIPinfo(0,1) $Gateway = EnumIPinfo(0,3) endif
any ideas? From my limited kix knowledge the syntax looks right? Thanks, Quenten
|
|
Top
|
|
|
|
#159786 - 2006-03-25 05:29 AM
Re: ERROR: Unknown Command [Writelog]!
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
If it errors with unknown command at WriteLog, then either you do not have the WriteLog UDF in your script or you have an error calling it if it is an external file.
This type of error can also be caused by a misplaced quote elswhere in the script. The effect of that is to cause parts of the code no in a string to be considered to be part of a string thus missing some of the command constructs.
|
|
Top
|
|
|
|
#159787 - 2006-03-26 10:41 PM
Re: ERROR: Unknown Command [Writelog]!
|
Quenten
Fresh Scripter
Registered: 2004-06-12
Posts: 6
|
Sorry I should have mentioned that i was getting the error after i put the Writelog UDF in the script.
Which happend to be the same error if I just commented out the write log line.
Do you know if this particular udf works or maybe I need to try another UDF
Thanks, Quenten
Edited by Quenten (2006-03-26 10:42 PM)
|
|
Top
|
|
|
|
#159790 - 2006-03-27 03:29 AM
Re: ERROR: Unknown Command [Writelog]!
|
Glenn Barnas
KiX Supporter
   
Registered: 2003-01-28
Posts: 4402
Loc: New Jersey
|
You might try the Sanity UDF, which will catch most mismatched single & double quotes and parens.
The easiest way to run the Sanity tool is to download the KixDev package from my web site. This ZIP file includes many UDFs, as well as the KGEN tool. Put the 2 KGEN Scripts and Kix32.exe in a folder (you can skip kix32 if it is available via your PATH.) Put a copy of your script into that folder and rename it to a .txt extension (ie - test.txt). Run KGEN TEST (or whatever the name of your script file is, without the .txt extension). KGEN will display any warnings detected by parsing your script file, including undeclared args, duplicate arg definitions (local + global), and args declared but not referenced, in addition to the quote and paren matching.
Of course, the big advantage of KGEN is that if you copy all your UDF files to a folder and reference that folder in the KixLibPath environment variable, KGEN will figure out which UDF files are needed by your project, and automatically generate a .KIX file from your base script and all needed UDFs. (That's why it starts with a .txt file.)
There will also be some log files generated in that folder, reporting the errors, variable usage, etc.
Glenn
_________________________
Actually I am a Rocket Scientist!
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 2220 anonymous users online.
|
|
|