Page 1 of 1 1
Topic Options
#159781 - 2006-03-24 11:59 PM ERROR: Unknown Command [Writelog]!
Quenten Offline
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 Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
If I'm not mistaken you're missing the WRITELOG UDF

WRITELOG UDF
http://www.kixtart.org/ubbthreads/showflat.php?Cat=0&Number=82443
 

Top
#159783 - 2006-03-25 03:28 AM Re: ERROR: Unknown Command [Writelog]!
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Can't imagine then how he could have been using fine before. My guess is that the script was edited and that there is a misplaced quote or other such.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#159784 - 2006-03-25 04:55 AM Re: ERROR: Unknown Command [Writelog]!
Quenten Offline
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 Offline
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 Offline
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.
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#159787 - 2006-03-26 10:41 PM Re: ERROR: Unknown Command [Writelog]!
Quenten Offline
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
#159788 - 2006-03-26 11:50 PM Re: ERROR: Unknown Command [Writelog]!
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
At this point I think you need to post the ENTIRE script so that we can see where the error is coming from if you don't have the current training to debug it on your own.

We can only offer so many suggestions without seeing the complete code.

You can run the script yourself with the /d switch and step through it and see if you can find the error and what might be causing it too.

Top
#159789 - 2006-03-27 03:15 AM Re: ERROR: Unknown Command [Writelog]!
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Hoever, it is most likely not the UDF itself but a misplaced quote somewhere else. Unless, of course, the string you try to write with WriteLog contains quotes.
_________________________
There are two types of vessels, submarines and targets.

Top
#159790 - 2006-03-27 03:29 AM Re: ERROR: Unknown Command [Writelog]!
Glenn Barnas Administrator Offline
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! \:D

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 2220 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.072 seconds in which 0.037 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org