Hallo miteinander,
ich versuche vergeblich eine Progressbar in angehängtes Script einzubinden und hoffe Ihr könnt mir helfen.
Kurzbeschreibung vom Script:
Es wird eine CSV Datei aus dem i-Net heruntergeladen und in ein bzw. mehrer Arrays geschrieben (_FileReadToArray)
dann werden alle Outlook Kalendereinträge mit der Kategorie "Schichtplan" eingelesen und ebenfalls in ein bzw. mehrer Arrays geschrieben
Die Arrays werden miteinander verglichen, vorhande Kalendereinträge ggf. geändert oder gelöscht, neue Kalendereintrage hinzugefügt.
Das ganze funktioniert wunderbar.
Jetzt ist es so, das einlesen und schreiben bzw. verändern der Kalendereinträge und das vergleiche der Arrays dauert eine gewisse Zeit.
Für diese Zeit würde ich gerne eine Progressbar einbinden... ich bekomme es aber nicht hin.
Übergangsweise lasse ich in der Zeit ein "SplashTextOn("Update", "Moment bitte, Kalender-Update wird durchgeführt.",400,50)" anzeigen.
Kann mir da jemand helfen bitte.
Div. Beispiele und unendliches Suchem im I-net var erfolglos.
Spoiler anzeigen
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>
#include <File.au3>
#include <String.au3>
#include <Array.au3>
#include <IE.au3>
#include <OutlookEX\OutlookEX.au3>
local $message
Local $alt_file
Local $neu_file
local $a_split
local $a_Var
local $n_split
local $n_Var
SplashTextOn("Update", "Moment bitte, Kalender-Update wird durchgeführt.",400,50)
[/autoit] [autoit][/autoit] [autoit]; -----------------------------------------------------------------------------------------------------------
; Schichtplan CSV Datei von Internetseite einlesen bzw. downloaden.
; -----------------------------------------------------------------------------------------------------------
InetGet("http://www.xxxxxxxxxxx.xx/xxxxx/xxxxxxxx.csv", "E:\xxxxxxxx\xxxxxxxx.csv",1,0)
; -----------------------------------------------------------------------------------------------------------
; Schichtplan CSV Datei in ein Array lesen
; -----------------------------------------------------------------------------------------------------------
_FileReadToArray("E:\xxxxxxxx\xxxxxxxx.csv", $neu_file)
_ArrayDelete($neu_file, 0)
local $n_caldays[UBound($neu_file)]
local $n_entryid[UBound($neu_file)]
local $n_subject[UBound($neu_file)]
local $n_start[UBound($neu_file)]
local $n_end[UBound($neu_file)]
local $n_AllDayEvent[UBound($neu_file)]
local $n_ReminderSet[UBound($neu_file)]
local $n_ReminderMinutesBeforeStart[UBound($neu_file)]
local $n_Categories[UBound($neu_file)]
local $n_split
; -----------------------------------------------------------------------------------------------------------
; Vorhandene Outlook Kalendereinträge in Arrays schreiben
; -----------------------------------------------------------------------------------------------------------
Global $oOutlook = _OL_Open()
Global $aFolder = _OL_FolderAccess($oOutlook, "icloud\Kalender")
Global $aItems = _OL_ItemFind($oOutlook, "icloud\Kalender", $olAppointment, "", "Categories", "Schichtplan", "Start,EntryID,Subject" , "")
_ArrayDelete($aItems, 0)
_OL_Close($oOutlook)
local $a_caldays[UBound($aItems)]
local $a_entryid[UBound($aItems)]
local $a_subject[UBound($aItems)]
local $a_start[UBound($aItems)]
$x = 0
For $i = 0 to Ubound($aItems) -1
$a_caldays[$x] = $aItems[$x][0] & " - " & $aItems[$x][2]
$a_entryid[$x] = $aItems[$x][1]
$a_subject[$x] = $aItems[$x][2]
$a_start[$x] = stringLeft($aItems[$x][0],
$x = $x + 1
Next
; -----------------------------------------------------------------------------------------------------------
; Werte aus Aktuellem Schichtplan aus CSV zur weiterverarbeitung in Arrays schreiben.
; -----------------------------------------------------------------------------------------------------------
$x = 0
For $i = 0 to UBound($neu_file) - 1
$n_split = StringSplit($neu_file[$x], ";")
$n_caldays[$x] = $n_split[2] & " - " & $n_split[1]
$n_subject[$x] = $n_split[1]
$n_start[$x] = stringleft($n_split[2],
$n_end[$x] = $n_split[3]
$n_AllDayEvent[$x] = $n_split[4]
$n_ReminderSet[$x] = $n_split[5]
$n_ReminderMinutesBeforeStart[$x] = $n_split[6]
Switch $n_split[1]
Case "Variable", "Früh", "Spät/Früh (getauscht)", "Nacht/Früh(getauscht)", "A-Nacht/M-Tag (getauscht)", "Sonder Früh", "V Früh", "M-Tag", "Sonder M-Tag", "V M-Tag"
$n_Categories[$x] = "Frühdienst; " & $n_split[7]
Case "Spät", "Früh/Spät (getauscht)", "Nacht/Spät(getauscht)", "Sonder Spät", "V Spät", "Nacht/Spät (getauscht)", "Spät (HomeOffice)"
$n_Categories[$x] = "Spätdienst; " & $n_split[7]
Case "Nacht", "Früh/Nacht (getauscht)", "Spät/Nacht (getauscht)", "M-Tag/A-Nacht (getauscht)", "Sonder Nacht", "V Nacht", "A-Nacht", "Sonder A-Nacht", "V A-Nacht"
$n_Categories[$x] = "Nachtdienst; " & $n_split[7]
Case "Früh (Krank)", "Spät (Krank)", "Nacht (Krank)", "M-Tag (Krank)", "A-Nacht (Krank)", "V (Krank)"
$n_Categories[$x] = "Krank; " & $n_split[7]
Case "Früh (Urlaub)", "Spät (Urlaub)", "Nacht (Urlaub)", "M-Tag (Urlaub)", "A-Nacht (Urlaub)", "V (Urlaub)"
$n_Categories[$x] = "Urlaub; " & $n_split[7]
Case "Früh/- (Frei)", "Spät/- (Frei)", "Nacht/- (Frei)", "M-Tag/- (Frei)", "A-Nacht/- (Frei)", "Urlaub (Frei)", "V (Frei)"
$n_Categories[$x] = "Frei; " & $n_split[7]
EndSwitch
$x = $x + 1
Next
; -----------------------------------------------------------------------------------------------------------
; ArrayList Object mit Datumswerte aus vorhandenen Outlook Kalendereinträge.
; -----------------------------------------------------------------------------------------------------------
$a_AList = ObjCreate("System.Collections.ArrayList")
For $i in $a_caldays
$a_AList.add ($i)
Next
$n_AList = ObjCreate("System.Collections.ArrayList")
For $i in $n_caldays
$n_AList.add ($i)
Next
; -----------------------------------------------------------------------------------------------------------
; Datum beider Arrays vergleichen und ggf. Outlook Kalendereintrag ändern oder hinzufügen.
; -----------------------------------------------------------------------------------------------------------
$x = 0
For $i in $n_start
If not $a_AList.Contains ($n_caldays[$x]) Then
$index = _ArraySearch($a_start, $i)
$n_start_date = StringMid($n_caldays[$x], 7, 2) & "." & StringMid($n_caldays[$x], 5, 2) & "." & StringMid($n_caldays[$x], 1, 4) & " " & StringMid($n_caldays[$x], 9, 2) & ":" & StringMid($n_caldays[$x], 11, 2) & ":" & StringMid($n_caldays[$x], 13, 2)
$n_end_date = StringMid($n_end[$x], 7, 2) & "." & StringMid($n_end[$x], 5, 2) & "." & StringMid($n_end[$x], 1, 4) & " " & StringMid($n_end[$x], 9, 2) & ":" & StringMid($n_end[$x], 11, 2) & ":" & StringMid($n_end[$x], 13, 2)
If $index <> -1 Then
$message = StringMid($n_caldays[$x], 7, 2) & "." & StringMid($n_caldays[$x], 5, 2) & "." & StringMid($n_caldays[$x], 1, 4) & " wurde nach """ & $n_subject[$x] & """ geändert!" & @CRLF
Global $oOutlook = _OL_Open()
Global $aFolder = _OL_FolderAccess($oOutlook, "icloud\Kalender")
Global $oOutlook = _OL_Open()
Global $aFolder = _OL_FolderAccess($oOutlook, "icloud\Kalender")
_OL_ItemModify($oOutlook, $a_entryid[$index],Default, "Subject=" & $n_subject[$x], "Start=" & $n_start_date, "End=" & $n_end_date, "Categories=" & $n_Categories[$x])
_OL_Close($oOutlook)
Else
$message = $message & StringMid($n_caldays[$x], 7, 2) & "." & StringMid($n_caldays[$x], 5, 2) & "." & StringMid($n_caldays[$x], 1, 4) & " """ & $n_subject[$x] & """ wurde hinzugefügt!" & @CRLF
Global $oOutlook = _OL_Open()
Global $aFolder = _OL_FolderAccess($oOutlook, "icloud\Kalender")
$oItem = _OL_ItemCreate($oOutlook, $olAppointmentItem, "icloud\Kalender", "", "Subject=" & $n_subject[$x] , "Start=" & $n_start_date, "End=" & $n_end_date, "Categories=" & $n_Categories[$x], "Location=", "RequiredAttendees=" & $oOutlook.GetNameSpace("MAPI" ).CurrentUser.Name)
$oItem.save
_OL_Close($oOutlook)
EndIf
EndIf
$x = $x + 1
Next
$x = 0
For $i in $a_start
If not $n_AList.Contains ($a_caldays[$x]) Then
$index = _ArraySearch($n_start, $i)
If $index <> -1 Then
Else
$message = $message & StringMid($a_caldays[$x], 7, 2) & "." & StringMid($a_caldays[$x], 5, 2) & "." & StringMid($a_caldays[$x], 1, 4) & " """ & $a_subject[$x] & """ wurde gelöscht!" & @CRLF
Global $oOutlook = _OL_Open()
Global $aFolder = _OL_FolderAccess($oOutlook, "icloud\Kalender")
_OL_ItemDelete($oOutlook, $a_entryid[$x])
_OL_Close($oOutlook)
EndIf
EndIf
$x = $x + 1
Next
SplashOff()
[/autoit] [autoit][/autoit] [autoit]IF $message = "" Then
msgbox(64,"Schichtplan Update-Meldung","keine Änderungen vorgenommen!")
Else
msgbox(64,"Schichtplan Update-Meldung",$message)
EndIf
Exit