Page 2 of 3 <123>
Topic Options
#124892 - 2004-08-18 03:37 PM Re: Still can't add network printer...
HelpMe Offline
Fresh Scripter

Registered: 2004-08-11
Posts: 16
Well I just clicked on the link Les left on his post !
Top
#124893 - 2004-08-18 05:24 PM Re: Still can't add network printer...
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
LOL
So, I get chastized for suggesting YOU search but you have no problem using the link if I do the work and search for you.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#124894 - 2004-08-19 01:26 PM Re: Still can't add network printer...
HelpMe Offline
Fresh Scripter

Registered: 2004-08-11
Posts: 16
Exactly !! But well I realized that I'm really bad with Kix because can't make this ComputerInGroup UDF stuff works...
Top
#124895 - 2004-08-19 03:03 PM Re: Still can't add network printer...
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Did you read the comments in the header of the UDF? It gives an example of how to use it. We even have a FAQ on how to use UDFs.

If you want us to help you, you need to provide more information. What do you get when you use it? What error is returned? What version @KiX? Show us the code you tried.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#124896 - 2004-08-19 04:41 PM Re: Still can't add network printer...
HelpMe Offline
Fresh Scripter

Registered: 2004-08-11
Posts: 16
Well I've got an error but I don't have the time to read the window disappear before I can read... How can i check the error ? I told you I'm noob...
Top
#124897 - 2004-08-19 04:51 PM Re: Still can't add network printer...
Chris S. Offline
MM club member
*****

Registered: 2002-03-18
Posts: 2368
Loc: Earth
Open up a command window and run the script with KiX32. The DOS window should still stay open and you will be able to read the error message.
Top
#124898 - 2004-08-19 04:52 PM Re: Still can't add network printer...
HelpMe Offline
Fresh Scripter

Registered: 2004-08-11
Posts: 16
Version of WKIX32.exe is 4.11.00. Here's the srcipt I tried to test the ComputerInGroup Function (I put the sllep 10 in order to have the time to read errors but it doesn't work) :

Function ComputerInGroup ($group,$domain)
Dim $oGrp
if not $domain
$domain=@domain
endif
$oGrp = GetObject("WinNT://" + $domain + "/" + $Group + ",group" )
if @error
exit 1
endif
if $oGrp.IsMember("WinNT://" + $doamin + "/" + @wksta + "$$" )
$ComputerInGroup=1
else
$ComputerInGroup=0
endif
endfunction

If ComputerInGroup ("PC-CENT-SI")=1
? 'UDF ComputerInGroup works...'
Endif

sleep 10

Am I wrong ? I guess I am...

Top
#124899 - 2004-08-19 05:09 PM Re: Still can't add network printer...
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Quote:

I told you I'm noob...



This excuse is wearing thin. So far, there is a FAQ for just about every issue you have raised.
Catch that error message that flashes for a second
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#124900 - 2004-08-19 05:24 PM Re: Still can't add network printer...
HelpMe Offline
Fresh Scripter

Registered: 2004-08-11
Posts: 16
Well even if I launch the script from the dos box, it exit by itself and still can't read the error message... Grrrrrrrrr !
Top
#124901 - 2004-08-19 05:39 PM Re: Still can't add network printer...
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Maybe you did not put the computer in the group or the group is not a security group. I tested the UDF with my XP computer on KiX4.02 and 4.22. I don't have 4.11 because it was a buggy build.

Is that the whole code? You could put a few lines in to echo to the console.
Code:
If ComputerInGroup ("PC-CENT-SI")=1
? 'UDF ComputerInGroup works...'
else
? 'UDF ComputerNOT InGroup...'
Endif
'Error #'+@Error+' ['+@SError+']'

sleep 1000

_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#124902 - 2004-08-20 09:17 AM Re: Still can't add network printer...
HelpMe Offline
Fresh Scripter

Registered: 2004-08-11
Posts: 16
Ok I got the error message... Here it is :

Script error: invalid method/function call: missing required parameter 2!
If ComputerInGroup ("PC-CENT-SI")=1

I'm going to check in the forum if I find something on this !

Top
#124903 - 2004-08-20 09:31 AM Re: Still can't add network printer...
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
have you modified the UDF?
what is the line before the errorin line?
_________________________
!

download KiXnet

Top
#124904 - 2004-08-20 10:14 AM Re: Still can't add network printer...
HelpMe Offline
Fresh Scripter

Registered: 2004-08-11
Posts: 16
YES !!!! Really thank to everybody you helped me found what was wrong !!! First of all I wrote "doamin" in my script instead of "domain" ! Then this part of the script :
If ComputerInGroup ("PC-CENT-SI")=1 ? 'UDF ComputerInGroup works...'else ? 'UDF ComputerNOT InGroup...'Endif 'Error #'+@Error+' ['+@SError+']'
helped me a lot to found what was wrong !
Now it works well I'm going to add my printers I'll confirm you that all work fine !!
Again thanks to all !!

Top
#124905 - 2004-08-20 10:20 AM Re: Still can't add network printer...
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
glad to hear it's working.

would still want to know what that last error was all about.
if it's not high-secure thing, could you tell us that?
_________________________
!

download KiXnet

Top
#124906 - 2004-08-20 02:01 PM Re: Still can't add network printer...
HelpMe Offline
Fresh Scripter

Registered: 2004-08-11
Posts: 16
Well I'll try to explain what I understood...
Here's the function I finally have :
Function ComputerInGroup ($group)
Dim $oGrp
$oGrp = GetObject("WinNT://" + @domain + "/" + $Group + ",group" )
if @error
exit 1
endif
if $oGrp.IsMember("WinNT://" + @domain + "/" + @wksta + "$$" )
$ComputerInGroup=1
else
$ComputerInGroup=0
endif
endfunction

In fact I was wrong with the $domain stuff, I made a syntax error I guess (don't really know) but I realized I didn't need the $domain, since we only have one domain... So I wrote it again using the example you gave me (that's how I saw I wrote doamin instead of domain the first time). Then the function call worked !!!! I'm not sure but does this answer your question ?

Top
#124907 - 2004-08-20 02:26 PM Re: Still can't add network printer...
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
well, kinda... not...
the error does not correspond the code you pasted though, but that does not matter, I quess...
well, ja. it still leaves the reason unanswered.

that error would be logical only if you modified the function-definition's start line and that I can't see as you pasted the working code.
_________________________
!

download KiXnet

Top
#124908 - 2004-08-20 02:38 PM Re: Still can't add network printer...
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
There is/was no reason to modify the UDF. I mean, you don't reverse engineer KiX and modify Ruud's functions and recompile do you?
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#124909 - 2004-08-20 02:53 PM Re: Still can't add network printer...
maciep Offline
Korg Regular
*****

Registered: 2002-06-14
Posts: 947
Loc: Pittsburgh
if you look at the function he posted earlier, he removed the optional keyword from the domain parameter. Therefore, he gets an error the "missing required parameter 2" error.
_________________________
Eric

Top
#124910 - 2004-08-20 03:15 PM Re: Still can't add network printer...
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
ja!
so he did.
weirdly missed that one.

thanks for loaning your eyes.
_________________________
!

download KiXnet

Top
#124911 - 2004-08-20 03:21 PM Re: Still can't add network printer...
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Ja, weird how ppl feel the need to modify a UDF to somehow "make it their's". Or they cut out all the stuff they don't really understand and think they can make it better.

Then they post to the board "why does this not work" not mentioning that they hacked up the UDF and expect us to find the needle in the haystack.

SHEESH!
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
Page 2 of 3 <123>


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

Who's Online
0 registered and 194 anonymous users online.
Newest Members
BeeEm, min_seow, Audio, Hoschi, Comet
17882 Registered Users

Generated in 1.696 seconds in which 0.176 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