Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   JavaScript and Client-Side Browser Scripting (http://www.programmingforums.org/forum23.html)
-   -   my logon script HELP (http://www.programmingforums.org/showthread.php?t=8778)

forcerr Mar 9th, 2006 10:20 AM

my logon script HELP
 
gives me an error, and doesnt link the printers in KS1 or KS2, any ideas??

error is... Expected: Next


HELLPPP!!!

:

' -- West Vew Primary School --
' Classroom Logon Script
' 1. Maps Network Drives
' 2. Maps Printers
' 3. Sets correct printer, according to keystage
'----------------------------------------------------------

Option Explicit
Dim objNetwork, Printer1, Printer2, Printer3, PrinterDriver1, PrinterDriver2, PrinterDriver3, Server, adsDomainGroups


'-- Setting Objects --
Set objNetwork = CreateObject("WScript.Network")
Set adsDomainGroups = GetObject("WinNT://" & domain)

'-- Read security group membership --
adsDomainGroups.Filter = Array("Group")
For Each adsGroup in adsDomainGroups
 Group = UCase(adsgroup.name)


'-- Removes the networked drives --
 On Error Resume Next
objNetwork.RemoveNetworkDrive "s:"
objNetwork.RemoveNetworkDrive "x:"



'-- Connects Printers --
Printer1 = "\\server\IT1"
Printer2 = "\\server\IR1600"
Printer3 = "\\server\KS1Printer"
PrinterDriver1 = "HP Laserjet 1300 PCL 5e"
PrinterDriver2 = "Canon iR1600-2000 PCL5e"
PrinterDriver3 = "Brother HL-1450 series"
objNetwork.AddWindowsPrinterConnection Printer1, PrinterDriver1
objNetwork.AddWindowsPrinterConnection Printer2, PrinterDriver2
objNetwork.AddWindowsPrinterConnection Printer3, PrinterDriver3

if group = UCASE("ks1") then
        objNetwork.SetDefaultPrinter Printer3
elseif group = UCASE("ks2") then
        objNetwork.SetDefaultPrinter Printer1
end if


'-- Maps Drives --
Server = "\\server"
objNetwork.MapNetworkDrive "s:", server & "\software"
objNetwork.MapNetworkDrive "x:", server & "\shared"


WScript.Quit


Infinite Recursion Mar 9th, 2006 10:32 AM

sounds like your FOR loop is missing a NEXT statement...
for reference: http://www.w3schools.com/vbscript/vbscript_looping.asp

forcerr Mar 9th, 2006 10:37 AM

Quote:

Originally Posted by Infinite Recursion
sounds like your FOR loop is missing a NEXT statement...
for reference: http://www.w3schools.com/vbscript/vbscript_looping.asp

what for loop??? sorry i'm not experienced with VB SCript at all

Pizentios Mar 9th, 2006 11:09 AM

the for loop that you have in your code ofcourse :-P

this is your code
:

For Each adsGroup in adsDomainGroups
 Group = UCase(adsgroup.name)


this is what it should be:
:

For Each adsGroup in adsDomainGroups
 Group = UCase(adsgroup.name)
Next


forcerr Mar 9th, 2006 11:30 AM

ha, i didnt even see that, half asleep, long day...

now i get the error, variable is undefined 'domain', dont have a domain variable? :s

DaWei Mar 9th, 2006 11:57 AM

Get some sleep ;) .

jaspalmxtech Mar 9th, 2006 12:39 PM

must be missing something . . .

DaWei Mar 9th, 2006 12:45 PM

@ Mr. Singh:
Quote:

Originally Posted by Forum Rules
Signatures Rules:

1. NO images in signatures - Large flashing images in between every other sentence are the most annoying thing in the world, therefore absolutely NO images are allowed in forum signatures.

2. Maximum length - The maximum length of a forum signature is 4 to 5 lines.

3. Font size - Please don’t increase font size beyond the default text size.

4. Links - You may link to your site, but no affiliate, drug, pornographic, hacking, warez, or otherwise offensive links allowed.

5. Language - All forum signatures must be in English.

You might read the rules regarding spamming, also, though there is room for interpretation there.

Infinite Recursion Mar 9th, 2006 3:03 PM

Holy shit... could you reduce the font size on the name please?

forcerr Mar 10th, 2006 4:24 AM

dnt hi-jack my thread pls, pm's are for stuff like that, anyway can anyone see any problems coz i cnt???


All times are GMT -5. The time now is 12:54 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC