Hi,
I am new to VBScript, but I am trying to create a logon script that will recognize a user the first time they log on, and present them with a HTML "interview" which asks them what printers they would like to be mapped to, as well as other things. The page will write the results to a .ini file and another script will set up their environment based on the entries in that .ini file. I have figured out how to do this functionality with all other items on the interview, except a large number of checkboxes in the Form, each of which stand for a Printer. I turn the results of this into an array in my VBScript. What is not working for me is I am getting the name of the field that I want the value of, not the value that I want. I want AddPrinter = True, but I am getting AddPrinter = Document.FirstTimeLogonForm.OEQMS1.Checked . Any suggestions. I am sure it is something easy, but like I said I am new. I have attatched the script below.
Thanks,
Michael Nass
<SCRIPT LANGUAGE="VBScript">
<!--
Sub SubmitFirstTimeLogon_OnClick
on error resume next
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Dim fso, f
set adsys = CreateObject("ADSystemInfo"
set wscr = CreateObject("WScript.Network"
outputfile = "W:\" & "FTLI.ini"
Set fso = CreateObject("Scripting.FileSystemObject"
Set f = fspenTextFile(outputfile, ForWriting, True)
Dim AddPrinterStr
Dim AddPrinterNme
Dim AddPrinterChk
Dim Printer
Dim AddPrinterArray
' *** Add Additional Printers ***
FormPrefix = "Document.FirstTimeLogonForm."
Printer1 = FormPrefix & "OEQMS1"
Printer2 = FormPrefix & "OEQMS2"
Printer3 = FormPrefix & "OEQMS3"
Printer4 = FormPrefix & "OEQMS4"
Printer5 = FormPrefix & "OEQMS5"
Printer6 = FormPrefix & "OEQMS6"
Printer7 = FormPrefix & "OEQMS7"
Printer8 = FormPrefix & "OEQMS8"
Printer9 = FormPrefix & "OEQMS9"
Printer10 = FormPrefix & "OEQMS10"
Printer11 = FormPrefix & "OEQMS11"
Printer12 = FormPrefix & "OEQMS12"
Printer13 = FormPrefix & "OEQMS13"
Printer14 = FormPrefix & "OEQMS14"
Printer15 = FormPrefix & "OEQMS15"
Printer16 = FormPrefix & "OEQMS16"
Printer17 = FormPrefix & "OEQMS17"
Printer18 = FormPrefix & "OEQMS18"
Printer19 = FormPrefix & "OEQMS19"
Printer20 = FormPrefix & "OEQMS20"
Printer21 = FormPrefix & "OEQMS21"
Printer22 = FormPrefix & "OEQMS22"
Printer23 = FormPrefix & "OEQMS23"
Printer24 = FormPrefix & "OEQMS26"
Printer25 = FormPrefix & "OEQMS27"
Printer26 = FormPrefix & "COLOR-2N"
Printer27 = FormPrefix & "COLOR-2S"
Printer28 = FormPrefix & "COLOR-3N"
Printer29 = FormPrefix & "COLOR-3S"
Printer30 = FormPrefix & "HPCOLOR-1"
Printer31 = FormPrefix & "HPCOLOR-2"
Printer32 = FormPrefix & "HPCOLOR-3"
Printer33 = FormPrefix & "HPCOLOR-4"
Printer34 = FormPrefix & "HPCOLOR-5"
Printer35 = FormPrefix & "HPCOLOR-6"
Printer36 = FormPrefix & "HPCOLOR-7"
Printer37 = FormPrefix & "HPCOLOR-8"
Printer38 = FormPrefix & "HPLJ-1"
Printer39 = FormPrefix & "HPLJ-2"
Printer40 = FormPrefix & "HPLJ-3"
Printer41 = FormPrefix & "HPLJ-4"
Printer42 = FormPrefix & "HPLJ-5"
Printer43 = FormPrefix & "HPLJ-6"
Printer44 = FormPrefix & "HPLJ-7"
Printer45 = FormPrefix & "HPLJ-8"
Printer46 = FormPrefix & "HPLJ-9"
Printer47 = FormPrefix & "HPLJ-11"
Printer48 = FormPrefix & "HPLJ-12"
Printer49 = FormPrefix & "HPLJ-13"
Printer50 = FormPrefix & "HPLJ-14"
Printer51 = FormPrefix & "HPLJ-16"
Printer52 = FormPrefix & "HPLJ-17"
Printer53 = FormPrefix & "HPLJ-18"
Printer54 = FormPrefix & "HPLJ-19"
Printer55 = FormPrefix & "HPLJ-22"
Printer56 = FormPrefix & "HPLJ-23"
Printer57 = FormPrefix & "HPLJ-25"
Printer58 = FormPrefix & "HPLJ-27"
Printer59 = FormPrefix & "HPLJ-28"
Printer60 = FormPrefix & "HPLJ-29"
Printer61 = FormPrefix & "HPLJ-30"
Printer62 = FormPrefix & "HPLJ-32"
Printer63 = FormPrefix & "HPLJ-33"
Printer64 = FormPrefix & "XEROX-8830"
AddPrinterArray = Array(Printer1,Printer2,Printer3,Printer4,Printer5,Printer6,Print
er7,Printer8,Printer9,Printer10,Printer11,Printer12,Printer1
3,Printer14,Printer15,Printer16,Printer17,Printer18,Printer1
9,Printer20,Printer21,Printer22,Printer23,Printer24,Printer2
5,Printer26,Printer27,Printer28,Printer29,Printer30,Printer3
1,Printer32,Printer33,Printer34,Printer35,Printer36,Printer3
7,Printer38,Printer39,Printer40,Printer41,Printer42,Printer4
3,Printer44,Printer45,Printer46,Printer47,Printer48,Printer4
9,Printer50,Printer51,Printer52,Printer53,Printer54,Printer5
5,Printer56,Printer57,Printer58,Printer59,Printer60,Printer6
1,Printer62,Printer63,Printer64)
For Each Printer in AddPrinterArray
AddPrinterVal = Printer & ".Value"
AddPrinterNme = Printer & ".Name"
AddPrinterChk = Printer & ".Checked"
'line = AddPrinterNme & "=" & AddPrinterVal
'If AddPrinterChk = "True" Then
MsgBox "=" & AddPrinterChk, 0, "Value"
'f.Writeline line
'End If
Next
f.close
End Sub
-->
</SCRIPT>
I am new to VBScript, but I am trying to create a logon script that will recognize a user the first time they log on, and present them with a HTML "interview" which asks them what printers they would like to be mapped to, as well as other things. The page will write the results to a .ini file and another script will set up their environment based on the entries in that .ini file. I have figured out how to do this functionality with all other items on the interview, except a large number of checkboxes in the Form, each of which stand for a Printer. I turn the results of this into an array in my VBScript. What is not working for me is I am getting the name of the field that I want the value of, not the value that I want. I want AddPrinter = True, but I am getting AddPrinter = Document.FirstTimeLogonForm.OEQMS1.Checked . Any suggestions. I am sure it is something easy, but like I said I am new. I have attatched the script below.
Thanks,
Michael Nass
<SCRIPT LANGUAGE="VBScript">
<!--
Sub SubmitFirstTimeLogon_OnClick
on error resume next
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Dim fso, f
set adsys = CreateObject("ADSystemInfo"
set wscr = CreateObject("WScript.Network"
outputfile = "W:\" & "FTLI.ini"
Set fso = CreateObject("Scripting.FileSystemObject"
Set f = fspenTextFile(outputfile, ForWriting, True)
Dim AddPrinterStr
Dim AddPrinterNme
Dim AddPrinterChk
Dim Printer
Dim AddPrinterArray
' *** Add Additional Printers ***
FormPrefix = "Document.FirstTimeLogonForm."
Printer1 = FormPrefix & "OEQMS1"
Printer2 = FormPrefix & "OEQMS2"
Printer3 = FormPrefix & "OEQMS3"
Printer4 = FormPrefix & "OEQMS4"
Printer5 = FormPrefix & "OEQMS5"
Printer6 = FormPrefix & "OEQMS6"
Printer7 = FormPrefix & "OEQMS7"
Printer8 = FormPrefix & "OEQMS8"
Printer9 = FormPrefix & "OEQMS9"
Printer10 = FormPrefix & "OEQMS10"
Printer11 = FormPrefix & "OEQMS11"
Printer12 = FormPrefix & "OEQMS12"
Printer13 = FormPrefix & "OEQMS13"
Printer14 = FormPrefix & "OEQMS14"
Printer15 = FormPrefix & "OEQMS15"
Printer16 = FormPrefix & "OEQMS16"
Printer17 = FormPrefix & "OEQMS17"
Printer18 = FormPrefix & "OEQMS18"
Printer19 = FormPrefix & "OEQMS19"
Printer20 = FormPrefix & "OEQMS20"
Printer21 = FormPrefix & "OEQMS21"
Printer22 = FormPrefix & "OEQMS22"
Printer23 = FormPrefix & "OEQMS23"
Printer24 = FormPrefix & "OEQMS26"
Printer25 = FormPrefix & "OEQMS27"
Printer26 = FormPrefix & "COLOR-2N"
Printer27 = FormPrefix & "COLOR-2S"
Printer28 = FormPrefix & "COLOR-3N"
Printer29 = FormPrefix & "COLOR-3S"
Printer30 = FormPrefix & "HPCOLOR-1"
Printer31 = FormPrefix & "HPCOLOR-2"
Printer32 = FormPrefix & "HPCOLOR-3"
Printer33 = FormPrefix & "HPCOLOR-4"
Printer34 = FormPrefix & "HPCOLOR-5"
Printer35 = FormPrefix & "HPCOLOR-6"
Printer36 = FormPrefix & "HPCOLOR-7"
Printer37 = FormPrefix & "HPCOLOR-8"
Printer38 = FormPrefix & "HPLJ-1"
Printer39 = FormPrefix & "HPLJ-2"
Printer40 = FormPrefix & "HPLJ-3"
Printer41 = FormPrefix & "HPLJ-4"
Printer42 = FormPrefix & "HPLJ-5"
Printer43 = FormPrefix & "HPLJ-6"
Printer44 = FormPrefix & "HPLJ-7"
Printer45 = FormPrefix & "HPLJ-8"
Printer46 = FormPrefix & "HPLJ-9"
Printer47 = FormPrefix & "HPLJ-11"
Printer48 = FormPrefix & "HPLJ-12"
Printer49 = FormPrefix & "HPLJ-13"
Printer50 = FormPrefix & "HPLJ-14"
Printer51 = FormPrefix & "HPLJ-16"
Printer52 = FormPrefix & "HPLJ-17"
Printer53 = FormPrefix & "HPLJ-18"
Printer54 = FormPrefix & "HPLJ-19"
Printer55 = FormPrefix & "HPLJ-22"
Printer56 = FormPrefix & "HPLJ-23"
Printer57 = FormPrefix & "HPLJ-25"
Printer58 = FormPrefix & "HPLJ-27"
Printer59 = FormPrefix & "HPLJ-28"
Printer60 = FormPrefix & "HPLJ-29"
Printer61 = FormPrefix & "HPLJ-30"
Printer62 = FormPrefix & "HPLJ-32"
Printer63 = FormPrefix & "HPLJ-33"
Printer64 = FormPrefix & "XEROX-8830"
AddPrinterArray = Array(Printer1,Printer2,Printer3,Printer4,Printer5,Printer6,Print
er7,Printer8,Printer9,Printer10,Printer11,Printer12,Printer1
3,Printer14,Printer15,Printer16,Printer17,Printer18,Printer1
9,Printer20,Printer21,Printer22,Printer23,Printer24,Printer2
5,Printer26,Printer27,Printer28,Printer29,Printer30,Printer3
1,Printer32,Printer33,Printer34,Printer35,Printer36,Printer3
7,Printer38,Printer39,Printer40,Printer41,Printer42,Printer4
3,Printer44,Printer45,Printer46,Printer47,Printer48,Printer4
9,Printer50,Printer51,Printer52,Printer53,Printer54,Printer5
5,Printer56,Printer57,Printer58,Printer59,Printer60,Printer6
1,Printer62,Printer63,Printer64)
For Each Printer in AddPrinterArray
AddPrinterVal = Printer & ".Value"
AddPrinterNme = Printer & ".Name"
AddPrinterChk = Printer & ".Checked"
'line = AddPrinterNme & "=" & AddPrinterVal
'If AddPrinterChk = "True" Then
MsgBox "=" & AddPrinterChk, 0, "Value"
'f.Writeline line
'End If
Next
f.close
End Sub
-->
</SCRIPT>