Okay,
Basically, I have a lab setting where we have three printers. I’m trying to set it up like I did with the PC by using VBS but MAC doesn’t accept VBS. Here is the code that I used for PC:
’ **************************************************************************
’ * Program: printer_setup.vbs
’ * Purpose: Everything to do with printers
’ * add and remove printers
’ * Set default printer if needed
’ *
’ * Date: 9/12/2006
’ **************************************************************************
On Error Resume Next
Dim printer_color, printer_remove_color
printer_color = “\nissrv7\NLCprsclbjcolor01”
printer_remove_color = “\nissrv7\can1120”
Set wshNetwork = CreateObject(“Wscript.network”)
'remove old color queue
wshNetwork.RemovePrinterConnection printer_remove_color, true, false
'set new color queue
wshNetwork.AddWindowsPrinterConnection printer_color
'-----------------------------------------------------
'Set default printer depending on computer location
'-----------------------------------------------------
'Classroom 1 - NLCCR01
'Smart Classroom - NLCSC01
'Classroom 2 & 3 - NLCT01
'General Lab - NLC01
Dim computer, length, nlc, area, num
'Set printer path
Dim printer_1, printer_2, printer_special, printer_smart
printer_1 = “NLCPrint01”
printer_2 = “NLCPrint02”
printer_special = “NLCSpecial”
printer_smart = “NLCSmart”
computer = Trim(wshNetwork.ComputerName)
length = Len(computer)
nlc = Left(computer, 3)
area = Mid(computer, 4, 2)
num = CInt(Right(computer, 2))
'--------------------------
'Smart Classroom or Classroom #1
If(length = 7) Then
'Classroom #1
If (area = "CR") Then
wshNetwork.SetDefaultPrinter printer_special
'Smart Classroom
ElseIf (area = "SC") Then
wshNetwork.SetDefaultPrinter printer_smart
'Everything else
Else
wshNetwork.SetDefaultPrinter printer_special
End If
'--------------------------
'Classroom #2 #3
ElseIf (length = 6) Then
wshNetwork.SetDefaultPrinter printer_1
'--------------------------
'General Lab
ElseIf (length = 5) Then
'Between PC-1 and PC-7 - Carrels
If (num <= 7) Then
wshNetwork.SetDefaultPrinter printer_1
'Between PC-8 and PC-13 - Carrels
ElseIf (num >= 8 And num <= 13) Then
wshNetwork.SetDefaultPrinter printer_2
'Between PC-14 and PC-24 - Right side of NLC facing entrance door
ElseIf (num >= 14 And num <= 24) Then
wshNetwork.SetDefaultPrinter printer_1
'Between PC-25 and PC-32
ElseIf (num >= 25 And num <=32) Then
wshNetwork.SetDefaultPrinter printer_2
'Above PC-33 - NCE Area
ElseIf (num >= 33) Then
wshNetwork.SetDefaultPrinter printer_special
'All other computers default to special printer
Else
wshNetwork.SetDefaultPrinter printer_special
End If
'--------------------------
'Everything else
Else
wshNetwork.SetDefaultPrinter printer_special
End If
Now, I need to convert this to AppleScript which I’m not even familiar with but been trying to learn it. Anyhow, the purpose of this script is to locate the nearest printer and set it as default to make it easier for the peers in the lab. Thanks agian for your help.
Regards,
Bryson