Hallo
Ich habe ein Skript programmiert weleches bei 5 PC funktioniert. Aber bei einem PC funktioniert es nicht.
Beim ausführen kommt ein Laufzeitfehler auf Zeile 53 (Typkonflikt). Irgendwie macht es mir den anschein das Skript ist korrekt und der Fehler liegt am PC. Aber das Gerät ist neu aufgesetzt.
Danke für euer Feedback
Hier das Skript
<head>
<title>Persönliche Netzlaufwerke hinzufügen</title>
<style type="text/css">
body {background-color: #FFFFFF; font-family: verdana, verdana, _
sans-serif;}
h1 {
font-family: verdana, verdana, sans-serif;
}
td {
font-family: verdama, verdana, sans-serif;
}
</style>
<HTA:APPLICATION
APPLICATIONNAME="Persönliche Netzlaufwerke hinzufügen"
SCROLL="no"
WINDOWSTATE="normal"
SysMenu ="Yes"
CAPTION="yes"
>
<SCRIPT LANGUAGE="VBScript">
<!--
'Passt Grösse und Position von Fenster an
Sub Window_Onload
window.resizeTo 600,420
strComputer = "."
Set objWMIService = GetObject("Winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * From Win32_DesktopMonitor")
For Each objItem in colItems
intHorizontal = objItem.ScreenWidth
intVertical = objItem.ScreenHeight
Next
intLeft = (intHorizontal - 600) / 2
intTop = (intVertical - 600) / 2
window.moveTo intLeft, intTop
End Sub
'Wird ausgeführt wenn man auf den Anmelde Button drückt
Sub Uebermitteln_OnClick
Dim DasFormular
Set DasFormular= Document.gueltigesFormular
'überprft ob beide Felder ausgefüllt sind
If (DasFormular.Text1.Value)= Empty OR (DasFormular.Text2.Value) = Empty Then
MsgBox "Bitte füllen Sie alle Felder aus"
Else
'Unmount alle Netzlaufwerke
set shell = CreateObject("WScript.Shell")
Return = shell.run ("net use * /d /y", 0, True)
ccSleep 2
'Mount alle Netzlaufwerke mit Username
set shell = CreateObject("WScript.Shell")
Return = shell.run ("net use S: \\choffice02\BB_Spezial /user:ch\" & _
DasFormular.Text1.Value & " " & DasFormular.Text2.Value & " /persistent:no", _
0, True)
Return = shell.run ("net use M: \\choffice01\Home\" &DasFormular.Text1.Value _
& " /user:ch\" & DasFormular.Text1.Value & " " & DasFormular.Text2.Value & "" & _
"/persistent:no", 0, True)
Return = shell.run ("net use N: \\choffice02\BB_Vorlagen /user:ch\" & _
DasFormular.Text1.Value & " " & DasFormular.Text2.Value & " /persistent:no", 0, _
True)
Return = shell.run ("net use O: \\choffice02\BB_Bereiche /user:ch\" & _
DasFormular.Text1.Value & " " & DasFormular.Text2.Value & " /persistent:no", _
0, True)
Return = shell.run ("net use P: \\choffice02\BB_Projekte /user:ch\" & _
DasFormular.Text1.Value & " " & DasFormular.Text2.Value & " /persistent:no", 0, _
True)
Return = shell.run ("net use Q: \\choffice02\BB_Open /user:ch\" & _
DasFormular.Text1.Value & " " & DasFormular.Text2.Value & " /persistent:no", 0, _
True)
Return = shell.run ("net use S: \\choffice02\BB_Spezial /user:ch\" & _
DasFormular.Text1.Value & " " & DasFormular.Text2.Value & " /persistent:no", 0, _
True)
Return = shell.run ("net use t: \\choffice02\Print-out /user:ch\" & _
DasFormular.Text1.Value & " " & DasFormular.Text2.Value & " /persistent:no", 0, _
True)
IF (Return) = 0 Then
MsgBox("Erfolgreich angemeldet: Sie haben nun Ihre persönlichen Laufwerke")
self.close
Else
MsgBox("Fehler: Benutzername oder Passwort falsch")
End IF
End If
End Sub
'Sleep wird durchgeführt durch Ping
Sub ccSleep(seconds)
set oShell = CreateObject("Wscript.Shell")
cmd = "%COMSPEC% /c ping -n " & 1 + seconds & " 127.0.0.1>nul"
oShell.Run cmd,0,1
End Sub
' Wird ausgeführt wenn man auf den Abmelde Button klickt
Sub abmelden_OnClick
self.close
End Sub
-->
</SCRIPT>
</HEAD>
<BODY>
<FORM NAME="gueltigesFormular">
<table>
<tr>
<td height="100px" width="400px"><h1>Persönliches Login</h1></td>
<td><img src="C:\abo_makro\logo.jpg" width="159px" height="69px"></td>
</tr>
</table>
<hr> </hr>
<h1>Anmelden</h2>
<table>
<tr>
<td height="50x">Bitte geben Sie Ihren Anmeldenamen und Ihr Passwort ein. _
</td>
<td> </td>
</tr>
</table>
<table>
<tr>
<td width="150px">Benutzername: </td>
<td><INPUT NAME="Text1" TYPE="TEXT" SIZE="11"></td>
</tr>
<tr>
<td>Passwort: </td>
<td><INPUT NAME="Text2" TYPE="password" SIZE="11"></td>
</tr>
<tr>
<td> </td>
<td><INPUT NAME="Uebermitteln" TYPE="BUTTON" _
VALUE="anmelden"> <INPUT NAME="abmelden" TYPE="BUTTON" _
VALUE="abbrechen"></td>
</tr>
</table>
</FORM>
</BODY> |