1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
| <html>
<head>
<title>Local Users</title>
<HTA:APPLICATION
ID="objHTAHelpomatic"
APPLICATIONNAME="LocalUsers"
SCROLL="yes"
SINGLEINSTANCE="yes"
WINDOWSTATE="normal"
>
</head>
<SCRIPT Language="VBScript">
'Get the current path
sCurPath = CreateObject("Scripting.FileSystemObject").GetAbsolutePathName(".")
Sub Window_Onload
Set Userlist = CreateObject("Scripting.FileSystemObject")
Set Userlistf = Userlist.OpenTextFile(sCurPath & "\List.csv", 1)
Dim arrUsers ()
ReDim arrUsers(7, 0)
Do While Not Userlistf.AtEndOfStream
'les lignes sont splitées par "," en colonne (arrTemp)
arrTemp = Split(Userlistf.ReadLine, ",")
i = 0
'Compte seulement les deux premières colonnes (Nom Prenom)
boolUserFind = False
If arrTemp(1) = arrUsers(0, i) Then boolUserFind = True
If arrTemp(2) = arrUsers(1, i) Then boolUserFind = True
Do While boolUserFind = False AND i < Ubound(arrUsers, 2)
i = i + 1
If arrTemp(1) = arrUsers(0, i) Then boolUserFind = True
If arrTemp(2) = arrUsers(1, i) Then boolUserFind = True
Loop
Redim Preserve arrUsers (7, Ubound(arrUsers, 2) + 1)
arrUsers(0, Ubound(arrUsers, 2) - 1) = arrTemp(1)
arrUsers(1, Ubound(arrUsers, 2) - 1) = arrTemp(2)
arrUsers(6, Ubound(arrUsers, 2) - 1) = arrTemp(6)
Loop
Redim Preserve arrUsers (7, Ubound(arrUsers, 2) - 1)
'Pour chaque ligne récupère 1ère, 2ème et 7ème colonne
strTemp = ""
For i = 0 To Ubound(arrUsers, 2)
strTemp = arrUsers(0, i) & " " & arrUsers(1, i) & vbcrlf
strTemp2 = arrUsers(6, i) & vbcrlf
'Créer les deux dropdownlists
Set objOption = Document.createElement("OPTION")
objOption.Text = strTemp
objOption.Value = strTemp
LocalUsers.Add(objOption)
Set objOption2 = Document.createElement("OPTION")
objOption2.Text = strTemp2
objOption2.Value = strTemp2
Projects.Add(objOption2)
Next
End Sub
function doThing(v)
set csel=document.getElementsByName("Projects")
if csel.length<>0 then
if strcomp(csel(0).tagName, "select", 1)=0 then
csel(0).selectedIndex=v
end if
end if
set csel=nothing
end function
</SCRIPT>
<body>
<select name="LocalUsers" onchange="doThing(me.selectedIndex)">
</select>
<select name="Projects">
</select>
</body>
</html> |
Partager