Page 1 of 1 1
Topic Options
#62994 - 2002-02-10 02:41 PM My Printer script wont work Help
sue potts Offline
Fresh Scripter

Registered: 2002-02-07
Posts: 7
This is my script I have added section for printers to the students area but I am getting an error and the printers wont work at all.
Can anyone help pleaseif ingroup ("cohort99_00") =1
gosub 99
endif

if ingroup ("cohort97_98") =1
gosub 97
endif

if ingroup ("cohort98_99") =1
gosub 98
endif

if ingroup ("cohort00") =1
gosub intake_00
endif

if ingroup ("cohort01") =1
gosub intake_01
endif

if ingroup ("school staff") =1
gosub staff
endif

if ingroup ("domain admins") =1
gosub other
endif

if ingroup ("sims") =1
gosub sims
endif

if ingroup ("Food") =1
gosub food
endif

if ingroup ("PrimarySchool") =1
gosub primary
endif
exit

:intake_01
use u: /del
use u: "\\Utility-server\01"
return

:intake_00
use u: /del
use u: "\\Utility-server\00"
return

:99
use u: /del
use u: "\\Utility-server\99"
return

:98
use u: /del
use u: "\\Utility-server\98"
return

:97
use u: /del
use u: "\\Utility-server\97"
return

:sims
use s: "\\admin-server\applicat"
return

:students
use g: /del
use r: /del
use o: /del
use t: /del
use s: /del
use k: /del
use m: /del
use r: "\\Utility-server\roa$"
use o: "\\Utility-server\shared"
use s: "\\Utility-server\careerscape"
use k: "\\Utility-server\kudos"
use m: "\\Utility-server\omnigraph"
use i: "\\cdromserver\sschool"
use g: "\\Utility-server\itskills"
use l: "\\curriculum\rivers"

$sRoom=substr(@WKSTA,1,2) ; Room Prefix Tx
$iPCNo=substr(@WKSTA,3,9) ; Simple sequential PC number.
"This is PC number " $iPCNo " in room number " $sRoom ?
Select
Case $sRoom = "T8"
Use lpt1: "\\curriculum\T8Colour"
Use lpt2: "\\curriculum\Pagepro4100"
Case $sRoom = "T9"
Use lpt1: "\\curriculum\T9colour"
Use lpt2: "\\curriculum\T9black"
Case $sRoom = "T7"
Use lpt1: "\\curriculum\T7Colour"
Use lpt2: "\\curriculum\T7black"


Case 1 "No printer mapped - room not recognised"
?EndSelect
return

:staff
use m: /del
use n: /del
use r: /del
use k: "\\Utility-server\kudos"
use l: "\\Utility-server\careerscape"
use o: /del
use r: "\\admin-server\reports"
use o: "\\Utility-server\shared"
use n: "\\admin-server\y92001"
use m: "\\admin-server\y72001"
use l: "\\curriculum\rivers"
return

:food
use p: /del
use p: "\\cdromserver\the can"
return

ther
;;run "\\Utility-server\shared\ranger\setup.exe"
use r: "\\admin-server\reports"
use z: "\\backup server\cdrom"
use i: "\\cdromserver\sschool"
use t: "\\cdromserver\quickcad"
use p: "\\cdromserver\office97"
return

rimary
use o: "\\Utility-server\shared"
return

Top
#62995 - 2002-02-10 02:47 PM Re: My Printer script wont work Help
JensKalski Offline
Starting to like KiXtart

Registered: 2000-12-13
Posts: 186
Loc: Germany
Hy,
is there any reason, not to use ADDPRINTERCONNECTION?
_________________________
Jens Kalski

Top
#62996 - 2002-02-10 02:51 PM Re: My Printer script wont work Help
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
It looks like you don't need most of those IF/gosub statements.. It might be easier if you pulled the subroutines up into the IF statements.

It LOOKS like you might have a problem with the endselect.

Where in the script is it giving the error message?

_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#62997 - 2002-02-10 02:59 PM Re: My Printer script wont work Help
sue potts Offline
Fresh Scripter

Registered: 2002-02-07
Posts: 7
The problem is I need to use printers by room location and not by user groups I.E Students or Staff.

As you can see the different groups are given different mapped drive access and they could work on any of the 230 pc's I have, but I want to make sure that the prints they send come out in the room that they are working in.
So I need to make the script recognise the pc number then tell it to print to the required printer which will be mapped through the server and arrive back in the room in which they are working.

I did not create this script at all so Im abit lost!

Really need loads of help Guys!

Top
#62998 - 2002-02-11 05:53 AM Re: My Printer script wont work Help
MCA Offline
KiX Supporter
*****

Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
Dear,

We review your script and we have some remarks about:

  • GOSUBs not necessary. earlier mention by others.
  • block "students" wasn't called. in our version we insert a group STUDENTS.
    (rename it to the corresponding one)
  • the use of "USE X: /del" not consistent. we insert in our version
    an "USE X: /del" before using "USE X: "\\server\share"".
  • your are referencing twice to L-drive in "SCHOOL STAFF" part.
  • your are referencing to Z-drive in "DOMAIN ADMINS" part. we advice you
    not to use the Z-drive. it has special meanings in windows environment.
  • we are using INGROUP("...") <> 0 instead of INGROUP("...") = 1,
    which work for all kixtart releases

Our version:

code:

IF InGroup ("cohort99_00") <> 0
USE u: /del
USE u: "\\Utility-server\99"
ENDIF
IF InGroup ("cohort97_98") <> 0
USE u: /del
USE u: "\\Utility-server\97"
ENDIF
IF InGroup ("cohort98_99") <> 0
USE u: /del
USE u: "\\Utility-server\98"
ENDIF
IF InGroup ("cohort00") <> 0
USE u: /del
USE u: "\\Utility-server\00"
ENDIF
IF InGroup ("cohort01") <> 0
USE u: /del
USE u: "\\Utility-server\01"
ENDIF
IF InGroup ("school staff") <> 0
USE k: /del
USE l: /del
USE m: /del
USE n: /del
USE o: /del
USE r: /del
USE k: "\\Utility-server\kudos"
USE l: "\\Utility-server\careerscape"
;USE l: "\\curriculum\rivers"
USE m: "\\admin-server\y72001"
USE n: "\\admin-server\y92001"
USE o: "\\Utility-server\shared"
USE r: "\\admin-server\reports"
ENDIF
IF InGroup ("students") <> 0
USE g: /del
USE i: /del
USE k: /del
USE l: /del
USE m: /del
USE o: /del
USE r: /del
USE s: /del
USE t: /del
USE g: "\\Utility-server\itskills"
USE i: "\\cdromserver\sschool"
USE k: "\\Utility-server\kudos"
USE l: "\\curriculum\rivers"
USE m: "\\Utility-server\omnigraph"
USE o: "\\Utility-server\shared"
USE r: "\\Utility-server\roa$"
USE s: "\\Utility-server\careerscape"
ENDIF
IF InGroup ("domain admins") <> 0
;;run "\\Utility-server\shared\ranger\setup.exe"
USE i: /del
USE p: /del
USE r: /del
USE t: /del
USE z: /del
USE i: "\\cdromserver\sschool"
USE p: "\\cdromserver\office97"
USE r: "\\admin-server\reports"
USE t: "\\cdromserver\quickcad"
USE z: "\\backup server\cdrom"
ENDIF
IF InGroup ("sims") <> 0
USE s: /del
USE s: "\\admin-server\applicat"
ENDIF
IF InGroup ("Food") <> 0
USE p: /del
USE p: "\\cdromserver\the can"
ENDIF
IF InGroup ("PrimarySchool") <> 0
USE o: /del
USE o: "\\Utility-server\shared"
ENDIF
GOSUB set_printers
EXIT
:set_printers
$sroom=Substr(@wksta,1,2) ; Room Prefix Tx
$ipcno=Substr(@wksta,3,9) ; Simple sequential PC number.
"This is PC number " $ipcno " in room number " $sroom ?
SELECT
CASE $sroom = "T8"
USE lpt1: "\\curriculum\T8Colour"
USE lpt2: "\\curriculum\Pagepro4100"
CASE $sroom = "T9"
USE lpt1: "\\curriculum\T9colour"
USE lpt2: "\\curriculum\T9black"
CASE $sroom = "T7"
USE lpt1: "\\curriculum\T7Colour"
USE lpt2: "\\curriculum\T7black"
CASE 1
? "No printer mapped - room not recognised"
ENDSELECT
RETURN

Also we have create a version with additional debugging code

code:

CLS
COLOR C+/N
AT (1,1) " "
IF RedirectOutput("c:\kixdebug.txt")
ENDIF
? "-"+LCASE(@day)+" "+@date+" "+@time+"- kixtart "+@kix+"/3.00e script starting."
? "-"
? "-curdir: "+LCASE(@curdir)
? "-scriptdir: "+LCASE(@scriptdir)
? "-startdir: "+LCASE(@startdir)
? "-"
? "-userid: "+LCASE(@userid)+"/"+LCASE(@wuserid)
? "-user priv: "+LCASE(@priv)
? "-version: inwin="+@inwin+"/dos="+@dos
? "-"

?"- 1-"+@time+"- @error @serror "? IF InGroup ("cohort99_00") <> 0
?"- 2-"+@time+"- @error @serror "? USE u: /del
?"- 3-"+@time+"- @error @serror "? USE u: "\\Utility-server\99"
?"- 4-"+@time+"- @error @serror "? ENDIF
?"- 5-"+@time+"- @error @serror "? IF InGroup ("cohort97_98") <> 0
?"- 6-"+@time+"- @error @serror "? USE u: /del
?"- 7-"+@time+"- @error @serror "? USE u: "\\Utility-server\97"
?"- 8-"+@time+"- @error @serror "? ENDIF
?"- 9-"+@time+"- @error @serror "? IF InGroup ("cohort98_99") <> 0
?"- 10-"+@time+"- @error @serror "? USE u: /del
?"- 11-"+@time+"- @error @serror "? USE u: "\\Utility-server\98"
?"- 12-"+@time+"- @error @serror "? ENDIF
?"- 13-"+@time+"- @error @serror "? IF InGroup ("cohort00") <> 0
?"- 14-"+@time+"- @error @serror "? USE u: /del
?"- 15-"+@time+"- @error @serror "? USE u: "\\Utility-server\00"
?"- 16-"+@time+"- @error @serror "? ENDIF
?"- 17-"+@time+"- @error @serror "? IF InGroup ("cohort01") <> 0
?"- 18-"+@time+"- @error @serror "? USE u: /del
?"- 19-"+@time+"- @error @serror "? USE u: "\\Utility-server\01"
?"- 20-"+@time+"- @error @serror "? ENDIF
?"- 21-"+@time+"- @error @serror "? IF InGroup ("school staff") <> 0
?"- 22-"+@time+"- @error @serror "? USE k: /del
?"- 23-"+@time+"- @error @serror "? USE l: /del
?"- 24-"+@time+"- @error @serror "? USE m: /del
?"- 25-"+@time+"- @error @serror "? USE n: /del
?"- 26-"+@time+"- @error @serror "? USE o: /del
?"- 27-"+@time+"- @error @serror "? USE r: /del
?"- 28-"+@time+"- @error @serror "? USE k: "\\Utility-server\kudos"
?"- 29-"+@time+"- @error @serror "? USE l: "\\Utility-server\careerscape"
?"- 30-"+@time+"- @error @serror "? ;USE l: "\\curriculum\rivers"
?"- 31-"+@time+"- @error @serror "? USE m: "\\admin-server\y72001"
?"- 32-"+@time+"- @error @serror "? USE n: "\\admin-server\y92001"
?"- 33-"+@time+"- @error @serror "? USE o: "\\Utility-server\shared"
?"- 34-"+@time+"- @error @serror "? USE r: "\\admin-server\reports"
?"- 35-"+@time+"- @error @serror "? ENDIF
?"- 36-"+@time+"- @error @serror "? IF InGroup ("school students") <> 0
?"- 37-"+@time+"- @error @serror "? USE g: /del
?"- 38-"+@time+"- @error @serror "? USE i: /del
?"- 39-"+@time+"- @error @serror "? USE k: /del
?"- 40-"+@time+"- @error @serror "? USE l: /del
?"- 41-"+@time+"- @error @serror "? USE m: /del
?"- 42-"+@time+"- @error @serror "? USE o: /del
?"- 43-"+@time+"- @error @serror "? USE r: /del
?"- 44-"+@time+"- @error @serror "? USE s: /del
?"- 45-"+@time+"- @error @serror "? USE t: /del
?"- 46-"+@time+"- @error @serror "? USE g: "\\Utility-server\itskills"
?"- 47-"+@time+"- @error @serror "? USE i: "\\cdromserver\sschool"
?"- 48-"+@time+"- @error @serror "? USE k: "\\Utility-server\kudos"
?"- 49-"+@time+"- @error @serror "? USE l: "\\curriculum\rivers"
?"- 50-"+@time+"- @error @serror "? USE m: "\\Utility-server\omnigraph"
?"- 51-"+@time+"- @error @serror "? USE o: "\\Utility-server\shared"
?"- 52-"+@time+"- @error @serror "? USE r: "\\Utility-server\roa$"
?"- 53-"+@time+"- @error @serror "? USE s: "\\Utility-server\careerscape"
?"- 54-"+@time+"- @error @serror "? ENDIF
?"- 55-"+@time+"- @error @serror "? IF InGroup ("domain admins") <> 0
?"- 56-"+@time+"- @error @serror "? ;;run "\\Utility-server\shared\ranger\setup.exe"
?"- 57-"+@time+"- @error @serror "? USE i: /del
?"- 58-"+@time+"- @error @serror "? USE p: /del
?"- 59-"+@time+"- @error @serror "? USE r: /del
?"- 60-"+@time+"- @error @serror "? USE t: /del
?"- 61-"+@time+"- @error @serror "? USE z: /del
?"- 62-"+@time+"- @error @serror "? USE i: "\\cdromserver\sschool"
?"- 63-"+@time+"- @error @serror "? USE p: "\\cdromserver\office97"
?"- 64-"+@time+"- @error @serror "? USE r: "\\admin-server\reports"
?"- 65-"+@time+"- @error @serror "? USE t: "\\cdromserver\quickcad"
?"- 66-"+@time+"- @error @serror "? USE z: "\\backup server\cdrom"
?"- 67-"+@time+"- @error @serror "? ENDIF
?"- 68-"+@time+"- @error @serror "? IF InGroup ("sims") <> 0
?"- 69-"+@time+"- @error @serror "? USE s: /del
?"- 70-"+@time+"- @error @serror "? USE s: "\\admin-server\applicat"
?"- 71-"+@time+"- @error @serror "? ENDIF
?"- 72-"+@time+"- @error @serror "? IF InGroup ("Food") <> 0
?"- 73-"+@time+"- @error @serror "? USE p: /del
?"- 74-"+@time+"- @error @serror "? USE p: "\\cdromserver\the can"
?"- 75-"+@time+"- @error @serror "? ENDIF
?"- 76-"+@time+"- @error @serror "? IF InGroup ("PrimarySchool") <> 0
?"- 77-"+@time+"- @error @serror "? USE o: /del
?"- 78-"+@time+"- @error @serror "? USE o: "\\Utility-server\shared"
?"- 79-"+@time+"- @error @serror "? ENDIF
?"- 80-"+@time+"- @error @serror "? GOSUB set_printers
?"- 81-"+@time+"- @error @serror "? EXIT
?"- 82-"+@time+"- @error @serror "? :set_printers
?"- 83-"+@time+"- @error @serror "? $sroom=Substr(@wksta,1,2) ; Room Prefix Tx
?"- 84-"+@time+"- @error @serror "? $ipcno=Substr(@wksta,3,9) ; Simple sequential PC number.
?"- 85-"+@time+"- @error @serror "? "This is PC number " $ipcno " in room number " $sroom ?
?"- 86-"+@time+"- @error @serror "? SELECT
?"- 87-"+@time+"- @error @serror "? CASE
$sroom = "T8"
?"- 88-"+@time+"- @error @serror "? USE lpt1: "\\curriculum\T8Colour"
?"- 89-"+@time+"- @error @serror "? USE lpt2: "\\curriculum\Pagepro4100"
?"- 90-"+@time+"- @error @serror "? CASE
$sroom = "T9"
?"- 91-"+@time+"- @error @serror "? USE lpt1: "\\curriculum\T9colour"
?"- 92-"+@time+"- @error @serror "? USE lpt2: "\\curriculum\T9black"
?"- 93-"+@time+"- @error @serror "? CASE
$sroom = "T7"
?"- 94-"+@time+"- @error @serror "? USE lpt1: "\\curriculum\T7Colour"
?"- 95-"+@time+"- @error @serror "? USE lpt2: "\\curriculum\T7black"
?"- 96-"+@time+"- @error @serror "? CASE
1
?"- 97-"+@time+"- @error @serror "? ? "No printer mapped - room not recognised"
?"- 98-"+@time+"- @error @serror "? ENDSELECT
?"- 99-"+@time+"- @error @serror "? RETURN

?"- end-"+@time+"- @error @serror "?
? "-"
? "-"+LCASE(@day)+" "+@date+" "+@time+"- kixtart "+@kix+"/3.00e script ending."
? "-"
;($begin)
;
; mon 11-feb-2002 04:26:13 (kix 4.00 vs 3.00e)
;
;Informative KIXSTRIP: no errors found (input=99 output=99 skip=0).
;
;Summary KIXSTRIP: block structures
; - do:until [0:0]
; - for|each:in|to:step|next [0|0:0|0:0|0]
; - function:endfunction [0:0]
; - if:else:endif [11:0:11]
; - select:case:endselect [1:4:1]
; - while:loop [0:0]
;Informative KIXSTRIP: 12 block_structures found.
;Informative KIXSTRIP: no UDF's found.
;Informative KIXSTRIP: 1 label found.
;Summary KIXSTRIP: BREAK CALL DEBUG DISPLAY ENDFUNCTION EXECUTE EXIT FUNCTION GET GETS GOSUB GOTO OLExxx PLAY QUIT RETURN RUN SHELL SLEEP THEN USE
;Informative KIXSTRIP: 1 EXIT
;Informative KIXSTRIP: 1 GOSUB
;Informative KIXSTRIP: 1 RETURN
;Informative KIXSTRIP: 61 USE
;
;($end)



When you have still problems: please run our debug version and put the output
of file C:\KIXDEBUG.TXT on the board.
greetings.


btw: debugging was added with kix400strip input.kix output.kix /debug.
the kix400strip.exe program can be find on our site.

_________________________
email scripting@wanadoo.nl homepage scripting@wanadoo.nl | Links | Summary of Site Site KiXforms FAQ kixtart.org library collection mirror MCA | FAQ & UDF help file UDF kixtart.org library collection mirror MCA | mirror USA | mirror europe UDF scriptlogic library collection UDFs | mirror MCA

Top
Page 1 of 1 1


Moderator:  Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, 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.123 seconds in which 0.097 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