|
|
|||||||
Hi im new on your forum , and noob with Kix...so,i'm suppose to change the printer by the WKS classroom type with the printer...so if a WKS is in classroom 604 , it's suppose to be connected with printer X and if in 705 , printer Y..etc...etc... Here's an example of the old script and what i change inside , but don't work properly , block at 45% loading... Finally excuse my english , im from belgium and don't practice too much my english... Here's the OLD version of my script: Code:
As i need ot connect 5 printer for spécifics classroom , here's what i did: New code: Code:
Please excuse me if i make a forum mistake ....im noob... And if u can bring me to light with this script....thanks a lot ! BAL. |
||||||||
|
|
|||||||
you have gosubs there... where are the corresponding labels? |
||||||||
|
|
|||||||
Okay , i think that's what you speak about...scuse me but i don't know anything @ Kix32... Code:
|
||||||||
|
|
|||||||
oleput? may I ask what version of kix you are using? can I offer you a trade? you download the newist, kixtart 2010 4.50 from kixtart.org/downloads and we help you build the script with the new sh*t. what you say? |
||||||||
|
|
|||||||
oh... come to think about it... your script might be so huge with all the ole stuff that it may take quite a long time to translate that to COM. |
||||||||
|
|
|||||||
If he's running AD and can make computer groups for the classrooms and put the comps in the groups we could just use the ComputerInGroup() udf. and then just map printer A on computer group A, printer B on computer group B, etc.... |
||||||||
|
|
|||||||
AD don't exist in NT4 server...my version of KiXtart ? i don't even know...but old i bet...i'm new at my job and just discover that they haven't a right server...and im suppose to do the best with this crappy server and this script... Any idea of what can i do to do what i need ? BAL. Thx to read me at least |
||||||||
|
|
|||||||
ok i check my KiXtart version , ....hem.... 3.62....sorry...i know it's sooooo old but i'm suppose to do it with what i've got.. BAL. |
||||||||
|
|
|||||||
what you mean with crappy server? NT is about the best thing redmont has produced this far in my opinion, you should try to make your subscript printerPool a generic one so you can call it for all of the pools. also, you use regwrites but instead you should go with kixtart's addPrinterConnection() and setDefaultPrinter() now, is there a proper classroom naming in place? like, all the wksta's in one room share the same naming concept? if yes, make a nice list showing what printer is connected to what classroom and what is the way to identify a wksta belonging to that classroom. if there is more than one printer that's fine too. why I say you to do this, is that the whole printer add code should be no more than 5 lines all together. with proper planning it is easier to write clean short code, right? |
||||||||
|
|
|||||||
Quote: Yes I know that but you never said you used NT4. Updating kix is easy and free of charge. Lots more functions and support for more OS versions etc... in the newest kix version. All you have to do is copy kix32.exe to the location the old one is sitting and overwrite this old version with the new 4.50. No charge, ten seconds of work, more support, more options, better help from everybody on this board, etc..... If even remotely possible I would update to 4.50 right now. 3.62 is realy old. |
||||||||
|
|
|||||||
like said, it's not that easy in his case. if he is using ole, that's not supported no more in 4.xx he should avoid updating before he gets to know kixtart a little better. |
||||||||
|
|
|||||||
Quote: Yep, I know. Changing it to build-in kix commands and functions would golf it down a lot. Quote: That for sure. We could give him some kind of push in the right direction if the stuff you asked like standard naming by classroom number or something like it is in place. If not, he should first get the naming properly set up and then think about changing the script. |
||||||||
|
|
|||||||
Well let's try to explain a little bit my situation , i've to manage an NT4 server based network , Kix was installed before my arrival , so i must work with it but i can change to new version if i got a little hand to help me... The classroom are supposed to be like that: Class 604: -One laser printer -One colour printer -All post named by the same convention (PTExxxxAxx) Class 605: -One laser printer -One colour printer -All post named by the same convention (PTExxxxAxx) Class 705-706 -One colour printer -All post named ...PTExxxxAxx For all WKS , their names are: PTE0(local n°)A(machine number) In ex: PTE0604A01....02...-> 10 Next , PTE0705A01...10... Am i most clear like this ? If any help needed , ask me... Thanks for all your help ! (damn , speaking english is so hard for me... please don't laugh...:p) BAL. |
||||||||
|
|
|||||||
Hem , i think about one thing , should it help you if i put my all script here ? it's a little bit big but i think i can put it on this forum... BAL. |
||||||||
|
|
|||||||
Changing to a new version is easy. If you know where the old kix32.exe and/or wkix32.exe is located (I bet its locally on each machine). Just download the new version and copy it over the old version. !! WARNING !! You current script will not work! As said above commands are used in your current script that are no longer supported by kix. The script should first be altered to work with the new version of kix. This may also be the case on any other kixscripts you use. BE CAREFULL. This could be a start of what your printer mapping script could look like. This is a very basic script to add printers based on the computer name. It deletes all currently installed network printers before adding new ones. Code:
|
||||||||
|
|
|||||||
im damned , i cant put it all on this forum , too big i think...may i put it on many reply ? BAL. |
||||||||
|
|
|||||||
How big is big? 1000's of lines, 250 scripts, 20MB per script Sure you can put it here. As long as it's you’re printer mapping script. Maybe it's best to start a new topic if you need help converting an other script from oldie retired and gray haired kix to the current version. |
||||||||
|
|
|||||||
Here's my first try to connect some network ressources: Code:
Am i good ? BAL. |
||||||||
|
|
|||||||
Took out the GOTO's (don't use them, they are EVIL ) The ?@error @SERROR lines are there for debugging. If all goes ok you can comment them by putting a ; in front of them or just remove them. Kix does not use NET USE but just USE. It deletes all network drive before adding new ones because the users can disconnect a drive and map a new one on the same drive name so it looks like the drive is there but it points to the wrong share. Code:
|
||||||||
|
|
|||||||
is Code: Use * /delete used to delete all mappings ? BAL. |
||||||||
|
|
|||||||
whole lot of syntax errors there mart. and balafrus' code is not kixtart at all. "if exist blaah" just does not work. and that printer mapping. is there only one printer per room? do the printers have proper names or do they differ totally from the naming schema? I say this because like I said above, all you need is at most 5 lines of code if all of the info is here. don't start coding too soon. you can see what comes from it. bad code and mart, could you clean your code? |
||||||||
|
|
|||||||
well , i don't know why don't you like the "if exist" but i did it because i found it in a doc about kix and don't know kix at all...so i'm open to all sugest if you have any.. BAL. |
||||||||
|
|
|||||||
Yeah, should read stuff better. Just took balafrus's code without reading it properly. Added lots of ". |
||||||||
|
|
|||||||
Quote: Yes it is. |
||||||||
|
|
|||||||
Excuse me but is your script for Kix 4xx or kix 3xx ? Cause i got some error messages at startup and cant see them cause of their speed... BAL. |
||||||||
|
|
|||||||
balafrus, if you look again in the manual, exist is a function. thus it is Exist() Code: if exist("myfolder") or exist("myFile") or not exist("yourFile") now, still... you don't have kixtart 4.xx but with you can do pretty amazing stuff with 3.62 and it surely is not that old. just lacks some of the cool newer functionality. if you can't tell the naming schema (if there is any) for the printers, can't assist you further. in your attempt in the first post of yours, you just write the reg-value but there is lot more than reg-value to having a printer connected. thus, use kixtart's inbuild AddPrinterConnection() instead. |
||||||||
|
|
|||||||
yes but i don't remmeber who's telling me that i cant with my old version of Kix... The naming schema, what did u mean of ? the name of the printer and the server ? Room 604 Printer laser: HPlaserjet604 printer colour: HP604 serveur: PTP7002A01 and the same for other classroom... BAL. |
||||||||
|
|
|||||||
alrighty! now, if I understood all the pieces properly, all you need for all classes could be... Code:
that same code works for all rooms. now, if you want to make the laser the default (as example), you need to have the name of the printer instead of the sharename. if your sharename and printername on the server are the same, then simply this will do: Code:
and that's it. there is 7 lines but heck... little extra for 3.xx you understand what I did there? |
||||||||
|
|
|||||||
yes but still one problem , the local 705 have only one printer colour and no laser...and 706 use the shared printer from 705 too... So for the 705-706 only one printer (colour) shared. BAL. |
||||||||
|
|
|||||||
it does not matter. I thought about it too before posted the code. when there is no printer, the addprinterconnection just fails to connect the printer, right? so, it's fine to be there. for 706 the problem is there. you have 2 choices. either share the same printer again with another name too or I will modify the script. you could have something like: Code:
|
||||||||
|
|
|||||||
nice one , i will try this and tell you if it works... ! Thanks a lot ! BAL. (ps: i take my 2nd "C" training yesterday...so please be patient.. ) |
||||||||
|
|
|||||||
excuse my next noob question but could i use kixtart in local mode , in exemple only one my computer to make my tests...and if i can , how ? Cause like this i can make all the tests i want (need...) without making some trouble with the other users... Thanks again ! BAL. |
||||||||
|
|
|||||||
Sure you can. Just run it of your local system from for example a command line window or directly from the editor if it has the option to do so. pathtokix32\kix32.exe pathttoscript\yourscript.kix |
||||||||
|
|
|||||||
rhooo thanks a lot it will help me more then u can think about.... BAL. |
||||||||
|
|
|||||||
Just a small tip. Don’t forget to put Break on at the top of your script when testing. If its not there and for some reason your script gets stuck or in a loop you cant quit it without being logged of each time. |
||||||||
|
|
|||||||
could you please put me an exemple ? |
||||||||
|
|
|||||||
It's easy, just put Break on at the top of your script like this: Code:
|
||||||||
|
|
|||||||
oh , ok im thinking about a more evil code like this Code:
Or something like that... BAL. |
||||||||
|
|
|||||||
here's what i've tried and don't seems to work... Code:
Isn't it suppose to connect a printer ? i try this one with kixtart version 4.50 any idea ? BAL. |
||||||||
|
|
|||||||
ok i try this one and it works fine: Code:
But still have some problems to set as a default printer...is the syntax correct ? BAL. |
||||||||
|
|
|||||||
Syntax looks correct. What if you put this line directly below the setdefaultprinter line and see what it gives. The sleep line is just to halt the script so you can read the stuff on the screen. Code:
|
||||||||
|
|
|||||||
sorry , wil try on another post cause here , i've take off (uninstall ?) the default printer (microsoft default printer) and can't put it back.. |
||||||||
|
|
|||||||
lets go back up please. did you test at all why some of the scripts didn't work? you must try to understand what is going on. I mean, the script commands are clear english words so it won't be that hard. you say your edited code worked but it looks to me just the same as my code. tell me what this throws on your window: Code:
the default printer... well, you need to know the printers name and use it instead of the share name if they are different. |
||||||||
|
|
|||||||
Code: ERROR : unknown command [Sleeping]! got this error when i try this one: Code:
Any idea ? |
||||||||
|
|
|||||||
sure you get. sleeping is not kixtart command. did you try the script I gave you? |
||||||||
|
|
|||||||
not yet , i'll do it right now ! |
||||||||
|
|
|||||||
Quote: Don't work at all...only got this message.. |
||||||||
|
|
|||||||
1801 is ERROR_INVALID_PRINTER_NAME |
||||||||
|
|
|||||||
hemm...okay and which name am i suppose to put ? The printer's share name is HP705....and i think the $room is the cause of the error... BAL. |
||||||||
|
|
|||||||
Ja, but which function is throwing the error? One uses the share name and the other, the printer name. Are both names the same? |
||||||||
|
|
|||||||
Damn. Quick typing s#cks. Code:
|
||||||||
|
|
|||||||
you need to now put back the code that is lacking: Code:
and I say, that's 100% the same code as I gave you before. |
||||||||
|
|
|||||||
Quote: Here what i've got when i try the following code: Code:
The printer connect , but not as default.. BAL. |
||||||||
|
|
|||||||
damn i think that's my error came frome the name of the printer in the SetDefaultPrinter line ! but can't find the name to put....isn't supposed to be the share name ? \\server\printer ? like here -> \\PTE0705A06\HP705 ?? Heres the script i use @ this moment: Code:
|
||||||||
|
|
|||||||
hem...i'm always gettin an error code 22 or 122 on the SetDefaultPrinter line...what would it says ? BAL. |
||||||||
|
|
|||||||
OK my script works fine , i must think about not to put SetdefaultPrinter BEFORE endif ... Code:
Here's my final code....last problem , don't work at all with old versions of kix32....so did u know how to translate the setdefaultprinter and addprinterconnection in old kix script ? T.Y. BAL. |
||||||||
|
|
|||||||
you still didn't even try the ready made script? you took marts code and even simplified that and then took some comment lines from my code and placed in marts code. how do you except that to work? and, addprinterconnection and setdefaultprinter both work fine with really old kixtart versions. the problem is in your script. instead of jumping around like crazy, calm down and think what moves you take. |
||||||||
|
|
|||||||
ok sorry , my fault , my entire fault... /auto slap... In fact , i use a kixtart2.kix in a kixtart.kix and all works fine....if my computer's name is PTE06xxx -> call Kixtart2.kix , if it's name is PTE07xxx , call kixtart3.kix etc etc...and it work really fine... Thanks a lot for all your help ! BAL. |
||||||||
|
|
|||||||
lol. you couldn't have gone any worse. well, you could use batch instead of kix scripts. but, everyone uses his own style. and some even do it right the first time... |
||||||||
|
|
|||||||
hello again, my scripts don't want to run anymore...it install the printer as well but don't wanna put this damn one as default.... Heres the code: if substr(@wksta,1,7) = "PTE0605" AddPrinterConnection("\\PTP7002A11\PRL7002A11") @error ? SetDefaultPrinter("\\PTP7002A11\PRL7002A11") @error ? AddPrinterConnection("\\PTE0605A01\HP605") @error ? endif Any ideas ? BAL. |
||||||||
|
|
|||||||
oh, this one... k, you missing on some vital info. what is the error code? does this printer have same name as it's share? |
||||||||
|
|
|||||||
edit: i check the printer's name isnt the same as it'share name.... Printer's name: PCL6 Laserjet Share name: PRL7002A11 BAL. |
||||||||
|
|
|||||||
hem , the error is this: It connect the printer correctly but don't put it as default printer... |
||||||||
|
|
|||||||
Is the share name different than the printer name? |
||||||||
|
|
|||||||
balafrus dear, there is @ERROR line in YOUR SCRIPT. what does it say?!? I'm 110% sure that it did not say what you told me. anyway, the problem is that setdefaultPrinter() wants the printer name, not share name. |