Page 1 of 1 1
Topic Options
#163613 - 2006-06-23 08:08 PM Ugh... write file...
Mstudinski Offline
Fresh Scripter

Registered: 2006-05-19
Posts: 25
I can't for the life of me figure this out... Basically I am reading a registry value and if it exists I am writing to a text file. I want the testfile to be @DATE_Clientname.txt. If the file does not exist I want to create the file. I know it is reading correctly but I can't see why it's not writing. I have read the documentation but I don't understand the problem! I am getting error code 3.

This should be another easy one.

Thanks!

Matt


Code:
 
DIM $IcaClientName, $x
$IcaClientName = ReadValue("HKEY_LOCAL_MACHINE\SOFTWARE\Citrix\ICA Client", "ClientName")
If @ERROR = 0
? "Citrix ClientName: $IcaClientName"
IF Open(1, "\\servername\sharename\Citrix\" + @DATE + " _clientname.txt") = 0
$x = WriteLine( 3 , @TIME +" " + @DATE + " " + @WKSTA + " has a static client name and it is " + $IcaClientName + @CRLF);
Close(1)
ELSE
BEEP
? "failed to open file, error code : [" + @ERROR + "]"
ENDIF
Endif


Top
#163614 - 2006-06-23 08:16 PM Re: Ugh... write file...
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Do you really think @Date characters are legal to use aas a filename?
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#163615 - 2006-06-23 08:21 PM Re: Ugh... write file...
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Hint:
Use Join(Split(@Date,'/'),'-')
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#163616 - 2006-06-23 08:29 PM Re: Ugh... write file...
Mstudinski Offline
Fresh Scripter

Registered: 2006-05-19
Posts: 25
Ugh.. Good point.. I forgot it has "/" in there...
One of those things that's so obvious that you overlook it.

Thanks

Matt


Edited by Mstudinski (2006-06-23 08:30 PM)

Top
#163617 - 2006-06-23 08:30 PM Re: Ugh... write file...
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
IF Open(1,...
$x = WriteLine( 3 ,...
Close(1)


there is your error.
if you don't still see it, say so and someone will explain.
_________________________
!

download KiXnet

Top
#163618 - 2006-06-23 08:31 PM Re: Ugh... write file...
Mstudinski Offline
Fresh Scripter

Registered: 2006-05-19
Posts: 25
Quote:

IF Open(1,...
$x = WriteLine( 3 ,...
Close(1)



there is your error.
if you don't still see it, say so and someone will explain.



I don't see it.
I read the manual and don't understand the difference in the numbers..

Top
#163619 - 2006-06-23 08:50 PM Re: Ugh... write file...
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
well, as there are no other takers...
if you open file handle 1 for writing, you should write to that handle and not to handle 3, which you didn't open.
_________________________
!

download KiXnet

Top
#163620 - 2006-06-23 09:11 PM Re: Ugh... write file...
Mstudinski Offline
Fresh Scripter

Registered: 2006-05-19
Posts: 25
Thanks.
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 809 anonymous users online.
Newest Members
StuTheCoder, M_Moore, BeeEm, min_seow, Audio
17884 Registered Users

Generated in 0.056 seconds in which 0.024 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