CalibreMultiuserStarter/Thunderbird/ThunderbirdMultiuserStarter...

80 lines
2.9 KiB
Plaintext
Raw Permalink Blame History

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.

#NoTrayIcon
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=thunderbird.ico
#AutoIt3Wrapper_Outfile=ThunderbirdMultiUserStarter.exe
#AutoIt3Wrapper_Outfile_x64=D:\Dropbox\Thunderbird Portable\ThunderbirdPortable.exe
#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
#AutoIt3Wrapper_AU3Check_Stop_OnWarning=y
#AutoIt3Wrapper_Run_Tidy=y
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#Region
; **** Directives created by AutoIt3Wrapper_GUI ****
#EndRegion
; **** Directives created by AutoIt3Wrapper_GUI ****
; ThunderbirdMultiuserStarter
; 2013 von Bernhard Linz
; http://znil.net
; Bernhard@znil.net 
Dim Const $s_LockFileName = "ThunderbirdLockFile.txt"
Dim Const $s_ThunderbirdProgramName = "ThunderbirdPortable.exe"
Dim Const $s_ThunderbirdMainProgramName = "Thunderbird.exe"
Dim $h_lockfile
Dim $h_Thunderbird
Dim $b_RunThunderbird = False
Dim $a_gelockt_von
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, "Thunderbird 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 & _
"Thunderbird gestartet und nimmt eventuell Änderungen vor." & @CRLF & @CRLF & _
"Programmaufruf ist blockiert!")
EndIf
$b_RunThunderbird = False
Else
$h_lockfile = FileOpen($s_LockFileName, 2)
FileWriteLine($h_lockfile, @UserName & ":" & @ComputerName & ":" & @HOUR & ":" & @MIN & ":" & @MDAY & ":" & @MON & ":" & @YEAR & @CRLF)
FileClose($h_lockfile)
$b_RunThunderbird = True
EndIf
; 
If $b_RunThunderbird = False Then
Exit 1
EndIf
; 
$h_Thunderbird = Run(@ScriptDir & "\" & $s_ThunderbirdProgramName, @ScriptDir, @SW_MAXIMIZE)
If $h_Thunderbird = 0 Then
FileDelete($s_LockFileName)
MsgBox(16, "Fehler", "Konnte '" & @ScriptDir & "\" & $s_ThunderbirdProgramName & "' nicht starten")
Exit 1
EndIf
; 
Do
Sleep(3000)
If (ProcessExists($h_Thunderbird) = 0) And (ProcessExists($s_ThunderbirdMainProgramName) = 0) Then
$b_RunThunderbird = False
EndIf
Until $b_RunThunderbird = False
;
FileDelete($s_LockFileName)
Sleep(3000)
; 
If FileExists($s_LockFileName) = 1 Then
MsgBox(16, "Warnung", "Konnte das Thunderbird-Lock-File nicht löschen:" & @CRLF & @ScriptDir & "\" & $s_ThunderbirdProgramName)
Exit 1
Else
Exit 0
EndIf