first commit
This commit is contained in:
127
V3/CalibreMultiuserStarterV3.au3
Normal file
127
V3/CalibreMultiuserStarterV3.au3
Normal file
@@ -0,0 +1,127 @@
|
||||
#NoTrayIcon
|
||||
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
|
||||
#AutoIt3Wrapper_Icon=CalibeIcon.ico
|
||||
#AutoIt3Wrapper_Res_Description=2013 Bernhard Linz / Bernhard@znil.de / http://znil.net
|
||||
#AutoIt3Wrapper_Res_Fileversion=1.0.0.13
|
||||
#AutoIt3Wrapper_Res_Fileversion_AutoIncrement=y
|
||||
#AutoIt3Wrapper_Res_LegalCopyright=znil.net
|
||||
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
|
||||
|
||||
Dim Const $s_LockFileName = "CalibreLockFile.txt"
|
||||
Dim Const $s_CalibreProgramName = "calibre-portable.exe"
|
||||
Dim Const $s_CalibreMainProgramName = "calibre.exe"
|
||||
Dim $h_lockfile
|
||||
Dim $h_Calibre
|
||||
Dim $b_RunCalibe = False
|
||||
Dim $a_gelockt_von
|
||||
Dim $h_DllErgebnis
|
||||
Dim $s_clientname
|
||||
Dim $s_ip
|
||||
Dim $a_DezimalIP[5]
|
||||
Dim $b_CalibreWindowsActive = False
|
||||
|
||||
|
||||
If FileExists($s_LockFileName) = 1 Then
|
||||
$h_lockfile = FileOpen($s_LockFileName,0)
|
||||
$a_gelockt_von = StringSplit(FileReadLine($s_LockFileName), ":", 0)
|
||||
FileClose($h_lockfile)
|
||||
; $a_gelockt_von[1] = Benutzername
|
||||
; $a_gelockt_von[2] = Computername
|
||||
; $a_gelockt_von[3] = Stunde
|
||||
; $a_gelockt_von[4] = Minute
|
||||
; $a_gelockt_von[5] = Tag
|
||||
; $a_gelockt_von[6] = Monat
|
||||
; $a_gelockt_von[7] = Jahr
|
||||
If $a_gelockt_von[0] = 7 Then
|
||||
MsgBox(262160, "Calibre blockiert", "Der Benutzer '" & $a_gelockt_von[1] & "' am Computer '" & $a_gelockt_von[2] & "'" & @CRLF & _
|
||||
"hat bereits um " & $a_gelockt_von[3] & ":" & $a_gelockt_von[4] & " Uhr am " & $a_gelockt_von[5] & "." & $a_gelockt_von[6] & "." & $a_gelockt_von[7] & @CRLF & _
|
||||
"Calibre gestartet und nimmt eventuell <20>nderungen vor." & @CRLF & @CRLF & _
|
||||
"Programmaufruf ist blockiert!")
|
||||
EndIf
|
||||
$b_RunCalibe = False
|
||||
Else
|
||||
$h_lockfile = FileOpen($s_LockFileName,2)
|
||||
FileWriteLine($h_lockfile, @UserName & ":" & @ComputerName & ":" & @HOUR & ":" & @MIN & ":" & @MDAY & ":" & @MON & ":" & @YEAR & @CRLF)
|
||||
FileClose($h_lockfile)
|
||||
$b_RunCalibe = True
|
||||
; Dinge aus RDP-Session herausfinden
|
||||
$h_DllErgebnis = DllCall("Wtsapi32.dll","BOOL","WTSQuerySessionInformationW","int",0, "int", -1, "int", 10, "ptr*", 0, "DWORD*",0)
|
||||
If @error Or $h_DllErgebnis[0] = 0 Then
|
||||
$s_clientname = "unknown"
|
||||
Else
|
||||
$s_clientname = BinaryToString( DllStructGetData(DllStructCreate("byte[" & $h_DllErgebnis[5] & "]" , $h_DllErgebnis[4]),1) ,2)
|
||||
DllCall("Wtsapi32.dll", "int", "WTSFreeMemory", "ptr", $h_DllErgebnis[4])
|
||||
EndIf
|
||||
$h_DllErgebnis = DllCall("Wtsapi32.dll","int", "WTSQuerySessionInformationW", "Ptr", 0, "int", -1, "int", 14, "ptr*", 0, "DWORD*", 0)
|
||||
If @error Or $h_DllErgebnis[0] = 0 Then
|
||||
$s_ip = "unknown"
|
||||
Else
|
||||
$s_ip = DllStructGetData(DllStructCreate("byte[" & $h_DllErgebnis[5] & "]" , $h_DllErgebnis[4]),1)
|
||||
DllCall("Wtsapi32.dll", "int", "WTSFreeMemory", "ptr", $h_DllErgebnis[4])
|
||||
$s_ip = StringTrimLeft($s_ip,14)
|
||||
$a_DezimalIP[1] = Dec(StringLeft($s_ip,2))
|
||||
$s_ip = StringTrimLeft($s_ip,2)
|
||||
$a_DezimalIP[2] = Dec(StringLeft($s_ip,2))
|
||||
$s_ip = StringTrimLeft($s_ip,2)
|
||||
$a_DezimalIP[3] = Dec(StringLeft($s_ip,2))
|
||||
$s_ip = StringTrimLeft($s_ip,2)
|
||||
$a_DezimalIP[4] = Dec(StringLeft($s_ip,2))
|
||||
$s_ip = $a_DezimalIP[1] & "." & $a_DezimalIP[2] & "." & $a_DezimalIP[3] & "." & $a_DezimalIP[4]
|
||||
EndIf
|
||||
; Und Logfile-Schreiben
|
||||
If $s_clientname = "" Then
|
||||
$s_clientname = "Keine RDP Sitzung!"
|
||||
$s_ip = ""
|
||||
EndIf
|
||||
|
||||
FileWriteLine(@ScriptDir & "\MultiuserLOG.txt", @YEAR & "-" & @MON & "-" & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC & " - LOGIN => USERNAME: " & @UserName & _
|
||||
" COMPUTERNAME: " & @ComputerName & " RDP-Client: " & $s_clientname & " - " & $s_ip)
|
||||
EndIf
|
||||
|
||||
|
||||
If $b_RunCalibe = False Then
|
||||
Exit 1
|
||||
EndIf
|
||||
|
||||
$h_Calibre = Run(@ScriptDir & "\" & $s_CalibreProgramName, @ScriptDir, @SW_MAXIMIZE)
|
||||
If $h_Calibre = 0 Then
|
||||
FileDelete($s_LockFileName)
|
||||
MsgBox(16, "Fehler", "Konnte '" & @ScriptDir & "\" & $s_CalibreProgramName & "' nicht starten")
|
||||
Exit 1
|
||||
EndIf
|
||||
|
||||
;SpashImage features: Title=No, Width=602, Height=302, Always On Top
|
||||
SplashImageOn("", "bittewarten.jpg","602","302","-1","-1",1)
|
||||
|
||||
Do
|
||||
If $b_CalibreWindowsActive = False Then
|
||||
If WinExists ("calibre") = 1 Then
|
||||
Sleep(2000)
|
||||
SplashOff()
|
||||
;MsgBox(0, "Calibre-Fenster", "Ist da!")
|
||||
$b_CalibreWindowsActive = True
|
||||
EndIf
|
||||
EndIf
|
||||
Sleep(1000)
|
||||
;ConsoleWrite($h_Calibre & @CRLF)
|
||||
If (ProcessExists($h_Calibre) = 0) And (ProcessExists($s_CalibreMainProgramName) = 0) Then
|
||||
$b_RunCalibe = False
|
||||
EndIf
|
||||
Until $b_RunCalibe = False
|
||||
|
||||
FileDelete($s_LockFileName)
|
||||
FileWriteLine("MultiuserLOG.txt", @YEAR & "-" & @MON & "-" & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC & " - LOGOUT => USERNAME: " & @UserName & _
|
||||
" COMPUTERNAME: " & @ComputerName & " RDP-Client: " & $s_clientname & " - " & $s_ip)
|
||||
Sleep (2000)
|
||||
|
||||
If FileExists($s_LockFileName) = 1 Then
|
||||
MsgBox(16,"Warnung", "Konnte das Calibre-Lock-File nicht l<>schen:" & @CRLF & @ScriptDir & "\" & $s_CalibreProgramName)
|
||||
Exit 1
|
||||
Else
|
||||
Exit 0
|
||||
EndIf
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
126
V3/CalibreMultiuserStarterV3.au3.1.bak
Normal file
126
V3/CalibreMultiuserStarterV3.au3.1.bak
Normal file
@@ -0,0 +1,126 @@
|
||||
#NoTrayIcon
|
||||
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
|
||||
#AutoIt3Wrapper_Icon=CalibeIcon.ico
|
||||
#AutoIt3Wrapper_Res_Description=2013 Bernhard Linz / Bernhard@znil.de / http://znil.net
|
||||
#AutoIt3Wrapper_Res_Fileversion=1.0.0.12
|
||||
#AutoIt3Wrapper_Res_Fileversion_AutoIncrement=y
|
||||
#AutoIt3Wrapper_Res_LegalCopyright=znil.net
|
||||
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
|
||||
|
||||
Dim Const $s_LockFileName = "CalibreLockFile.txt"
|
||||
Dim Const $s_CalibreProgramName = "calibre-portable.exe"
|
||||
Dim Const $s_CalibreMainProgramName = "calibre.exe"
|
||||
Dim $h_lockfile
|
||||
Dim $h_Calibre
|
||||
Dim $b_RunCalibe = False
|
||||
Dim $a_gelockt_von
|
||||
Dim $h_DllErgebnis
|
||||
Dim $s_clientname
|
||||
Dim $s_ip
|
||||
Dim $a_DezimalIP[5]
|
||||
Dim $b_CalibreWindowsActive = False
|
||||
|
||||
|
||||
If FileExists($s_LockFileName) = 1 Then
|
||||
$h_lockfile = FileOpen($s_LockFileName,0)
|
||||
$a_gelockt_von = StringSplit(FileReadLine($s_LockFileName), ":", 0)
|
||||
FileClose($h_lockfile)
|
||||
; $a_gelockt_von[1] = Benutzername
|
||||
; $a_gelockt_von[2] = Computername
|
||||
; $a_gelockt_von[3] = Stunde
|
||||
; $a_gelockt_von[4] = Minute
|
||||
; $a_gelockt_von[5] = Tag
|
||||
; $a_gelockt_von[6] = Monat
|
||||
; $a_gelockt_von[7] = Jahr
|
||||
If $a_gelockt_von[0] = 7 Then
|
||||
MsgBox(262160, "Calibre blockiert", "Der Benutzer '" & $a_gelockt_von[1] & "' am Computer '" & $a_gelockt_von[2] & "'" & @CRLF & _
|
||||
"hat bereits um " & $a_gelockt_von[3] & ":" & $a_gelockt_von[4] & " Uhr am " & $a_gelockt_von[5] & "." & $a_gelockt_von[6] & "." & $a_gelockt_von[7] & @CRLF & _
|
||||
"Calibre gestartet und nimmt eventuell <20>nderungen vor." & @CRLF & @CRLF & _
|
||||
"Programmaufruf ist blockiert!")
|
||||
EndIf
|
||||
$b_RunCalibe = False
|
||||
Else
|
||||
$h_lockfile = FileOpen($s_LockFileName,2)
|
||||
FileWriteLine($h_lockfile, @UserName & ":" & @ComputerName & ":" & @HOUR & ":" & @MIN & ":" & @MDAY & ":" & @MON & ":" & @YEAR & @CRLF)
|
||||
FileClose($h_lockfile)
|
||||
$b_RunCalibe = True
|
||||
; Dinge aus RDP-Session herausfinden
|
||||
$h_DllErgebnis = DllCall("Wtsapi32.dll","BOOL","WTSQuerySessionInformationW","int",0, "int", -1, "int", 10, "ptr*", 0, "DWORD*",0)
|
||||
If @error Or $h_DllErgebnis[0] = 0 Then
|
||||
$s_clientname = "unknown"
|
||||
Else
|
||||
$s_clientname = BinaryToString( DllStructGetData(DllStructCreate("byte[" & $h_DllErgebnis[5] & "]" , $h_DllErgebnis[4]),1) ,2)
|
||||
DllCall("Wtsapi32.dll", "int", "WTSFreeMemory", "ptr", $h_DllErgebnis[4])
|
||||
EndIf
|
||||
$h_DllErgebnis = DllCall("Wtsapi32.dll","int", "WTSQuerySessionInformationW", "Ptr", 0, "int", -1, "int", 14, "ptr*", 0, "DWORD*", 0)
|
||||
If @error Or $h_DllErgebnis[0] = 0 Then
|
||||
$s_ip = "unknown"
|
||||
Else
|
||||
$s_ip = DllStructGetData(DllStructCreate("byte[" & $h_DllErgebnis[5] & "]" , $h_DllErgebnis[4]),1)
|
||||
DllCall("Wtsapi32.dll", "int", "WTSFreeMemory", "ptr", $h_DllErgebnis[4])
|
||||
$s_ip = StringTrimLeft($s_ip,14)
|
||||
$a_DezimalIP[1] = Dec(StringLeft($s_ip,2))
|
||||
$s_ip = StringTrimLeft($s_ip,2)
|
||||
$a_DezimalIP[2] = Dec(StringLeft($s_ip,2))
|
||||
$s_ip = StringTrimLeft($s_ip,2)
|
||||
$a_DezimalIP[3] = Dec(StringLeft($s_ip,2))
|
||||
$s_ip = StringTrimLeft($s_ip,2)
|
||||
$a_DezimalIP[4] = Dec(StringLeft($s_ip,2))
|
||||
$s_ip = $a_DezimalIP[1] & "." & $a_DezimalIP[2] & "." & $a_DezimalIP[3] & "." & $a_DezimalIP[4]
|
||||
EndIf
|
||||
; Und Logfile-Schreiben
|
||||
If $s_clientname = "" Then
|
||||
$s_clientname = "Keine RDP Sitzung!"
|
||||
$s_ip = ""
|
||||
EndIf
|
||||
|
||||
FileWriteLine(@ScriptDir & "\MultiuserLOG.txt", @YEAR & "-" & @MON & "-" & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC & " - LOGIN => USERNAME: " & @UserName & _
|
||||
" COMPUTERNAME: " & @ComputerName & " RDP-Client: " & $s_clientname & " - " & $s_ip)
|
||||
EndIf
|
||||
|
||||
|
||||
If $b_RunCalibe = False Then
|
||||
Exit 1
|
||||
EndIf
|
||||
|
||||
$h_Calibre = Run(@ScriptDir & "\" & $s_CalibreProgramName, @ScriptDir, @SW_MAXIMIZE)
|
||||
If $h_Calibre = 0 Then
|
||||
FileDelete($s_LockFileName)
|
||||
MsgBox(16, "Fehler", "Konnte '" & @ScriptDir & "\" & $s_CalibreProgramName & "' nicht starten")
|
||||
Exit 1
|
||||
EndIf
|
||||
|
||||
;SpashImage features: Title=No, Width=602, Height=302, Always On Top
|
||||
SplashImageOn("", "bittewarten.jpg","602","302","-1","-1",1)
|
||||
|
||||
Do
|
||||
If $b_CalibreWindowsActive = False Then
|
||||
If WinExists ("calibre") = 1 Then
|
||||
SplashOff()
|
||||
;MsgBox(0, "Calibre-Fenster", "Ist da!")
|
||||
$b_CalibreWindowsActive = True
|
||||
EndIf
|
||||
EndIf
|
||||
Sleep(1000)
|
||||
;ConsoleWrite($h_Calibre & @CRLF)
|
||||
If (ProcessExists($h_Calibre) = 0) And (ProcessExists($s_CalibreMainProgramName) = 0) Then
|
||||
$b_RunCalibe = False
|
||||
EndIf
|
||||
Until $b_RunCalibe = False
|
||||
|
||||
FileDelete($s_LockFileName)
|
||||
FileWriteLine("MultiuserLOG.txt", @YEAR & "-" & @MON & "-" & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC & " - LOGOUT => USERNAME: " & @UserName & _
|
||||
" COMPUTERNAME: " & @ComputerName & " RDP-Client: " & $s_clientname & " - " & $s_ip)
|
||||
Sleep (2000)
|
||||
|
||||
If FileExists($s_LockFileName) = 1 Then
|
||||
MsgBox(16,"Warnung", "Konnte das Calibre-Lock-File nicht l<>schen:" & @CRLF & @ScriptDir & "\" & $s_CalibreProgramName)
|
||||
Exit 1
|
||||
Else
|
||||
Exit 0
|
||||
EndIf
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
123
V3/CalibreMultiuserStarterV3.au3.2.bak
Normal file
123
V3/CalibreMultiuserStarterV3.au3.2.bak
Normal file
@@ -0,0 +1,123 @@
|
||||
#NoTrayIcon
|
||||
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
|
||||
#AutoIt3Wrapper_Icon=CalibeIcon.ico
|
||||
#AutoIt3Wrapper_Res_Description=2013 Bernhard Linz / Bernhard@znil.de / http://znil.net
|
||||
#AutoIt3Wrapper_Res_Fileversion=1.0.0.11
|
||||
#AutoIt3Wrapper_Res_Fileversion_AutoIncrement=y
|
||||
#AutoIt3Wrapper_Res_LegalCopyright=znil.net
|
||||
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
|
||||
|
||||
Dim Const $s_LockFileName = "CalibreLockFile.txt"
|
||||
Dim Const $s_CalibreProgramName = "calibre-portable.exe"
|
||||
Dim Const $s_CalibreMainProgramName = "calibre.exe"
|
||||
Dim $h_lockfile
|
||||
Dim $h_Calibre
|
||||
Dim $b_RunCalibe = False
|
||||
Dim $a_gelockt_von
|
||||
Dim $h_DllErgebnis
|
||||
Dim $s_clientname
|
||||
Dim $s_ip
|
||||
Dim $a_DezimalIP[5]
|
||||
Dim $b_CalibreWindowsActive = False
|
||||
|
||||
|
||||
If FileExists($s_LockFileName) = 1 Then
|
||||
$h_lockfile = FileOpen($s_LockFileName,0)
|
||||
$a_gelockt_von = StringSplit(FileReadLine($s_LockFileName), ":", 0)
|
||||
FileClose($h_lockfile)
|
||||
; $a_gelockt_von[1] = Benutzername
|
||||
; $a_gelockt_von[2] = Computername
|
||||
; $a_gelockt_von[3] = Stunde
|
||||
; $a_gelockt_von[4] = Minute
|
||||
; $a_gelockt_von[5] = Tag
|
||||
; $a_gelockt_von[6] = Monat
|
||||
; $a_gelockt_von[7] = Jahr
|
||||
If $a_gelockt_von[0] = 7 Then
|
||||
MsgBox(262160, "Calibre blockiert", "Der Benutzer '" & $a_gelockt_von[1] & "' am Computer '" & $a_gelockt_von[2] & "'" & @CRLF & _
|
||||
"hat bereits um " & $a_gelockt_von[3] & ":" & $a_gelockt_von[4] & " Uhr am " & $a_gelockt_von[5] & "." & $a_gelockt_von[6] & "." & $a_gelockt_von[7] & @CRLF & _
|
||||
"Calibre gestartet und nimmt eventuell <20>nderungen vor." & @CRLF & @CRLF & _
|
||||
"Programmaufruf ist blockiert!")
|
||||
EndIf
|
||||
$b_RunCalibe = False
|
||||
Else
|
||||
$h_lockfile = FileOpen($s_LockFileName,2)
|
||||
FileWriteLine($h_lockfile, @UserName & ":" & @ComputerName & ":" & @HOUR & ":" & @MIN & ":" & @MDAY & ":" & @MON & ":" & @YEAR & @CRLF)
|
||||
FileClose($h_lockfile)
|
||||
$b_RunCalibe = True
|
||||
; Dinge aus RDP-Session herausfinden
|
||||
$h_DllErgebnis = DllCall("Wtsapi32.dll","BOOL","WTSQuerySessionInformationW","int",0, "int", -1, "int", 10, "ptr*", 0, "DWORD*",0)
|
||||
If @error Or $h_DllErgebnis[0] = 0 Then
|
||||
$s_clientname = "unknown"
|
||||
Else
|
||||
$s_clientname = BinaryToString( DllStructGetData(DllStructCreate("byte[" & $h_DllErgebnis[5] & "]" , $h_DllErgebnis[4]),1) ,2)
|
||||
DllCall("Wtsapi32.dll", "int", "WTSFreeMemory", "ptr", $h_DllErgebnis[4])
|
||||
EndIf
|
||||
$h_DllErgebnis = DllCall("Wtsapi32.dll","int", "WTSQuerySessionInformationW", "Ptr", 0, "int", -1, "int", 14, "ptr*", 0, "DWORD*", 0)
|
||||
If @error Or $h_DllErgebnis[0] = 0 Then
|
||||
$s_ip = "unknown"
|
||||
Else
|
||||
$s_ip = DllStructGetData(DllStructCreate("byte[" & $h_DllErgebnis[5] & "]" , $h_DllErgebnis[4]),1)
|
||||
DllCall("Wtsapi32.dll", "int", "WTSFreeMemory", "ptr", $h_DllErgebnis[4])
|
||||
$s_ip = StringTrimLeft($s_ip,14)
|
||||
$a_DezimalIP[1] = Dec(StringLeft($s_ip,2))
|
||||
$s_ip = StringTrimLeft($s_ip,2)
|
||||
$a_DezimalIP[2] = Dec(StringLeft($s_ip,2))
|
||||
$s_ip = StringTrimLeft($s_ip,2)
|
||||
$a_DezimalIP[3] = Dec(StringLeft($s_ip,2))
|
||||
$s_ip = StringTrimLeft($s_ip,2)
|
||||
$a_DezimalIP[4] = Dec(StringLeft($s_ip,2))
|
||||
$s_ip = $a_DezimalIP[1] & "." & $a_DezimalIP[2] & "." & $a_DezimalIP[3] & "." & $a_DezimalIP[4]
|
||||
EndIf
|
||||
; Und Logfile-Schreiben
|
||||
If $s_clientname = "" Then
|
||||
$s_clientname = "Keine RDP Sitzung!"
|
||||
$s_ip = ""
|
||||
EndIf
|
||||
|
||||
FileWriteLine(@ScriptDir & "\MultiuserLOG.txt", @YEAR & "-" & @MON & "-" & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC & " - LOGIN => USERNAME: " & @UserName & _
|
||||
" COMPUTERNAME: " & @ComputerName & " RDP-Client: " & $s_clientname & " - " & $s_ip)
|
||||
EndIf
|
||||
|
||||
|
||||
If $b_RunCalibe = False Then
|
||||
Exit 1
|
||||
EndIf
|
||||
|
||||
$h_Calibre = Run(@ScriptDir & "\" & $s_CalibreProgramName, @ScriptDir, @SW_MAXIMIZE)
|
||||
If $h_Calibre = 0 Then
|
||||
FileDelete($s_LockFileName)
|
||||
MsgBox(16, "Fehler", "Konnte '" & @ScriptDir & "\" & $s_CalibreProgramName & "' nicht starten")
|
||||
Exit 1
|
||||
EndIf
|
||||
|
||||
|
||||
Do
|
||||
If $b_CalibreWindowsActive = False Then
|
||||
If WinExists ("calibre") = 1 Then
|
||||
MsgBox(0, "Calibre-Fenster", "Ist da!")
|
||||
$b_CalibreWindowsActive = True
|
||||
EndIf
|
||||
EndIf
|
||||
Sleep(1000)
|
||||
;ConsoleWrite($h_Calibre & @CRLF)
|
||||
If (ProcessExists($h_Calibre) = 0) And (ProcessExists($s_CalibreMainProgramName) = 0) Then
|
||||
$b_RunCalibe = False
|
||||
EndIf
|
||||
Until $b_RunCalibe = False
|
||||
|
||||
FileDelete($s_LockFileName)
|
||||
FileWriteLine("MultiuserLOG.txt", @YEAR & "-" & @MON & "-" & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC & " - LOGOUT => USERNAME: " & @UserName & _
|
||||
" COMPUTERNAME: " & @ComputerName & " RDP-Client: " & $s_clientname & " - " & $s_ip)
|
||||
Sleep (2000)
|
||||
|
||||
If FileExists($s_LockFileName) = 1 Then
|
||||
MsgBox(16,"Warnung", "Konnte das Calibre-Lock-File nicht l<>schen:" & @CRLF & @ScriptDir & "\" & $s_CalibreProgramName)
|
||||
Exit 1
|
||||
Else
|
||||
Exit 0
|
||||
EndIf
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
123
V3/CalibreMultiuserStarterV3.au3.3.bak
Normal file
123
V3/CalibreMultiuserStarterV3.au3.3.bak
Normal file
@@ -0,0 +1,123 @@
|
||||
#NoTrayIcon
|
||||
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
|
||||
#AutoIt3Wrapper_Icon=CalibeIcon.ico
|
||||
#AutoIt3Wrapper_Res_Description=2013 Bernhard Linz / Bernhard@znil.de / http://znil.net
|
||||
#AutoIt3Wrapper_Res_Fileversion=1.0.0.10
|
||||
#AutoIt3Wrapper_Res_Fileversion_AutoIncrement=y
|
||||
#AutoIt3Wrapper_Res_LegalCopyright=znil.net
|
||||
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
|
||||
|
||||
Dim Const $s_LockFileName = "CalibreLockFile.txt"
|
||||
Dim Const $s_CalibreProgramName = "calibre-portable.exe"
|
||||
Dim Const $s_CalibreMainProgramName = "calibre.exe"
|
||||
Dim $h_lockfile
|
||||
Dim $h_Calibre
|
||||
Dim $b_RunCalibe = False
|
||||
Dim $a_gelockt_von
|
||||
Dim $h_DllErgebnis
|
||||
Dim $s_clientname
|
||||
Dim $s_ip
|
||||
Dim $a_DezimalIP[5]
|
||||
Dim $b_CalibreWindowsActive = False
|
||||
|
||||
|
||||
If FileExists($s_LockFileName) = 1 Then
|
||||
$h_lockfile = FileOpen($s_LockFileName,0)
|
||||
$a_gelockt_von = StringSplit(FileReadLine($s_LockFileName), ":", 0)
|
||||
FileClose($h_lockfile)
|
||||
; $a_gelockt_von[1] = Benutzername
|
||||
; $a_gelockt_von[2] = Computername
|
||||
; $a_gelockt_von[3] = Stunde
|
||||
; $a_gelockt_von[4] = Minute
|
||||
; $a_gelockt_von[5] = Tag
|
||||
; $a_gelockt_von[6] = Monat
|
||||
; $a_gelockt_von[7] = Jahr
|
||||
If $a_gelockt_von[0] = 7 Then
|
||||
MsgBox(262160, "Calibre blockiert", "Der Benutzer '" & $a_gelockt_von[1] & "' am Computer '" & $a_gelockt_von[2] & "'" & @CRLF & _
|
||||
"hat bereits um " & $a_gelockt_von[3] & ":" & $a_gelockt_von[4] & " Uhr am " & $a_gelockt_von[5] & "." & $a_gelockt_von[6] & "." & $a_gelockt_von[7] & @CRLF & _
|
||||
"Calibre gestartet und nimmt eventuell <20>nderungen vor." & @CRLF & @CRLF & _
|
||||
"Programmaufruf ist blockiert!")
|
||||
EndIf
|
||||
$b_RunCalibe = False
|
||||
Else
|
||||
$h_lockfile = FileOpen($s_LockFileName,2)
|
||||
FileWriteLine($h_lockfile, @UserName & ":" & @ComputerName & ":" & @HOUR & ":" & @MIN & ":" & @MDAY & ":" & @MON & ":" & @YEAR & @CRLF)
|
||||
FileClose($h_lockfile)
|
||||
$b_RunCalibe = True
|
||||
; Dinge aus RDP-Session herausfinden
|
||||
$h_DllErgebnis = DllCall("Wtsapi32.dll","BOOL","WTSQuerySessionInformationW","int",0, "int", -1, "int", 10, "ptr*", 0, "DWORD*",0)
|
||||
If @error Or $h_DllErgebnis[0] = 0 Then
|
||||
$s_clientname = "unknown"
|
||||
Else
|
||||
$s_clientname = BinaryToString( DllStructGetData(DllStructCreate("byte[" & $h_DllErgebnis[5] & "]" , $h_DllErgebnis[4]),1) ,2)
|
||||
DllCall("Wtsapi32.dll", "int", "WTSFreeMemory", "ptr", $h_DllErgebnis[4])
|
||||
EndIf
|
||||
$h_DllErgebnis = DllCall("Wtsapi32.dll","int", "WTSQuerySessionInformationW", "Ptr", 0, "int", -1, "int", 14, "ptr*", 0, "DWORD*", 0)
|
||||
If @error Or $h_DllErgebnis[0] = 0 Then
|
||||
$s_ip = "unknown"
|
||||
Else
|
||||
$s_ip = DllStructGetData(DllStructCreate("byte[" & $h_DllErgebnis[5] & "]" , $h_DllErgebnis[4]),1)
|
||||
DllCall("Wtsapi32.dll", "int", "WTSFreeMemory", "ptr", $h_DllErgebnis[4])
|
||||
$s_ip = StringTrimLeft($s_ip,14)
|
||||
$a_DezimalIP[1] = Dec(StringLeft($s_ip,2))
|
||||
$s_ip = StringTrimLeft($s_ip,2)
|
||||
$a_DezimalIP[2] = Dec(StringLeft($s_ip,2))
|
||||
$s_ip = StringTrimLeft($s_ip,2)
|
||||
$a_DezimalIP[3] = Dec(StringLeft($s_ip,2))
|
||||
$s_ip = StringTrimLeft($s_ip,2)
|
||||
$a_DezimalIP[4] = Dec(StringLeft($s_ip,2))
|
||||
$s_ip = $a_DezimalIP[1] & "." & $a_DezimalIP[2] & "." & $a_DezimalIP[3] & "." & $a_DezimalIP[4]
|
||||
EndIf
|
||||
; Und Logfile-Schreiben
|
||||
If $s_clientname = "" Then
|
||||
$s_clientname = "Keine RDP Sitzung!"
|
||||
$s_ip = ""
|
||||
EndIf
|
||||
|
||||
FileWriteLine(@ScriptDir & "\MultiuserLOG.txt", @YEAR & "-" & @MON & "-" & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC & " - LOGIN => USERNAME: " & @UserName & _
|
||||
" COMPUTERNAME: " & @ComputerName & " RDP-Client: " & $s_clientname & " - " & $s_ip)
|
||||
EndIf
|
||||
|
||||
|
||||
If $b_RunCalibe = False Then
|
||||
Exit 1
|
||||
EndIf
|
||||
|
||||
$h_Calibre = Run(@ScriptDir & "\" & $s_CalibreProgramName, @ScriptDir, @SW_MAXIMIZE)
|
||||
If $h_Calibre = 0 Then
|
||||
FileDelete($s_LockFileName)
|
||||
MsgBox(16, "Fehler", "Konnte '" & @ScriptDir & "\" & $s_CalibreProgramName & "' nicht starten")
|
||||
Exit 1
|
||||
EndIf
|
||||
|
||||
|
||||
Do
|
||||
If $b_CalibreWindowsActive = False Then
|
||||
If WinExists ("calibre") = 1 Then
|
||||
MsgBox(0, "Calibre-Fenster", "Ist da!")
|
||||
$b_CalibreWindowsActive = True
|
||||
EndIf
|
||||
EndIf
|
||||
Sleep(3000)
|
||||
;ConsoleWrite($h_Calibre & @CRLF)
|
||||
If (ProcessExists($h_Calibre) = 0) And (ProcessExists($s_CalibreMainProgramName) = 0) Then
|
||||
$b_RunCalibe = False
|
||||
EndIf
|
||||
Until $b_RunCalibe = False
|
||||
|
||||
FileDelete($s_LockFileName)
|
||||
FileWriteLine("MultiuserLOG.txt", @YEAR & "-" & @MON & "-" & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC & " - LOGOUT => USERNAME: " & @UserName & _
|
||||
" COMPUTERNAME: " & @ComputerName & " RDP-Client: " & $s_clientname & " - " & $s_ip)
|
||||
Sleep (2000)
|
||||
|
||||
If FileExists($s_LockFileName) = 1 Then
|
||||
MsgBox(16,"Warnung", "Konnte das Calibre-Lock-File nicht l<>schen:" & @CRLF & @ScriptDir & "\" & $s_CalibreProgramName)
|
||||
Exit 1
|
||||
Else
|
||||
Exit 0
|
||||
EndIf
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
123
V3/CalibreMultiuserStarterV3.au3.4.bak
Normal file
123
V3/CalibreMultiuserStarterV3.au3.4.bak
Normal file
@@ -0,0 +1,123 @@
|
||||
#NoTrayIcon
|
||||
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
|
||||
#AutoIt3Wrapper_Icon=CalibeIcon.ico
|
||||
#AutoIt3Wrapper_Res_Description=2013 Bernhard Linz / Bernhard@znil.de / http://znil.net
|
||||
#AutoIt3Wrapper_Res_Fileversion=1.0.0.9
|
||||
#AutoIt3Wrapper_Res_Fileversion_AutoIncrement=y
|
||||
#AutoIt3Wrapper_Res_LegalCopyright=znil.net
|
||||
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
|
||||
|
||||
Dim Const $s_LockFileName = "CalibreLockFile.txt"
|
||||
Dim Const $s_CalibreProgramName = "calibre-portable.exe"
|
||||
Dim Const $s_CalibreMainProgramName = "calibre.exe"
|
||||
Dim $h_lockfile
|
||||
Dim $h_Calibre
|
||||
Dim $b_RunCalibe = False
|
||||
Dim $a_gelockt_von
|
||||
Dim $h_DllErgebnis
|
||||
Dim $s_clientname
|
||||
Dim $s_ip
|
||||
Dim $a_DezimalIP[5]
|
||||
Dim $b_CalibreWindowsActive = False
|
||||
|
||||
|
||||
If FileExists($s_LockFileName) = 1 Then
|
||||
$h_lockfile = FileOpen($s_LockFileName,0)
|
||||
$a_gelockt_von = StringSplit(FileReadLine($s_LockFileName), ":", 0)
|
||||
FileClose($h_lockfile)
|
||||
; $a_gelockt_von[1] = Benutzername
|
||||
; $a_gelockt_von[2] = Computername
|
||||
; $a_gelockt_von[3] = Stunde
|
||||
; $a_gelockt_von[4] = Minute
|
||||
; $a_gelockt_von[5] = Tag
|
||||
; $a_gelockt_von[6] = Monat
|
||||
; $a_gelockt_von[7] = Jahr
|
||||
If $a_gelockt_von[0] = 7 Then
|
||||
MsgBox(262160, "Calibre blockiert", "Der Benutzer '" & $a_gelockt_von[1] & "' am Computer '" & $a_gelockt_von[2] & "'" & @CRLF & _
|
||||
"hat bereits um " & $a_gelockt_von[3] & ":" & $a_gelockt_von[4] & " Uhr am " & $a_gelockt_von[5] & "." & $a_gelockt_von[6] & "." & $a_gelockt_von[7] & @CRLF & _
|
||||
"Calibre gestartet und nimmt eventuell <20>nderungen vor." & @CRLF & @CRLF & _
|
||||
"Programmaufruf ist blockiert!")
|
||||
EndIf
|
||||
$b_RunCalibe = False
|
||||
Else
|
||||
$h_lockfile = FileOpen($s_LockFileName,2)
|
||||
FileWriteLine($h_lockfile, @UserName & ":" & @ComputerName & ":" & @HOUR & ":" & @MIN & ":" & @MDAY & ":" & @MON & ":" & @YEAR & @CRLF)
|
||||
FileClose($h_lockfile)
|
||||
$b_RunCalibe = True
|
||||
; Dinge aus RDP-Session herausfinden
|
||||
$h_DllErgebnis = DllCall("Wtsapi32.dll","BOOL","WTSQuerySessionInformationW","int",0, "int", -1, "int", 10, "ptr*", 0, "DWORD*",0)
|
||||
If @error Or $h_DllErgebnis[0] = 0 Then
|
||||
$s_clientname = "unknown"
|
||||
Else
|
||||
$s_clientname = BinaryToString( DllStructGetData(DllStructCreate("byte[" & $h_DllErgebnis[5] & "]" , $h_DllErgebnis[4]),1) ,2)
|
||||
DllCall("Wtsapi32.dll", "int", "WTSFreeMemory", "ptr", $h_DllErgebnis[4])
|
||||
EndIf
|
||||
$h_DllErgebnis = DllCall("Wtsapi32.dll","int", "WTSQuerySessionInformationW", "Ptr", 0, "int", -1, "int", 14, "ptr*", 0, "DWORD*", 0)
|
||||
If @error Or $h_DllErgebnis[0] = 0 Then
|
||||
$s_ip = "unknown"
|
||||
Else
|
||||
$s_ip = DllStructGetData(DllStructCreate("byte[" & $h_DllErgebnis[5] & "]" , $h_DllErgebnis[4]),1)
|
||||
DllCall("Wtsapi32.dll", "int", "WTSFreeMemory", "ptr", $h_DllErgebnis[4])
|
||||
$s_ip = StringTrimLeft($s_ip,14)
|
||||
$a_DezimalIP[1] = Dec(StringLeft($s_ip,2))
|
||||
$s_ip = StringTrimLeft($s_ip,2)
|
||||
$a_DezimalIP[2] = Dec(StringLeft($s_ip,2))
|
||||
$s_ip = StringTrimLeft($s_ip,2)
|
||||
$a_DezimalIP[3] = Dec(StringLeft($s_ip,2))
|
||||
$s_ip = StringTrimLeft($s_ip,2)
|
||||
$a_DezimalIP[4] = Dec(StringLeft($s_ip,2))
|
||||
$s_ip = $a_DezimalIP[1] & "." & $a_DezimalIP[2] & "." & $a_DezimalIP[3] & "." & $a_DezimalIP[4]
|
||||
EndIf
|
||||
; Und Logfile-Schreiben
|
||||
If $s_clientname = "" Then
|
||||
$s_clientname = "Keine RDP Sitzung!"
|
||||
$s_ip = ""
|
||||
EndIf
|
||||
|
||||
FileWriteLine(@ScriptDir & "\MultiuserLOG.txt", @YEAR & "-" & @MON & "-" & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC & " - LOGIN => USERNAME: " & @UserName & _
|
||||
" COMPUTERNAME: " & @ComputerName & " RDP-Client: " & $s_clientname & " - " & $s_ip)
|
||||
EndIf
|
||||
|
||||
|
||||
If $b_RunCalibe = False Then
|
||||
Exit 1
|
||||
EndIf
|
||||
|
||||
$h_Calibre = Run(@ScriptDir & "\" & $s_CalibreProgramName, @ScriptDir, @SW_MAXIMIZE)
|
||||
If $h_Calibre = 0 Then
|
||||
FileDelete($s_LockFileName)
|
||||
MsgBox(16, "Fehler", "Konnte '" & @ScriptDir & "\" & $s_CalibreProgramName & "' nicht starten")
|
||||
Exit 1
|
||||
EndIf
|
||||
|
||||
|
||||
Do
|
||||
If $b_CalibreWindowsActive = False Then
|
||||
If WinExists ("Calibre") = 1 Then
|
||||
MsgBox(0, "Calibre-Fenster", "Ist da!")
|
||||
$b_CalibreWindowsActive = True
|
||||
EndIf
|
||||
EndIf
|
||||
Sleep(3000)
|
||||
;ConsoleWrite($h_Calibre & @CRLF)
|
||||
If (ProcessExists($h_Calibre) = 0) And (ProcessExists($s_CalibreMainProgramName) = 0) Then
|
||||
$b_RunCalibe = False
|
||||
EndIf
|
||||
Until $b_RunCalibe = False
|
||||
|
||||
FileDelete($s_LockFileName)
|
||||
FileWriteLine("MultiuserLOG.txt", @YEAR & "-" & @MON & "-" & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC & " - LOGOUT => USERNAME: " & @UserName & _
|
||||
" COMPUTERNAME: " & @ComputerName & " RDP-Client: " & $s_clientname & " - " & $s_ip)
|
||||
Sleep (2000)
|
||||
|
||||
If FileExists($s_LockFileName) = 1 Then
|
||||
MsgBox(16,"Warnung", "Konnte das Calibre-Lock-File nicht l<>schen:" & @CRLF & @ScriptDir & "\" & $s_CalibreProgramName)
|
||||
Exit 1
|
||||
Else
|
||||
Exit 0
|
||||
EndIf
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
123
V3/CalibreMultiuserStarterV3.au3.5.bak
Normal file
123
V3/CalibreMultiuserStarterV3.au3.5.bak
Normal file
@@ -0,0 +1,123 @@
|
||||
#NoTrayIcon
|
||||
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
|
||||
#AutoIt3Wrapper_Icon=CalibeIcon.ico
|
||||
#AutoIt3Wrapper_Res_Description=2013 Bernhard Linz / Bernhard@znil.de / http://znil.net
|
||||
#AutoIt3Wrapper_Res_Fileversion=1.0.0.8
|
||||
#AutoIt3Wrapper_Res_Fileversion_AutoIncrement=y
|
||||
#AutoIt3Wrapper_Res_LegalCopyright=znil.net
|
||||
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
|
||||
|
||||
Dim Const $s_LockFileName = "CalibreLockFile.txt"
|
||||
Dim Const $s_CalibreProgramName = "calibre-portable.exe"
|
||||
Dim Const $s_CalibreMainProgramName = "calibre.exe"
|
||||
Dim $h_lockfile
|
||||
Dim $h_Calibre
|
||||
Dim $b_RunCalibe = False
|
||||
Dim $a_gelockt_von
|
||||
Dim $h_DllErgebnis
|
||||
Dim $s_clientname
|
||||
Dim $s_ip
|
||||
Dim $a_DezimalIP[5]
|
||||
Dim $b_CalibreWindowsActive = False
|
||||
|
||||
|
||||
If FileExists($s_LockFileName) = 1 Then
|
||||
$h_lockfile = FileOpen($s_LockFileName,0)
|
||||
$a_gelockt_von = StringSplit(FileReadLine($s_LockFileName), ":", 0)
|
||||
FileClose($h_lockfile)
|
||||
; $a_gelockt_von[1] = Benutzername
|
||||
; $a_gelockt_von[2] = Computername
|
||||
; $a_gelockt_von[3] = Stunde
|
||||
; $a_gelockt_von[4] = Minute
|
||||
; $a_gelockt_von[5] = Tag
|
||||
; $a_gelockt_von[6] = Monat
|
||||
; $a_gelockt_von[7] = Jahr
|
||||
If $a_gelockt_von[0] = 7 Then
|
||||
MsgBox(262160, "Calibre blockiert", "Der Benutzer '" & $a_gelockt_von[1] & "' am Computer '" & $a_gelockt_von[2] & "'" & @CRLF & _
|
||||
"hat bereits um " & $a_gelockt_von[3] & ":" & $a_gelockt_von[4] & " Uhr am " & $a_gelockt_von[5] & "." & $a_gelockt_von[6] & "." & $a_gelockt_von[7] & @CRLF & _
|
||||
"Calibre gestartet und nimmt eventuell <20>nderungen vor." & @CRLF & @CRLF & _
|
||||
"Programmaufruf ist blockiert!")
|
||||
EndIf
|
||||
$b_RunCalibe = False
|
||||
Else
|
||||
$h_lockfile = FileOpen($s_LockFileName,2)
|
||||
FileWriteLine($h_lockfile, @UserName & ":" & @ComputerName & ":" & @HOUR & ":" & @MIN & ":" & @MDAY & ":" & @MON & ":" & @YEAR & @CRLF)
|
||||
FileClose($h_lockfile)
|
||||
$b_RunCalibe = True
|
||||
; Dinge aus RDP-Session herausfinden
|
||||
$h_DllErgebnis = DllCall("Wtsapi32.dll","BOOL","WTSQuerySessionInformationW","int",0, "int", -1, "int", 10, "ptr*", 0, "DWORD*",0)
|
||||
If @error Or $h_DllErgebnis[0] = 0 Then
|
||||
$s_clientname = "unknown"
|
||||
Else
|
||||
$s_clientname = BinaryToString( DllStructGetData(DllStructCreate("byte[" & $h_DllErgebnis[5] & "]" , $h_DllErgebnis[4]),1) ,2)
|
||||
DllCall("Wtsapi32.dll", "int", "WTSFreeMemory", "ptr", $h_DllErgebnis[4])
|
||||
EndIf
|
||||
$h_DllErgebnis = DllCall("Wtsapi32.dll","int", "WTSQuerySessionInformationW", "Ptr", 0, "int", -1, "int", 14, "ptr*", 0, "DWORD*", 0)
|
||||
If @error Or $h_DllErgebnis[0] = 0 Then
|
||||
$s_ip = "unknown"
|
||||
Else
|
||||
$s_ip = DllStructGetData(DllStructCreate("byte[" & $h_DllErgebnis[5] & "]" , $h_DllErgebnis[4]),1)
|
||||
DllCall("Wtsapi32.dll", "int", "WTSFreeMemory", "ptr", $h_DllErgebnis[4])
|
||||
$s_ip = StringTrimLeft($s_ip,14)
|
||||
$a_DezimalIP[1] = Dec(StringLeft($s_ip,2))
|
||||
$s_ip = StringTrimLeft($s_ip,2)
|
||||
$a_DezimalIP[2] = Dec(StringLeft($s_ip,2))
|
||||
$s_ip = StringTrimLeft($s_ip,2)
|
||||
$a_DezimalIP[3] = Dec(StringLeft($s_ip,2))
|
||||
$s_ip = StringTrimLeft($s_ip,2)
|
||||
$a_DezimalIP[4] = Dec(StringLeft($s_ip,2))
|
||||
$s_ip = $a_DezimalIP[1] & "." & $a_DezimalIP[2] & "." & $a_DezimalIP[3] & "." & $a_DezimalIP[4]
|
||||
EndIf
|
||||
; Und Logfile-Schreiben
|
||||
If $s_clientname = "" Then
|
||||
$s_clientname = "Keine RDP Sitzung!"
|
||||
$s_ip = ""
|
||||
EndIf
|
||||
|
||||
FileWriteLine(@ScriptDir & "\MultiuserLOG.txt", @YEAR & "-" & @MON & "-" & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC & " - LOGIN => USERNAME: " & @UserName & _
|
||||
" COMPUTERNAME: " & @ComputerName & " RDP-Client: " & $s_clientname & " - " & $s_ip)
|
||||
EndIf
|
||||
|
||||
|
||||
If $b_RunCalibe = False Then
|
||||
Exit 1
|
||||
EndIf
|
||||
|
||||
$h_Calibre = Run(@ScriptDir & "\" & $s_CalibreProgramName, @ScriptDir, @SW_MAXIMIZE)
|
||||
If $h_Calibre = 0 Then
|
||||
FileDelete($s_LockFileName)
|
||||
MsgBox(16, "Fehler", "Konnte '" & @ScriptDir & "\" & $s_CalibreProgramName & "' nicht starten")
|
||||
Exit 1
|
||||
EndIf
|
||||
|
||||
|
||||
Do
|
||||
If $b_CalibreWindowsActive = False Then
|
||||
If WinExists ("Calibre") = 1 Then
|
||||
MsgBox("Calibre-Fenster", "Ist da!")
|
||||
$b_CalibreWindowsActive = True
|
||||
EndIf
|
||||
EndIf
|
||||
Sleep(3000)
|
||||
;ConsoleWrite($h_Calibre & @CRLF)
|
||||
If (ProcessExists($h_Calibre) = 0) And (ProcessExists($s_CalibreMainProgramName) = 0) Then
|
||||
$b_RunCalibe = False
|
||||
EndIf
|
||||
Until $b_RunCalibe = False
|
||||
|
||||
FileDelete($s_LockFileName)
|
||||
FileWriteLine("MultiuserLOG.txt", @YEAR & "-" & @MON & "-" & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC & " - LOGOUT => USERNAME: " & @UserName & _
|
||||
" COMPUTERNAME: " & @ComputerName & " RDP-Client: " & $s_clientname & " - " & $s_ip)
|
||||
Sleep (2000)
|
||||
|
||||
If FileExists($s_LockFileName) = 1 Then
|
||||
MsgBox(16,"Warnung", "Konnte das Calibre-Lock-File nicht l<>schen:" & @CRLF & @ScriptDir & "\" & $s_CalibreProgramName)
|
||||
Exit 1
|
||||
Else
|
||||
Exit 0
|
||||
EndIf
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
117
V3/CalibreMultiuserStarterV3.au3.6.bak
Normal file
117
V3/CalibreMultiuserStarterV3.au3.6.bak
Normal file
@@ -0,0 +1,117 @@
|
||||
#NoTrayIcon
|
||||
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
|
||||
#AutoIt3Wrapper_Icon=CalibeIcon.ico
|
||||
#AutoIt3Wrapper_Res_Description=2013 Bernhard Linz / Bernhard@znil.de / http://znil.net
|
||||
#AutoIt3Wrapper_Res_Fileversion=1.0.0.8
|
||||
#AutoIt3Wrapper_Res_Fileversion_AutoIncrement=y
|
||||
#AutoIt3Wrapper_Res_LegalCopyright=znil.net
|
||||
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
|
||||
|
||||
Dim Const $s_LockFileName = "CalibreLockFile.txt"
|
||||
Dim Const $s_CalibreProgramName = "calibre-portable.exe"
|
||||
Dim Const $s_CalibreMainProgramName = "calibre.exe"
|
||||
Dim $h_lockfile
|
||||
Dim $h_Calibre
|
||||
Dim $b_RunCalibe = False
|
||||
Dim $a_gelockt_von
|
||||
Dim $h_DllErgebnis
|
||||
Dim $s_clientname
|
||||
Dim $s_ip
|
||||
Dim $a_DezimalIP[5]
|
||||
|
||||
|
||||
If FileExists($s_LockFileName) = 1 Then
|
||||
$h_lockfile = FileOpen($s_LockFileName,0)
|
||||
$a_gelockt_von = StringSplit(FileReadLine($s_LockFileName), ":", 0)
|
||||
FileClose($h_lockfile)
|
||||
; $a_gelockt_von[1] = Benutzername
|
||||
; $a_gelockt_von[2] = Computername
|
||||
; $a_gelockt_von[3] = Stunde
|
||||
; $a_gelockt_von[4] = Minute
|
||||
; $a_gelockt_von[5] = Tag
|
||||
; $a_gelockt_von[6] = Monat
|
||||
; $a_gelockt_von[7] = Jahr
|
||||
If $a_gelockt_von[0] = 7 Then
|
||||
MsgBox(262160, "Calibre blockiert", "Der Benutzer '" & $a_gelockt_von[1] & "' am Computer '" & $a_gelockt_von[2] & "'" & @CRLF & _
|
||||
"hat bereits um " & $a_gelockt_von[3] & ":" & $a_gelockt_von[4] & " Uhr am " & $a_gelockt_von[5] & "." & $a_gelockt_von[6] & "." & $a_gelockt_von[7] & @CRLF & _
|
||||
"Calibre gestartet und nimmt eventuell <20>nderungen vor." & @CRLF & @CRLF & _
|
||||
"Programmaufruf ist blockiert!")
|
||||
EndIf
|
||||
$b_RunCalibe = False
|
||||
Else
|
||||
$h_lockfile = FileOpen($s_LockFileName,2)
|
||||
FileWriteLine($h_lockfile, @UserName & ":" & @ComputerName & ":" & @HOUR & ":" & @MIN & ":" & @MDAY & ":" & @MON & ":" & @YEAR & @CRLF)
|
||||
FileClose($h_lockfile)
|
||||
$b_RunCalibe = True
|
||||
; Dinge aus RDP-Session herausfinden
|
||||
$h_DllErgebnis = DllCall("Wtsapi32.dll","BOOL","WTSQuerySessionInformationW","int",0, "int", -1, "int", 10, "ptr*", 0, "DWORD*",0)
|
||||
If @error Or $h_DllErgebnis[0] = 0 Then
|
||||
$s_clientname = "unknown"
|
||||
Else
|
||||
$s_clientname = BinaryToString( DllStructGetData(DllStructCreate("byte[" & $h_DllErgebnis[5] & "]" , $h_DllErgebnis[4]),1) ,2)
|
||||
DllCall("Wtsapi32.dll", "int", "WTSFreeMemory", "ptr", $h_DllErgebnis[4])
|
||||
EndIf
|
||||
$h_DllErgebnis = DllCall("Wtsapi32.dll","int", "WTSQuerySessionInformationW", "Ptr", 0, "int", -1, "int", 14, "ptr*", 0, "DWORD*", 0)
|
||||
If @error Or $h_DllErgebnis[0] = 0 Then
|
||||
$s_ip = "unknown"
|
||||
Else
|
||||
$s_ip = DllStructGetData(DllStructCreate("byte[" & $h_DllErgebnis[5] & "]" , $h_DllErgebnis[4]),1)
|
||||
DllCall("Wtsapi32.dll", "int", "WTSFreeMemory", "ptr", $h_DllErgebnis[4])
|
||||
$s_ip = StringTrimLeft($s_ip,14)
|
||||
$a_DezimalIP[1] = Dec(StringLeft($s_ip,2))
|
||||
$s_ip = StringTrimLeft($s_ip,2)
|
||||
$a_DezimalIP[2] = Dec(StringLeft($s_ip,2))
|
||||
$s_ip = StringTrimLeft($s_ip,2)
|
||||
$a_DezimalIP[3] = Dec(StringLeft($s_ip,2))
|
||||
$s_ip = StringTrimLeft($s_ip,2)
|
||||
$a_DezimalIP[4] = Dec(StringLeft($s_ip,2))
|
||||
$s_ip = $a_DezimalIP[1] & "." & $a_DezimalIP[2] & "." & $a_DezimalIP[3] & "." & $a_DezimalIP[4]
|
||||
EndIf
|
||||
; Und Logfile-Schreiben
|
||||
If $s_clientname = "" Then
|
||||
$s_clientname = "Keine RDP Sitzung!"
|
||||
$s_ip = ""
|
||||
EndIf
|
||||
|
||||
FileWriteLine(@ScriptDir & "\MultiuserLOG.txt", @YEAR & "-" & @MON & "-" & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC & " - LOGIN => USERNAME: " & @UserName & _
|
||||
" COMPUTERNAME: " & @ComputerName & " RDP-Client: " & $s_clientname & " - " & $s_ip)
|
||||
EndIf
|
||||
|
||||
|
||||
If $b_RunCalibe = False Then
|
||||
Exit 1
|
||||
EndIf
|
||||
|
||||
$h_Calibre = Run(@ScriptDir & "\" & $s_CalibreProgramName, @ScriptDir, @SW_MAXIMIZE)
|
||||
If $h_Calibre = 0 Then
|
||||
FileDelete($s_LockFileName)
|
||||
MsgBox(16, "Fehler", "Konnte '" & @ScriptDir & "\" & $s_CalibreProgramName & "' nicht starten")
|
||||
Exit 1
|
||||
EndIf
|
||||
|
||||
|
||||
|
||||
Do
|
||||
Sleep(3000)
|
||||
;ConsoleWrite($h_Calibre & @CRLF)
|
||||
If (ProcessExists($h_Calibre) = 0) And (ProcessExists($s_CalibreMainProgramName) = 0) Then
|
||||
$b_RunCalibe = False
|
||||
EndIf
|
||||
Until $b_RunCalibe = False
|
||||
|
||||
FileDelete($s_LockFileName)
|
||||
FileWriteLine("MultiuserLOG.txt", @YEAR & "-" & @MON & "-" & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC & " - LOGOUT => USERNAME: " & @UserName & _
|
||||
" COMPUTERNAME: " & @ComputerName & " RDP-Client: " & $s_clientname & " - " & $s_ip)
|
||||
Sleep (2000)
|
||||
|
||||
If FileExists($s_LockFileName) = 1 Then
|
||||
MsgBox(16,"Warnung", "Konnte das Calibre-Lock-File nicht l<>schen:" & @CRLF & @ScriptDir & "\" & $s_CalibreProgramName)
|
||||
Exit 1
|
||||
Else
|
||||
Exit 0
|
||||
EndIf
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
BIN
V3/CalibreMultiuserStarterV3.exe
Normal file
BIN
V3/CalibreMultiuserStarterV3.exe
Normal file
Binary file not shown.
Reference in New Issue
Block a user