Page 1 of 1 1
Topic Options
#182371 - 2007-11-09 02:32 AM Please help new to scripting
rabbit26 Offline
Lurker

Registered: 2007-11-09
Posts: 2
Hi all
I currently use a bat file to connect shares


net use s: \\server1\share\students\Grade1
net use u: \\server1\share\Games
net use z: \\server1\share\scanner
net use y: \\mirror\cd5039
net use x: \\mirror\cd5002
net use W: \\mirror\cd5040
net use V: \\mirror\cd5031
net use R: \\mirror\cd5032



Assign Printers
; -----------------------------------------------------------

:AssignPrinters

? "Assigning Printers... "


; Add these printers....

$temp_str = substr(@WKSTA,1,3)

select


;Computer Room
case $temp_str = "Comprm-"
AddPrinterConnection("\\server1\Hp Computer Room")


SetDefaultPrinter("\\server1\Hp Computer Room")

Return

Return



how do i combine these 2 into one working script
and have I used the printer script correctly

any help would be appriciated
thanks

Top
#182373 - 2007-11-09 04:00 AM Re: Please help new to scripting [Re: rabbit26]
Gargoyle Offline
MM club member
*****

Registered: 2004-03-09
Posts: 1597
Loc: Valley of the Sun (Arizona, US...
 Code:
use s: \\server1\share\students\Grade1
use u: \\server1\share\Games 
use z: \\server1\share\scanner
use y: \\mirror\cd5039
use x: \\mirror\cd5002
use W: \\mirror\cd5040
use V: \\mirror\cd5031
use R: \\mirror\cd5032
Assign Printers
; -----------------------------------------------------------

:AssignPrinters

? "Assigning Printers... "


; Add these printers.... 

$temp_str = substr(@WKSTA,1,3)

select


;Computer Room
case $temp_str = "Comprm-"
  AddPrinterConnection("\\server1\Hp Computer Room")
  SetDefaultPrinter("\\server1\Hp Computer Room")
case 1
  ;Do Nothing - Handles any unexpected returns of Case add you own code here
EndSelect


From your posting it looks like you may be using "GoTo", learn about User Defined Functions, much cleaner and easier to debug and change.
_________________________
Today is the tomorrow you worried about yesterday.

Top
#182377 - 2007-11-09 06:04 AM Re: Please help new to scripting [Re: Gargoyle]
rabbit26 Offline
Lurker

Registered: 2007-11-09
Posts: 2
How do I get the bat to call the kix script
Top
#182378 - 2007-11-09 07:25 AM Re: Please help new to scripting [Re: rabbit26]
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11624
Loc: CA
KiXtart does not need a batch file to run it from Logon unless you're using Windows 9x

KIX32.EXE yourscript.kix


But you can run from a batch

Example:
 Code:
@ECHO OFF
C:\SCRIPTS\KIX32.EXE C:\TEST\MYSCRIPT.KIX

Top
#182405 - 2007-11-09 06:44 PM Re: Please help new to scripting [Re: NTDOC]
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
Don't forget to put a semicolumn in front of the next line:
 Code:
;Assign Printers

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 369 anonymous users online.
Newest Members
rrosell, PatrickPinto, Raoul, Timothy, Jojo67
17877 Registered Users

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