Hallo,
Habe wiedermal ein kleines Problem.
Ich habe eine GUI mit 6 Tabs (Zeile 54),
lege ein Kontextmenü auf die ganze Tabreihe (also nicht jedes Tab sondern die ganze reihe hat ein Kontextmenü)(das wird auch noch richtig angezeigt)(Zeile 59),
und dann kommt die Abfrage (und die funktioniert wieder nicht, also ohne Fehler oder sonst was, es wird einfach nicht in die Abfrage hineingesprungen)(Zeile 173)
Hier die Source:
Spoiler anzeigen
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=Icon.ico
#AutoIt3Wrapper_Res_Icon_Add=Icon.ico
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#cs ----------------------------------------------------------------------------
AutoIt Version: 3.3.8.1
Author: Palmers Julian
Script Function:
Dieses Programm soll visuell zeigen, welche Computer in welchem Stockwerk online sind.
#ce ----------------------------------------------------------------------------
#include <Array.au3>
#include <GUIConstantsEx.au3>
#include <EditConstants.au3>
#include <Constants.au3>
#include "files.au3"
TraySetIcon($tempPath&"Icon.ico")
TraySetToolTip("Plasser&&&Theurer"&@CRLF&"WhoIsInTheHouse"&@CRLF&"written by Palmers Julian, 2013")
Opt("TrayAutoPause", 0) ;0=no pause, 1=Pause
TrayItemSetText($TRAY_ITEM_PAUSE, "Pausieren")
TrayItemSetText($TRAY_ITEM_EXIT, "Beenden")
Opt("TCPTimeout", 25)
_logThis("Programm wurde gestartet")
global $s1=0, $s2=0, $raumnummer[100], $person[200][2], $online[2], $javaVersion[200], $flashVersion[200], $readerVersion[200], $contextmenu, $labelContext[200], $contextmenuitemI[200][11]
$iniPath = @ScriptDir&"\Config.ini"
$imagePath = $tempPath
$imageEndung = "jpg"
#region Paths
$javaPath86 = IniRead($iniPath,"Paths","java86","\C$\Windows\System32\java.exe")
$javaPath64 = IniRead($iniPath,"Paths","java64","\C$\Windows\SysWOW64\java.exe")
$flashPath86 = IniRead($iniPath,"Paths","flash86","\C$\Windows\System32\FlashPlayerApp.exe")
$flashPath64 = IniRead($iniPath,"Paths","flash64","\C$\Windows\SysWOW64\FlashPlayerApp.exe")
$readerPath86 = IniRead($iniPath,"Paths","reader86","\C$\Program Files\Adobe\Reader 11.0\Reader\AcroRd32.exe")
$readerPath64 = IniRead($iniPath,"Paths","reader64","\C$\Program Files (x86)\Adobe\Reader 11.0\Reader\AcroRd32.exe")
#endregion
if $cmdline[0]=0 Then
$selectedFloor = Int(IniRead($iniPath,"Look","stdFloor","0"))
ElseIf $cmdline[0]= 1 Then
if ($cmdline[1]>=0 AND $cmdline[1]<=5) Then
$selectedFloor = $cmdline[1]
Else
MsgBox(16,"Error","Das gewählte Stockwerk ("&$cmdline[1]&") gibt es nicht!"&@CRLF&"Das Programm wird beendet.")
_exit("0x002")
EndIf
EndIf
$windowSize = StringSplit(IniRead($iniPath,"Look","windowSize","900%700"),"%",2)
$tabSize = StringSplit(IniRead($iniPath,"Look","tabSize","700%700"),"%",2)
$bmpSize = StringSplit(IniRead($iniPath,"Look","bmpSize","700%700"),"%",2)
$hWnd = GUICreate("WhoIsInTheHouse", $windowSize[0], $windowSize[1])
$console = GUICtrlCreateInput("0. Stock", 0, $windowSize[1]-25, $windowSize[0], 25, $ES_READONLY)
$image = GUICtrlCreatePic($imagePath&"\0."&$imageEndung, 2, 25, $tabSize[0]-30, $tabSize[1]-30)
GUICtrlSetState($image,$GUI_DISABLE)
$tab = GUICtrlCreateTab(0, 0, $tabSize[0], $tabSize[1])
local $tabs[7]
For $i=0 To 5
$tabs[$i] = GUICtrlCreateTabItem($i&". Stock")
Next
$tabs[6] = GUICtrlCreateTabItem("Aktualisieren")
$mainContextMenu = GUICtrlCreateContextMenu($tab)
local $mainContextMenuItem[5] ;Hauptkontextmenü
$mainContextMenuItem[0] = GUICtrlCreateMenuItem("create Computer", $mainContextMenu) ;neuen Computer erstellen
$mainContextMenuItem[1] = GUICtrlCreateMenuItem("edit Computer", $mainContextMenu) ;vorhandenen Computer bearbeiten
$mainContextMenuItem[2] = GUICtrlCreateMenuItem("delete Computer", $mainContextMenu) ;vorhanden Computer löschen
$mainContextMenuItem[3] = GUICtrlCreateMenuItem("", $mainContextMenu) ;Strich
$mainContextMenuItem[4] = GUICtrlCreateMenuItem("show Log", $mainContextMenu) ;show Log-File
GUICtrlSetState($tabs[$selectedFloor],$GUI_SHOW)
GUISetState()
$whoIsWhoIni = IniReadSection($iniPath,"WhoIsWho")
$j = $whoIsWhoIni[0][0]
local $whoIsWho[$j-1][7]
For $i=2 To $j
$data = StringSplit($whoIsWhoIni[$i][1],"%",2)
$whoIsWho[$i-2][0] = $whoIsWhoIni[$i][0] ;IP-Adresse
$whoIsWho[$i-2][1] = $data[0] ;Computername
$whoIsWho[$i-2][2] = $data[1] ;Nachname
$whoIsWho[$i-2][3] = $data[2] ;Vorname
$whoIsWho[$i-2][4] = $data[3] ;Raumnummer
$whoIsWho[$i-2][5] = $data[4] ;Durchwahl
$whoIsWho[$i-2][6] = StringReplace(StringReplace(StringReplace($data[5],"-",""),":","")," ","") ;MAC-Adresse
Next
;~ _ArrayDisplay($whoIsWho)
$whereIsWhereIni = IniReadSection($iniPath,"WhereIsWhere")
$j = $whereIsWhereIni[0][0]
local $whereIsWhere[$j-1][4]
For $i=2 To $j
$data = StringSplit($whereIsWhereIni[$i][1],"%",2)
$whereIsWhere[$i-2][0] = $whereIsWhereIni[$i][0] ;Raumnummer
$whereIsWhere[$i-2][1] = $data[0] ;X-Koordinate
$whereIsWhere[$i-2][2] = $data[1] ;Y-Koordinate
$whereIsWhere[$i-2][3] = 0 ;Computeranzahl
Next
;~ _ArrayDisplay($whereIsWhere)
While 1
$msg = GUIGetMsg()
If ($msg = $tab OR $s1 = False) Then
$s1 = True
$online[0] = 0 ;Online
$online[1] = 0 ;Gesamtanzahl
If (GUICtrlRead($tab) == "6") Then
_logThis("Stockwerk "&$selectedFloor&" wurde aktualisiert")
GUICtrlSetState($tabs[$selectedFloor],$GUI_SHOW)
$s1=False
$s2=True
ContinueLoop 1
ElseIf ($s2 == False) Then
_logThis("Stockwerk "&GUICtrlRead($tab)&" wurde gewählt")
EndIf
$s2=False
$selectedFloor = GUICtrlRead($tab)
GUICtrlSetImage($image, $imagePath&"\"&$selectedFloor&"."&$imageEndung)
GUICtrlSetData($console, $selectedFloor&". Stock gewählt")
$pingTimer = TimerInit()
For $i = 0 To 199
GUICtrlDelete($person[$i][0])
$person[$i][0] = ""
$person[$i][1] = ""
Next
#region Display
For $i = 0 To UBound($whereIsWhere)-1
$whereIsWhere[$i][3] = "0"
Next
$t=0
For $l=0 To UBound($whoIsWho)-1
If (StringLeft($whoIsWho[$l][4],1) = ($selectedFloor)) Then
If (_ArraySearch($whereIsWhere,$whoIsWho[$l][4],"","","","",0)==-1) Then
MsgBox(48,"Error","Die Raumnummer "&$whoIsWho[$l][4]&" ist nicht definiert!"&@CRLF&"Programm wird beendet!")
_exit("0x001")
Else
$raumkoordinate = _ArraySearch($whereIsWhere,$whoIsWho[$l][4],"","","","",0)
EndIf
$person[$l][0] = GUICtrlCreateLabel($whoIsWho[$l][1], 5+($whereIsWhere[_ArraySearch($whereIsWhere,$whoIsWho[$l][4],"","","","",0)][1])*($tabSize[0]/$bmpSize[0])*0.965, (($whereIsWhere[_ArraySearch($whereIsWhere,$whoIsWho[$l][4],"","","","",0)][2])*($tabSize[1]/$bmpSize[1])*0.965)-($whereIsWhere[_ArraySearch($whereIsWhere,$whoIsWho[$l][4],"","","","",0)][3]*25))
$contextmenu = GUICtrlCreateContextMenu()
$labelContext[$l] = GUICtrlCreateContextMenu($person[$l][0])
$contextmenuitemI[$l][0] = GUICtrlCreateMenuItem("Info", $labelContext[$l])
$contextmenuitemI[$l][1] = GUICtrlCreateMenu("HDDs", $labelContext[$l])
$contextmenuitemI[$l][2] = GUICtrlCreateMenuItem("C$", $contextmenuitemI[$l][1])
$contextmenuitemI[$l][3] = GUICtrlCreateMenuItem("D$", $contextmenuitemI[$l][1])
$contextmenuitemI[$l][7] = GUICtrlCreateMenuItem("Verwaltung", $labelContext[$l])
$contextmenuitemI[$l][4] = GUICtrlCreateMenu("Commands", $labelContext[$l])
$contextmenuitemI[$l][5] = GUICtrlCreateMenuItem("send Command", $contextmenuitemI[$l][4])
$contextmenuitemI[$l][6] = GUICtrlCreateMenuItem("send Update", $contextmenuitemI[$l][4])
$contextmenuitemI[$l][8] = GUICtrlCreateMenuItem("DameWare", $labelContext[$l])
$contextmenuitemI[$l][9] = GUICtrlCreateMenuItem("WakeOnLan", $labelContext[$l])
$contextmenuitemI[$l][10] = GUICtrlCreateMenuItem("MsInfo", $labelContext[$l])
If (Ping($whoIsWho[$l][1],50)<>0 AND TRUE) Then
GUICtrlSetState($contextmenuitemI[$l][9],$GUI_DISABLE) ; disable WakeOnLan
GUICtrlSetState($contextmenuitemI[$l][6],$GUI_DISABLE) ; disable Send Update
GUICtrlSetState($person[$l][0], $GUI_CHECKED)
GUICtrlSetBkColor($person[$l][0],0x99ff99)
$online[0] = $online[0]+1
Else
GUICtrlSetState($contextmenuitemI[$l][0],$GUI_DISABLE) ; disable Info
GUICtrlSetState($contextmenuitemI[$l][2],$GUI_DISABLE) ; disable C$
GUICtrlSetState($contextmenuitemI[$l][3],$GUI_DISABLE) ; disable D$
GUICtrlSetState($contextmenuitemI[$l][7],$GUI_DISABLE) ; disable Verwaltung
GUICtrlSetState($contextmenuitemI[$l][5],$GUI_DISABLE) ; disable Send Command
GUICtrlSetState($contextmenuitemI[$l][6],$GUI_DISABLE) ; disable Send Update
GUICtrlSetState($contextmenuitemI[$l][8],$GUI_DISABLE) ; disable Dameware
GUICtrlSetState($contextmenuitemI[$l][10],$GUI_DISABLE) ; disable MsInfo
GUICtrlSetBKColor($person[$l][0],0xff9999)
EndIf
GUICtrlSetTip($person[$l][0],"Computer: "&$whoIsWho[$l][1]&@CRLF&"IP: "&$whoIsWho[$l][0]&@CRLF&"-----------"&@CRLF&"Benutzer: "&$whoIsWho[$l][2]&" "&$whoIsWho[$l][3]&@CRLF&"DW: "&$whoIsWho[$l][5]&@CRLF&"Raum: "&$whoIsWho[$l][4])
$online[1] = $online[1]+1
$person[$l][1] = $whoIsWho[$l][1]
$whereIsWhere[_ArraySearch($whereIsWhere,$whoIsWho[$l][4],"","","","",0)][3]=$whereIsWhere[_ArraySearch($whereIsWhere,$whoIsWho[$l][4],"","","","",0)][3]+1
GUICtrlSetData($console, $whoIsWho[$l][1]&" wird gepingt")
$t=$t+1
EndIf
Next
GUICtrlSetData($console, "Alle Computer im "&$selectedFloor&". Stock wurden in "&Round(TimerDiff($pingTimer)/1000,1)&" Sekunden überprüft - ("&$online[0]&" von "&$online[1]&" online)")
#endregion
EndIf
Select
Case $msg = $mainContextMenuItem[0] ; create Computer
MsgBox(0,"","create Computer")
Case $msg = $mainContextMenuItem[1] ; edit Computer
MsgBox(0,"","edit Computer")
Case $msg = $mainContextMenuItem[2] ; delete Computer
MsgBox(0,"","delete Computer")
Case $msg = $mainContextMenuItem[4] ; delete Computer
MsgBox(0,"","show Log")
Case $msg = $GUI_EVENT_CLOSE
GUIDelete()
_exit()
EndSelect
For $l=0 To UBound($whoIsWho)-1
If StringLeft($whoIsWho[$l][4],1) = ($selectedFloor) Then
Select
Case $msg = $contextmenuitemI[$l][0] ; Info
If Ping($whoIsWho[$l][1],50) Then
TCPStartup()
$realIP = TCPNameToIP($whoIsWho[$l][1])
If ($realIP <> $whoIsWho[$l][0]) Then
MsgBox(0,"Error","Der Computer "&$whoIsWho[$l][1]&" hat die IP-Adresse "&$realIP&" und nicht "&$whoIsWho[$l][0]&" !")
EndIf
$javaVersion[$l] = "?"
$flashVersion[$l] = "?"
$readerVersion[$l] = "?"
$osArch = "?"
ShellExecuteWait("sc", "\\"&$whoIsWho[$l][1]&" start RemoteRegistry", "", "", @SW_HIDE)
RunWait(@ComSpec & " /c " &'reg query "\\'&$whoIsWho[$l][1]&'\HKLM\System\CurrentControlSet\Control\Session Manager\Environment" /v PROCESSOR_ARCHITECTURE >> '&@ScriptDir&'\temp.txt', "", @SW_HIDE)
$osArch=FileRead(@ScriptDir&"\temp.txt")
FileDelete(@ScriptDir&"\temp.txt")
$osArch=StringTrimLeft($osArch,123)
$osArch=StringTrimRight($osArch,4)
RunWait(@ComSpec & " /c " &'reg query "\\'&$whoIsWho[$l][1]&'\HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v ProductName >> '&@ScriptDir&'\temp.txt', "", @SW_HIDE)
$os=FileRead(@ScriptDir&"\temp.txt")
FileDelete(@ScriptDir&"\temp.txt")
$os=StringTrimLeft($os,96)
$os=StringTrimRight($os,4)
if FileExists("\\" & $whoIsWho[$l][1] & $javaPath86) Then
$javaVersion[$l] = FileGetVersion("\\" & $whoIsWho[$l][1] & $javaPath86)
ElseIf FileExists("\\" & $whoIsWho[$l][1] & $javaPath64) Then
$javaVersion[$l] = FileGetVersion("\\" & $whoIsWho[$l][1] & $javaPath64)
EndIf
if FileExists("\\" & $whoIsWho[$l][1] & $flashPath86) Then
$flashVersion[$l] = FileGetVersion("\\" & $whoIsWho[$l][1] & $flashPath86)
ElseIf FileExists("\\" & $whoIsWho[$l][1] & $flashPath64) Then
$flashVersion[$l] = FileGetVersion("\\" & $whoIsWho[$l][1] & $flashPath64)
EndIf
if FileExists("\\" & $whoIsWho[$l][1] & $readerPath86) Then
$readerVersion[$l] = FileGetVersion("\\" & $whoIsWho[$l][1] & $readerPath86)
ElseIf FileExists("\\" & $whoIsWho[$l][1] & $readerPath64) Then
$readerVersion[$l] = FileGetVersion("\\" & $whoIsWho[$l][1] & $readerPath64)
EndIf
MsgBox(0,"Info","Computer: "&$whoIsWho[$l][1]&@CRLF&"IP: "&$whoIsWho[$l][0]&@CRLF&"Architektur: "&$osArch&@CRLF&"OS: "&$os&@CRLF&"-----------"&@CRLF&"Benutzer: "&$whoIsWho[$l][2]&" "&$whoIsWho[$l][3]&@CRLF&"DW: "&$whoIsWho[$l][5]&@CRLF&"Raum: "&$whoIsWho[$l][4]&@CRLF&"-----------"&@CRLF&"Java Ver.: "&$javaVersion[$l]&@CRLF&"Flash Ver.: "&$flashVersion[$l]&@CRLF&"Reader Ver.: "&$readerVersion[$l])
EndIf
Case $msg = $contextmenuitemI[$l][2] ; C$
Run("explorer.exe \\"&$whoIsWho[$l][1]&"\C$")
_logThis("Netzlaufwerk \\"&$whoIsWho[$l][1]&"\C$ wurde aufgerufen")
Case $msg = $contextmenuitemI[$l][3] ; D$
Run("explorer.exe \\"&$whoIsWho[$l][1]&"\D$")
_logThis("Netzlaufwerk \\"&$whoIsWho[$l][1]&"\D$ wurde aufgerufen")
Case $msg = $contextmenuitemI[$l][7] ; Computerverwaltung
ShellExecute("compmgmt.msc","/computer:\\"&$whoIsWho[$l][1])
_logThis("Die Computerverwaltung von \\"&$whoIsWho[$l][1]&" wurde aufgerufen")
Case $msg = $contextmenuitemI[$l][8] ; DameWare
$dameWare = MsgBox(4+32,"DameWare","Soll eine DameWare-Verbindung mit "&$whoIsWho[$l][1]&" aufgerufen werden?")
If $dameWare = 6 Then
ShellExecute("C:\Program Files\SolarWinds\DameWare Mini Remote Control 10.0\DWRCC.exe","-c: -h: -m:"&$whoIsWho[$l][1])
_logThis("Eine DameWare-Verbindung mit "&$whoIsWho[$l][1]&" wurde aufgebaut")
EndIf
Case $msg = $contextmenuitemI[$l][9] ; WakeOnLan
If (StringLen($whoIsWho[$l][6])=12) Then
ShellExecute($tempPath&"\wol.exe", $whoIsWho[$l][6])
_logThis($whoIsWho[$l][1]&" wurde via WOL gestartet")
MsgBox(0,"Sent","Startup-Befehl wurde an die MAC:"&$whoIsWho[$l][6]&" gesendet!")
Else
_logThis($whoIsWho[$l][1]&" konnte nicht via WOL gestartet werden")
MsgBox(16,"Error","Die angegebene MAC-Adresse ist nicht gültig!")
EndIf
Case $msg = $contextmenuitemI[$l][5] ; Send Command
$password = InputBox("Passwort","Bitte geben Sie ihr Passwort ein","","#")
ShellExecute($tempPath&"\PsExec.exe","\\"&$whoIsWho[$l][1]&" -u "&@LogonDomain&"\"&@UserName&" -p "&$password&" cmd.exe")
_logThis("Eine PsExec-Verbindung mit "&$whoIsWho[$l][1]&" wurde aufgebaut")
Case $msg = $contextmenuitemI[$l][10] ; MsInfo
ShellExecute("msinfo32.exe","/computer "&$whoIsWho[$l][1])
_logThis("MsInfo32.exe für "&$whoIsWho[$l][1]&" wurde aufgerufen")
EndSelect
EndIf
Next
WEnd
Func _exit($error="")
If ($error == "") Then
_logThis("Programm wurde beendet")
Else
_logThis("Programm wurde durch einen Fehler ("&$error&") beendet")
EndIf
Exit
EndFunc
Func _logThis($logString)
$logFile = FileOpen(@ScriptDir&"\log.log",1)
FileWriteLine($logFile,@YEAR&"."&@MON&"."&@MDAY&"-"&@HOUR&":"&@MIN&":"&@SEC&":"&@MSEC&" - "&@UserName&" : "&$logString)
FileClose($logFile)
EndFunc
Wo liegt da mein Fehler?
Ich hoffe euch reicht der Code, denn den Inhalt der files.au3 darf ich nicht weitergeben.
Danke & LG!