Page 1 of 2 12>
Topic Options
#32834 - 2002-11-20 12:24 AM Creating and writing into a .log file
BrianK Offline
Getting the hang of it

Registered: 2002-10-02
Posts: 90
Loc: Amsterdam, The Netherlands
Probably easy for some, but not the case for me ... [Confused]

What i want is that upon logon a LSERVER.LOG is created on the client somewhere, that holds the value of their @LSERVER (and perhaps later some more info).

I've searched the board and came across the WriteLog () and WriteLog2 () UDF's, but i am almost certain that these UDF's surpass the objective i'm after...

Can someone confirm this, and point me in the right direction?

Thanx in advance.

Brian
_________________________
Rodney Dangerfield: “My mother didn't breast-feed me. She said she liked me as a friend.”

Top
#32835 - 2002-11-20 12:29 AM Re: Creating and writing into a .log file
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
most of the log writers ppl use do use ini-files as they don't need open() and close()

anyway, lets go with question, which one you want:
writeprofilestring() > ini-file
writeline() > text-file
echo > text-file with command-interpreter
redirectoutput > text-file generated by kix on everything you pass to consolewindow
_________________________
!

download KiXnet

Top
#32836 - 2002-11-19 01:05 PM Re: Creating and writing into a .log file
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
I may be good to surpass the current requirement with useful code because you know that requirements change and get more demanding. Once in place, these functions give you the functionality you you need now and in the future.

[ 19. November 2002, 13:05: Message edited by: Howard Bullock ]
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#32837 - 2002-11-19 02:10 PM Re: Creating and writing into a .log file
BrianK Offline
Getting the hang of it

Registered: 2002-10-02
Posts: 90
Loc: Amsterdam, The Netherlands
That is true Howard, but then i will probably try that in the near future. For now i am lookin for a way, to create a local text or ini file or watever, in which the current LogonServer is listed. Nothing more nothing less.

I've tried the writeprofilestring and writeline, but can't get it to work.
For writeprfilestring I tried:
code:
  
$rc=writeprofilestring("c:\temp\test.ini","LogonServer","@Lserver")

It creates the file, but leaves it empty. Obviously i am not getting the picture here. Some help would be appreciated.

Thanks,

Brian
_________________________
Rodney Dangerfield: “My mother didn't breast-feed me. She said she liked me as a friend.”

Top
#32838 - 2002-11-19 02:24 PM Re: Creating and writing into a .log file
Waltz Offline
Seasoned Scripter

Registered: 2002-08-01
Posts: 485
Loc: Waterloo, Ontario, Canada
quote:
Syntax: WriteProfileString ("file name", "section", "key", "string")

code:
$rc=writeprofilestring("c:\temp\test.ini","LogonServer","Servers","@Lserver")  

_________________________
We all live in a Yellow Subroutine...

Top
#32839 - 2002-11-19 02:34 PM Re: Creating and writing into a .log file
BrianK Offline
Getting the hang of it

Registered: 2002-10-02
Posts: 90
Loc: Amsterdam, The Netherlands
Waltz,

I copy 'n pasted your code into a test.kix and ran it, but still... it creates the test.ini in the TEMP folder, but doesn't put any info in it.

Any suggs?

B.
_________________________
Rodney Dangerfield: “My mother didn't breast-feed me. She said she liked me as a friend.”

Top
#32840 - 2002-11-19 02:55 PM Re: Creating and writing into a .log file
Waltz Offline
Seasoned Scripter

Registered: 2002-08-01
Posts: 485
Loc: Waterloo, Ontario, Canada
If @LServer is returning '', then the 'key' gets deleted in the ini file.
code:
dim $IniFile,$IniSection,$IniKey,$IniStr
;
$IniFile="c:\temp\test.ini"
$IniSection="LogonServer"
$IniKey="Servers"
$IniStr=@Lserver
;
$IniFile?
$IniSection?
$IniKey?
$IniStr?
;
If Exist($IniFile)
$rc=writeprofilestring($Inifile,$IniSection,$IniKey,$IniStr)
If $rc=0
"Function success"?
Else
"Function failure "+@error+" "+@serror?
EndIf
Else
"Ini file not found"?
EndIF

_________________________
We all live in a Yellow Subroutine...

Top
#32841 - 2002-11-19 02:58 PM Re: Creating and writing into a .log file
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Why do you need to keep track of the logon server?

What's the error code when you run Waltz script?
_________________________
There are two types of vessels, submarines and targets.

Top
#32842 - 2002-11-19 03:06 PM Re: Creating and writing into a .log file
BrianK Offline
Getting the hang of it

Registered: 2002-10-02
Posts: 90
Loc: Amsterdam, The Netherlands
Hmm... not quite sure what should happen here, but it's still not doing what I want. When running your piece of code, this is the output it produces in the dosbox:
code:
 
P:\Public\Tijdelijk\NetLogonCopy>kix32 test
c:\temp\test.ini
LogonServer
Servers

Function success

However, the test.ini (which by the way must be in place before running the script) stays empty.

Does it work at your end?

Brian
_________________________
Rodney Dangerfield: “My mother didn't breast-feed me. She said she liked me as a friend.”

Top
#32843 - 2002-11-19 03:10 PM Re: Creating and writing into a .log file
Waltz Offline
Seasoned Scripter

Registered: 2002-08-01
Posts: 485
Loc: Waterloo, Ontario, Canada
The @lserver is returning nothing, as evidenced by the fact that $inistr is empty.
The function will succeed even if the key and the string are nul.
Since the $inistr is nul the key gets deleted in the file.
And, yes, it works for me...

[ 19. November 2002, 15:12: Message edited by: Waltz ]
_________________________
We all live in a Yellow Subroutine...

Top
#32844 - 2002-11-19 03:13 PM Re: Creating and writing into a .log file
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Please learn some basic error checking procedures!

code:
dim $IniFile,$IniSection,$IniKey,$IniStr
;
$IniFile="c:\temp\test.ini"
$IniSection="LogonServer"
$IniKey="Servers"
$IniStr=@Lserver
;
? '@@LDOMAIN = '+@LDOMAIN
? '@@LSERVER = '+@LSERVER
? 'INI File = '+$IniFile
? 'INI Section = '+$IniSection
? 'INI Key = '+$IniKey
? 'INI String = '+$IniStr
;
If Exist($IniFile)
$rc=writeprofilestring($Inifile,$IniSection,$IniKey,$IniStr)
If $rc=0
"Function success"?
Else
"Function failure "+@error+" "+@serror?
EndIf
Else
"Ini file not found"?
EndIF

You will most likely discover that @LSERVER is empty. You should then read the KiXtart Manual to discover what happens if you provide an empty string into the WRITEPEOFILESTRING function.

So, the question is: Why is @LSERVER empty?

[ 19. November 2002, 15:14: Message edited by: sealeopard ]
_________________________
There are two types of vessels, submarines and targets.

Top
#32845 - 2002-11-19 03:17 PM Re: Creating and writing into a .log file
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
I think the question, what is the kixtart version you use?
_________________________
!

download KiXnet

Top
#32846 - 2002-11-19 03:25 PM Re: Creating and writing into a .log file
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Should be KiXtart 4.x since he's mentioning UDFs in his first post, however, you never know.

It seems we need to have a FAQ that spells out how to ask a question by providing the necessary information right away instead of having us regulars disassemble the question layer-by-layer to finally find out that the poster is talking about KiXtart 2.33 under DOS [Wink]

[ 19. November 2002, 15:25: Message edited by: sealeopard ]
_________________________
There are two types of vessels, submarines and targets.

Top
#32847 - 2002-11-19 03:32 PM Re: Creating and writing into a .log file
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
well, I might need to even know that as I think he has said it to me before.
anyway, wasn't it 4.11 which had macro's broken?

{edit}
nope, it was 4.10
http://www.kixtart.org/cgi-bin/ultimatebb.cgi?ubb=get_topic;f=3;t=000327

[ 19. November 2002, 15:35: Message edited by: Lonkero ]
_________________________
!

download KiXnet

Top
#32848 - 2002-11-19 03:35 PM Re: Creating and writing into a .log file
BrianK Offline
Getting the hang of it

Registered: 2002-10-02
Posts: 90
Loc: Amsterdam, The Netherlands
Had a bad night Jens?
You sound a little crankey to me, thought this was a "starters" forum...

Anyway, I am using Kix 4.11 and I found out, that only Win9x clients have the problem of not beeing able to resolve the macro's. NT clients fill out the info correctly.

I'll continu my search, thanks for your help.

Brian
_________________________
Rodney Dangerfield: “My mother didn't breast-feed me. She said she liked me as a friend.”

Top
#32849 - 2002-11-19 03:38 PM Re: Creating and writing into a .log file
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
brian, then the question is, do you have kxrpc installed and correct version?

anyway, this seems not to be a macro requiring it but the supporting dll's should be correct version, did you check those?

me going home now...
_________________________
!

download KiXnet

Top
#32850 - 2002-11-19 03:42 PM Re: Creating and writing into a .log file
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Nope, definitely not cranky. I even put a smily after that last sentence. [Smile] It was a more general comment on the way questions are asked lately.

Howver, Brian, as you just proved yourself, you did provide us with only half the picture by e.g. not mentioning that you do support Windows 9x and it's KiXtart 4.11.

Those two pieces of info would most likely have triggered a response like this:

A) Upgrade to KiXtart 4.12 due to some bugs in 4.11
B) Is the KiXtart RPC Server service running?
C) Do the Windows 9x clients have all the required DLLs?
_________________________
There are two types of vessels, submarines and targets.

Top
#32851 - 2002-11-19 04:12 PM Re: Creating and writing into a .log file
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Vagueness seems to be an occupational hazard for HelpDesk staff and KiX BBS moderators alike. Sometimes the only respite is to 'sit on one's hands' or to tell them they are 'too stupid to own a computer' which many of us have said far too often to our computer screen.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#32852 - 2002-11-19 04:27 PM Re: Creating and writing into a .log file
BrianK Offline
Getting the hang of it

Registered: 2002-10-02
Posts: 90
Loc: Amsterdam, The Netherlands
Jens...

just pulling your chains on that one ;-)

Anyway, i found out, that the reason for the darned 9x client I was testing on, had a corrupted .dll file, so you were right after all.

I replaced all three of them and it worked like a charm. I chose for an alternate solution for my case however. Now I am using this:

code:
 
redirectoutput ("c:\temp\test.txt",overwrite)
? '@@LDOMAIN = '+@LDOMAIN
? '@@LSERVER = '+@LSERVER

the file it creates then looks like this:
quote:

00
@LDOMAIN = ZZSFUK
@LSERVER = \\NLWL10

It also creates two 0's, but i have seen posts on that one, i'll have to dig into that.

Thanks anyway.

Brian
_________________________
Rodney Dangerfield: “My mother didn't breast-feed me. She said she liked me as a friend.”

Top
#32853 - 2002-11-19 04:32 PM Re: Creating and writing into a .log file
Waltz Offline
Seasoned Scripter

Registered: 2002-08-01
Posts: 485
Loc: Waterloo, Ontario, Canada
Zero in on this

[ 19. November 2002, 16:36: Message edited by: Waltz ]
_________________________
We all live in a Yellow Subroutine...

Top
Page 1 of 2 12>


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

Who's Online
0 registered and 611 anonymous users online.
Newest Members
Sir_Barrington, batdk82, StuTheCoder, M_Moore, BeeEm
17886 Registered Users

Generated in 0.077 seconds in which 0.03 seconds were spent on a total of 13 queries. Zlib compression enabled.

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