#1781 - 2000-02-24 11:22 AM
NT printer connections
|
Anonymous
Anonymous
Unregistered
|
Hi everybody.Right heres the score, i have a network of 60 machines that are split into 2 rooms. the computers names are "UPPER00" to "UPPER60" the first 30 machines are in room 1 and the rest are in room 2. Each room has 2 printers {a laser and a colour} at the moment i can see all 4 printers no matter what room im in{naturally} but i want a script that looks at the computer number and if it's below 30 i want it to connect to the printers in room 1 and viceversa... Is this possible. any ideas or advice would be appreciated, just to let you know i know nothin about kixtart programming language so it would be appreciated if a script could be posted. Many thanxs in advance Mike.....
|
|
Top
|
|
|
|
#1782 - 2000-02-24 11:58 AM
Re: NT printer connections
|
Anonymous
Anonymous
Unregistered
|
Dear kingston,You can use the function in kixtart to read the last two number, (I can remember the function, please read the menu) say, ;************ $wksta=@wksta $a=function($wksta,5,2) ;take last two char $what_rm=val($a) ;change to number if $what_rm > 30 addprinterconnection(\\sever\printer_rm2) else addprinterconnection(\\sever\printer_rm1) endif ;****************** I am work fine in my three location, though I am not use the number but the initial char of the @wksta. If any worng in above script, pls correct it. Gilbert Ng
|
|
Top
|
|
|
|
#1783 - 2000-02-25 03:56 AM
Re: NT printer connections
|
Anonymous
Anonymous
Unregistered
|
Thanxs for the response, although im not to sure about what you mean by the text in Bold in the script below?;************ $wksta=@wksta $a=function($wksta,5,2) ;take last two char $what_rm=val($a) ;change to number if $what_rm > 30 addprinterconnection(\\sever\printer_rm2) else addprinterconnection(\\sever\printer_rm1) endif ;****************** Could you clarify what i have to do where it says "take last to char" and "Change to Number"????? Thanxs in advance
|
|
Top
|
|
|
|
#1784 - 2000-02-25 04:04 AM
Re: NT printer connections
|
Anonymous
Anonymous
Unregistered
|
HiDo nothing those lines are comments to help you understand what the script is doing  Eh Gilbert? ------------------ Don Davidson Network Engineer http://www.insight-media.co.uk
|
|
Top
|
|
|
|
#1785 - 2000-02-25 05:13 AM
Re: NT printer connections
|
Anonymous
Anonymous
Unregistered
|
I have left everything as it is and i get the error messageScript error : expected expression !. $a=function{$wksta,5,2} ;take last two char HELP!
|
|
Top
|
|
|
|
#1786 - 2000-02-25 05:34 AM
Re: NT printer connections
|
Anonymous
Anonymous
Unregistered
|
HiTry $wksta=@wksta $a=function($wksta,5,2) $what_rm=val($a) if $what_rm > 30 addprinterconnection(\\sever\printer_rm2) else addprinterconnection(\\sever\printer_rm1) endif I have removed the comments for you. Good luck. Rgds Don
|
|
Top
|
|
|
|
#1787 - 2000-02-25 05:38 AM
Re: NT printer connections
|
Anonymous
Anonymous
Unregistered
|
Ah haRead gilberts post again! He means he cannot remember the "function" so you need to know what to replace "function" with!! That's why it don't work. Wish I knew what "function" Gilbert means! Sorry! Rgds Don
|
|
Top
|
|
|
|
#1788 - 2000-02-25 06:18 AM
Re: NT printer connections
|
Anonymous
Anonymous
Unregistered
|
The function he means is the SUBSTR command. See the manual for eact usage
|
|
Top
|
|
|
|
#1789 - 2000-02-25 06:18 AM
Re: NT printer connections
|
Anonymous
Anonymous
Unregistered
|
The function he means is the SUBSTR command. See the manual for exact usage
|
|
Top
|
|
|
|
#1790 - 2000-02-25 06:30 AM
Re: NT printer connections
|
Anonymous
Anonymous
Unregistered
|
Sorry about this folks but i changed the "function" to SUBSTR and its not connecting to the correct printers, im using 1 machine in room 1 and its connecting to the Laser printer in room 2 ?????heres the script i currently have, is anything wrong with it? ;************ $wksta=@wksta $a=substr($wksta,5,2) ;take last two char $what_rm=val($a) ;change to number if $what_rm > 30 addprinterconnection(\\upperserver\EpsonU18) addprinterconnection(\\upperserver\KyoU18) else addprinterconnection(\\upperserver\KyoU26) addprinterconnection(\\upperserver\EpsonU26) endif ;******************
|
|
Top
|
|
|
|
#1791 - 2000-02-25 07:26 AM
Re: NT printer connections
|
Anonymous
Anonymous
Unregistered
|
Hi KingstonTry running the script in debug mode to Check the value of $what_rm ;************ $wksta=@wksta $a=substr($wksta,5,2) ;take last two char $what_rm=val($a) ;change to number $what_rm Good luck Rgds Don
|
|
Top
|
|
|
|
#1792 - 2000-02-29 03:20 AM
Re: NT printer connections
|
Anonymous
Anonymous
Unregistered
|
How do i run it in debug mode????
|
|
Top
|
|
|
|
#1793 - 2000-02-29 03:39 AM
Re: NT printer connections
|
Anonymous
Anonymous
Unregistered
|
HiI normally create a shortcut on my desktop for the script I want to debug and the properties of the shortcut type something like: \\server\netlogon\KIX32.EXE \\server\netlogon\yourscript.kix /d It's the /d at the end that runs the script in debug mode. You press F8 to step thru your script. See the Kixtart manual for more details. Good luck.
------------------ Don Davidson Network Engineer http://www.insight-media.co.uk
|
|
Top
|
|
|
|
#1794 - 2000-02-29 06:09 AM
Re: NT printer connections
|
Anonymous
Anonymous
Unregistered
|
What does this do and what am i looking for?
|
|
Top
|
|
|
|
#1795 - 2000-02-29 06:25 AM
Re: NT printer connections
|
Anonymous
Anonymous
Unregistered
|
Ok people im getting peaved of with this thing now!!!!Here is my script as of now,, please tell me what is wrong with it because when i login on a machine in room 1 it connects to the laser printer in room 2???? ;************ $wksta=@wksta $a=substr(@wksta,len(@wksta)-2,2) ;take last two char if $a > 30 addprinterconnection(\\upperserver\EpsonU18) addprinterconnection(\\upperserver\KyoU18) else addprinterconnection(\\upperserver\KyoU26) addprinterconnection(\\upperserver\EpsonU26) endif :EXIT ;****************** HELP!!!!!!!!!!!!!!!! :confused:
|
|
Top
|
|
|
|
#1796 - 2000-02-29 06:32 AM
Re: NT printer connections
|
Anonymous
Anonymous
Unregistered
|
HiRun your script in debug mode and you will see!  In debug mode you step thru the script line by line, normally any error messages will appear in the debug screen and you can see what your code is doing line by line. If your code is not doing as you expect it to, then debug is the way to find out why. Try this in a test.kix and run it in debug mode. ;************ $wksta=@wksta $a=substr($wksta,5,2) ;take last two char $what_rm=val($a) ;change to number if $what_rm > 30 AT 4,4 "This is connecting to U18" addprinterconnection(\\upperserver\EpsonU18) addprinterconnection(\\upperserver\KyoU18) else At 4,4 "This is connecting to U26" addprinterconnection(\\upperserver\KyoU26) addprinterconnection(\\upperserver\EpsonU26) endif ;****************** Hope this helps. Rgds Don
|
|
Top
|
|
|
|
#1797 - 2000-02-29 06:34 AM
Re: NT printer connections
|
Anonymous
Anonymous
Unregistered
|
OoopsI missed out the () from the AT lines. It should read: ;************ $wksta=@wksta $a=substr($wksta,5,2) ;take last two char $what_rm=val($a) ;change to number if $what_rm > 30 AT (4,4) "This is connecting to U18" addprinterconnection(\\upperserver\EpsonU18) addprinterconnection(\\upperserver\KyoU18) else At (4,4) "This is connecting to U26" addprinterconnection(\\upperserver\KyoU26) addprinterconnection(\\upperserver\EpsonU26) endif ;****************** Sorry!! Rgds Don
|
|
Top
|
|
|
|
#1798 - 2000-02-29 07:00 AM
Re: NT printer connections
|
Anonymous
Anonymous
Unregistered
|
Ok heres what i have as my script;************ $wksta=@wksta $a=substr($wksta,5,2) ;take last two char $what_rm=val($a) ;change to number if $what_rm > 30 AT (4,4) "This is connecting to U18" addprinterconnection(\\upperserver\EpsonU18) addprinterconnection(\\upperserver\KyoU18) else At (4,4) "This is connecting to U26" addprinterconnection(\\upperserver\KyoU26) addprinterconnection(\\upperserver\EpsonU26) endif ;****************** I have made a short cut with the following shortcut properties. \\upperserver\netlogon\KIX32.EXE \\upperserver\netlogon\brandnew.kix /d When the program runs it says "R0
|
|
Top
|
|
|
|
#1799 - 2000-02-29 07:01 AM
Re: NT printer connections
|
Anonymous
Anonymous
Unregistered
|
Ok heres what i have as my script;************ $wksta=@wksta $a=substr($wksta,5,2) ;take last two char $what_rm=val($a) ;change to number if $what_rm > 30 AT (4,4) "This is connecting to U18" addprinterconnection(\\upperserver\EpsonU18) addprinterconnection(\\upperserver\KyoU18) else At (4,4) "This is connecting to U26" addprinterconnection(\\upperserver\KyoU26) addprinterconnection(\\upperserver\EpsonU26) endif ;****************** I have made a short cut with the following shortcut properties. \\upperserver\netlogon\KIX32.EXE \\upperserver\netlogon\printers.kix /d When the program runs it says "R0 this is connecting to U181801Script error : failed to find/open script!." above is exactly what it says spaces and all???? whats wrong?
|
|
Top
|
|
|
|
#1800 - 2000-02-29 07:23 AM
Re: NT printer connections
|
Anonymous
Anonymous
Unregistered
|
Hi MikeSee the R0 at the beginning? it does not look as if your script is getting the last two digits! I just tried/debugged something similar on our systems as follows: $SysNo = SUBSTR(@WKSTA, LEN(@WKSTA)-2,3) IF $SysNo="152" AT (4,4) "This is sys152" " Variable is $SysNo" ELSE AT (4,4) "This is NOT sys152" " Variable $SysNo" And this works for me (we have three digits to get!) Work on this bit in a test script and check the variable output as I did. Good luck. Don
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 837 anonymous users online.
|
|
|