von mir auch alles gute zum geburtstag ![]()
![]()
:birthday:
von mir auch alles gute zum geburtstag ![]()
![]()
:birthday:
gibt es vieleicht die möglichkeit über den COM zu arbeiten ?
ich kenn mich da nocht nicht wirklich aus.... (bin aber brav am lernen)
lg
Die Version hatte ich auch schon mal ![]()
das war leider zu unzuverlässig ![]()
; Process Balken "Export in eine Datei"
WinWait("Export in eine Datei", "",7)
If WinExists("Export in eine Datei", "") Then WinWaitClose("Export in eine Datei", "")
; Process Balken "Exportieren Satzart 21"
WinWait("Exportieren", "", 10)
If WinExists("Exportieren", "") Then WinWaitClose("Exportieren", "")
; Process Balken "Exportieren der VA-Eingangsrechnungen"
WinWait("Exportieren", "", 10)
If WinExists("Exportieren", "") Then WinWaitClose("Exportieren", "")
des ist mir sehr oft hängen geblieben ![]()
Hi,
die 250 ms sind ein guter anstatz ------- aber reagiert doch zu langsam ![]()
(habs schon mal ausprobiert)
lg
Hi,
du meinst so :
[autoit]While 1
If WinExists("Hinweis", "") Then
ExitLoop
EndIf
WEnd
bzw. so
While 1
If Not WinExists("Exportieren", "") Then
ExitLoop
EndIf
WEn
lgaw
TOMTOM
hmm keiner da ??
Hi Leute !
hab mal wieder ein kleines Problem ![]()
Ich muss in der Nacht einen Export (ins SAP) aus einer Reisebüroanwendung machen.
gut und schön
meistens funktioniert es (wenn viele Daten da sind) aber manchmal wenn relativ wenig daten da sind bleibt er hängen ![]()
So ich häng mal mein Script an:
#Region converted Directives from D:\Scripts_KBHSRV\Export_SAP.au3.ini
#AutoIt3Wrapper_aut2exe=C:\Programme\AutoIt3\Aut2Exe\Aut2Exe.exe
#AutoIt3Wrapper_outfile=\\kbhsrv.eurotours.lan\e$\Scripts\Export_SAP.exe
#AutoIt3Wrapper_Res_Comment=(C) Garnreiter
#AutoIt3Wrapper_Res_Description=Export SAP Daten
#AutoIt3Wrapper_Res_Fileversion=5.0.0.1
#AutoIt3Wrapper_Res_Fileversion_AutoIncrement=y
#AutoIt3Wrapper_Res_LegalCopyright=(C) Garnreiter
#AutoIt3Wrapper_Run_AU3Check=1
#EndRegion converted Directives from D:\Scripts_KBHSRV\Export_SAP.au3.ini
;
#comments-start
CopyRight 2007 (c) Garnreiter
Version 5.0.0.1
#comments-end
Opt("WinWaitDelay", 100)
Opt("WinTitleMatchMode", 4)
Opt("WinDetectHiddenText", 1)
Opt("MouseCoordMode", 0)
#include <file.au3>
Global $root = IniRead(@ScriptDir & "\Export.ini", "PFADE", "root", "keine Pfad konfiguriert") ; E:\
Global $PFAD = IniRead(@ScriptDir & "\Export.ini", "SAP", "pfad", "keine Pfad konfiguriert"); Exportpfad für die Weiterverarbeitung SAP
Global $VON = IniRead(@ScriptDir & "\Export.ini", "SAP", "von", "keine Pfad konfiguriert"); derzeit kein eintrag
Global $BIS = IniRead(@ScriptDir & "\Export.ini", "SAP", "bis", "keine Pfad konfiguriert"); derzeit kein eintrag
Global $CRS = IniRead(@ScriptDir & "\Export.ini", "PFADE", "CRS", "keine Pfad konfiguriert"); Pfad zur Weiterverarbeitungsmaschine
Global $JACDAT = IniRead(@ScriptDir & "\Export.ini", "PFADE", "JACDAT", "keine Pfad konfiguriert"); Programmdatenpfad
Global $JACOFC = IniRead(@ScriptDir & "\Export.ini", "PFADE", "JACOFC", "keine Pfad konfiguriert"); ProgrammPfad
Global $pw = IniRead(@ScriptDir & "\Export.ini", "PW", "pw", "NotFound"); Passwort
Global $MAN = IniRead(@ScriptDir & "\Export.ini", "MANDANT", "MAN", "keine Pfad konfiguriert"); Mandant
$PID = ProcessExists("Jackv30.exe") ; Will return the PID or 0 if the process isn't found.
If $PID Then ProcessClose($PID)
_FileWriteLog($root & "\log\SAP_Export.log", "SAP Export Beginn")
Run($JACOFC & "\Jackv30.exe", $JACDAT); Programm start
;---------------- Passwortabfrage----------------------------------------
WinWait("Paßwort", "Sollten die obigen L")
If Not WinActive("Paßwort", "Sollten die obigen L") Then WinActivate("Paßwort", "Sollten die obigen L")
WinWaitActive("Paßwort", "Sollten die obigen L")
Sleep(2000)
ControlSend("Paßwort", "Sollten die obigen L", 303, "admin")
ControlSend("Paßwort", "Sollten die obigen L", 100, $pw)
ControlClick("Paßwort", "Sollten die obigen L", 301)
If WinExists("Rückfrage", "&Ja") Then
WinWait("Rückfrage", "&Ja")
If Not WinActive("Rückfrage", "&Ja") Then WinActivate("Rückfrage", "&Ja")
WinWaitActive("Rückfrage", "&Ja")
ControlClick("Rückfrage", "&Ja", 6)
Else
Sleep(1)
EndIf
;---------------- Passwortabfrage Ende-----------------------------------
WinWait("Jack / X6.03", "Buchhaltung")
If Not WinActive("Jack / X6.03", "Buchhaltung") Then WinActivate("Jack / X6.03", "Buchhaltung")
WinWaitActive("Jack / X6.03", "Buchhaltung")
;---------------- SAP Export Aufruf--------------------------------------
Send("{ALTDOWN}{F5}{ALTUP}")
WinWait("Vorgangsexport - MIS / SAP", "Beträge ohne Kommaze")
If Not WinActive("Vorgangsexport - MIS / SAP", "Beträge ohne Kommaze") Then WinActivate("Vorgangsexport - MIS / SAP", "Beträge ohne Kommaze")
WinWaitActive("Vorgangsexport - MIS / SAP", "Beträge ohne Kommaze")
ControlClick("Vorgangsexport - MIS / SAP", "", 3926)
ControlSend("Vorgangsexport - MIS / SAP", "Beträge ohne Kommaze", 3921, $MAN)
ControlSend("Vorgangsexport - MIS / SAP", "Beträge ohne Kommaze", 3922, $MAN)
ControlSetText("Vorgangsexport - MIS / SAP", "Beträge ohne Kommaze", 3928, $PFAD ) ; Pfad angabe wohin er exportieren soll
ControlCommand("Vorgangsexport - MIS / SAP", "Beträge ohne Kommaze", 1068, "Check", "")
ControlSend("Vorgangsexport - MIS / SAP", "Beträge ohne Kommaze", 3944, $VON) ; Von wann
ControlSend("Vorgangsexport - MIS / SAP", "Beträge ohne Kommaze", 3946, $BIS) ; Bis wann
ControlClick("Vorgangsexport - MIS / SAP", "Beträge ohne Kommaze", 1)
WinWait("Rückfrage", "Wollen Sie die Daten")
If Not WinActive("Rückfrage", "Wollen Sie die Daten") Then WinActivate("Rückfrage", "Wollen Sie die Daten")
WinWaitActive("Rückfrage", "Wollen Sie die Daten")
ControlClick("Rückfrage", "Wollen Sie die Daten", 6)
;---------------- SAP Exportaufruf Ende-----------------------------------
WinWait("Export in eine Datei", "",7)
; Process Balken "Export in eine Datei"
While 1
Sleep(1)
If Not WinExists("Export in eine Datei", "") Then
ExitLoop
EndIf
WEnd
; Process Balken "Exportieren Satzart 21"
[/autoit] [autoit][/autoit] [autoit]While 1
Sleep(1)
If Not WinExists("Exportieren", "") Then
ExitLoop
EndIf
WEnd
; Process Balken "Exportieren der VA-Eingangsrechnungen"
[/autoit] [autoit][/autoit] [autoit]While 1
Sleep(1)
If Not WinExists("Exportieren", "") Then
ExitLoop
EndIf
WEnd
; Hinweis GUI wieviel Daten exportiert sind"
[/autoit] [autoit][/autoit] [autoit]While 1
Sleep(1)
If WinExists("Hinweis", "") Then
ExitLoop
EndIf
WEnd
If WinExists("Hinweis", "") Then
$handle = WinGetHandle("Hinweis", "")
ControlClick($handle, "", 2)
EndIf
WinWait("Jack / X6.03","Buchhaltung")
If Not WinActive("Jack / X6.03","Buchhaltung") Then WinActivate("Jack / X6.03","Buchhaltung")
WinWaitActive("Jack / X6.03","Buchhaltung")
#comments-start ; alte version
[/autoit] [autoit][/autoit] [autoit];~ While 1
;~ Sleep(200)
;~ If Not WinExists("Export in eine Datei", "") Then
;~ ExitLoop
;~ EndIf
;~ WEnd
;~ While 1
;~ Sleep(200)
;~ If Not WinExists("Exportieren Satzart 21", "") Then
;~ ExitLoop
;~ EndIf
;~ WEnd
;~ While 1
;~ Sleep(200)
;~ If not WinExists("Exportieren der VA-Eingangsrechnungen", "") then
;~ ExitLoop
;~ EndIf
;~ WEnd
;~ While 1
;~ Sleep(200)
;~ If WinExists("Hinweis", "") Then
;~ ExitLoop
;~ EndIf
;~ WEnd
;~ $handle = WinGetHandle("Hinweis", "")
;~ ControlClick($handle, "", 2)
;~ WinWait("Jack / X6.03", "Buchhaltung")
;~ If Not WinActive("Jack / X6.03", "Buchhaltung") Then WinActivate("Jack / X6.03", "Buchhaltung")
;~ WinWaitActive("Jack / X6.03", "Buchhaltung")
#comments-end
[/autoit] [autoit][/autoit] [autoit]$PID = ProcessExists("Jackv30.exe") ; Will return the PID or 0 if the process isn't found.
If $PID Then ProcessClose($PID)
_FileWriteLog($root & "\log\SAP_Export.log", "SAP Export Ende")
Exit
So mein Problem ist das die Process Balken "Exportieren Satzart 21" und "Exportieren der VA-Eingangsrechnungen" teilweise so extrem kurz laufen das ich sie nicht abfragen kann .......
Auch das "Hinweis" Fenster ist hinundwieder nicht vorhanden (wenn keine Daten exportiert wurden)
Dieses Script läuft auf 4 verschiedenen Servern mit mal mehr und auch mal weniger Daten. im großen und ganzen sehr sauber
kann mir jemand bitte ein bischen Helfen ?
Ich werd in 14Tagen auf Urlaub gehen und bin der einzige der sich soweit im AutoIt auskennt. (hab das WINBATCH ausgemustert
)
Mein Kollegen sollen auch nicht unbedingt in der Nacht beim Script sitzen und zuschauen (wos dann wenn man zuschaut eh funktioniert grrrr )
:EDIT: Wer Screenshot's brauch kann ich gerne liefern ![]()
Danke für eure Hilfe ![]()
TOMTOM
Ich werd mich auch der Frage anschliessen ??
lgaw
TOMTOM
vielen Dank für die hilfe es funzt ![]()
danke
hab das Script ein bischen abgeändert :
#comments-start
CopyRight 2007 (c) Garnreiter
Version 1.0.0.17
#comments-end
#include<Array.au3>
#include<File.au3>
#include <Constants.au3>
Dim $A_CLUSTERSTATUS
local $Input = 'Online'
$foo = Run(@ComSpec & " /c " & 'CLUSTER /CLUSTER:RRJACK1 RES ctreeServer /STAT', @SystemDir, @SW_HIDE, $STDOUT_CHILD)
While 1
$line = StdoutRead($foo)
;~ $A_CLUSTERSTATUS = _ArrayCreate($line)
_ArrayAdd($A_CLUSTERSTATUS,$line)
If @error Then ExitLoop
Wend
_ArrayDisplay($A_CLUSTERSTATUS, "_ArrayDisplay() Test")
[/autoit] [autoit][/autoit] [autoit]$Pos = _ArraySearch ($A_CLUSTERSTATUS, $Input, 0, 0, 0, True)
Select
Case $Pos = -1
MsgBox(0, "Not Found", '"' & $Input & '" was not found in the array.')
Case Else
MsgBox(0, "Found", '"' & $Input & '" was found in the array at pos ' & $Pos & ".")
EndSelect
und es funzt ned ![]()
woran liegt der Fehler??? ich find ihn nicht ![]()
ZitatOriginal von BugFix
Schick mal dein File.
Ok .... hmmmmm.... wie funzt das am besten (die Mailfunktion funzt ned... hab keine rechte)
lg
EDIT: OK HABS
ZitatOriginal von BugFix
Bei mir zeigt er es an, aktuelle AutoIt-Version vorhanden?
bin am aktuellsten stand ![]()
hast du einen cluster zum abfragen ?
oder sol ich dir das original BefehlsausgabeFile schicken ?
lg
Kann man das ergebnis direkt ohne fileübergabe in ein array einlesen ??
lg
ZitatOriginal von BugFix
Deine Auswertung funktioniert, 'online' wird gefunden. Was also ist das Problem?
Hi,
hmmm ich würde mir gerne zur kontrolle das array anschauen. und da hupft er drüber ![]()
ZitatOriginal von peethebee
Hi!
Kannst du präzisieren, was schief geht? SChreibt er korrekt in die Datei?
peethebee
also der ablauf funzt soweit ---- das file wird erstellt mit der ausgabe s.o.
aber ich kann nicht das ARRAY auslesen (_arrayDisplay)
lg
Hi Leute hab da wiedermal ein Probelm:-(
Ich muss den status einer resource eines clusters abfragen.
Die abfrage soll dann so gehen :
wenn die resource des clusters online ist dann muss diese offline gestellt werden. damit das programm starten kann
der befehl heisst :
Run(@ComSpec & " /c " & 'CLUSTER /CLUSTER:RRJACK1 RES ctreeServer /STAT >' & @ScriptDir & '\RRCL.TEMP')
[/autoit](dieser befehl sagt daß das Ergebnis in ein File geschrieben wird)
Das ergebnis schaut so aus:
[autoit]Status f?r die Ressource "ctreeServer" wird aufgelistet:
[/autoit][autoit][/autoit][autoit][/autoit][autoit][/autoit][autoit]Ressource Gruppe Knoten Status
[/autoit][autoit][/autoit][autoit]-------------------- -------------------- --------------- ------
[/autoit][autoit][/autoit][autoit]ctreeServer RRJACK1 RRJACKN2 Online
[/autoit][autoit][/autoit][autoit][/autoit]so wie kann ich das am besten umsetzen??
mein ansatz wär so:
#Region converted Directives from D:\Scripts_CRS\RRFaircom_Stoppen.au3.ini
#AutoIt3Wrapper_aut2exe=C:\Programme\AutoIt3\Aut2Exe\Aut2Exe.exe
#AutoIt3Wrapper_outfile=\\crs\e$\Scripts\Faircom_Status.exe
#AutoIt3Wrapper_Compression=4
#AutoIt3Wrapper_Res_Comment=http://www.hiddensoft.com/autoit3/compiled.html
#AutoIt3Wrapper_Res_Description=Abfrage des Cluster Status
#AutoIt3Wrapper_Res_Fileversion=4.0.0.6
#AutoIt3Wrapper_Res_Fileversion_AutoIncrement=y
#AutoIt3Wrapper_Res_LegalCopyright=2007 (c) Garnreiter
#AutoIt3Wrapper_Run_AU3Check=1
#EndRegion converted Directives from D:\Scripts_CRS\RRFaircom_Stoppen.au3.ini
;
#comments-start
CopyRight 2007 (c) Garnreiter
Version 4.0.0.6
#comments-end
#include<Array.au3>
#include<File.au3>
FileDelete(@ScriptDir & '\RRCL.TEMP')
Run(@ComSpec & " /c " & 'CLUSTER /CLUSTER:RRJACK1 RES ctreeServer /STAT >' & @ScriptDir & '\RRCL.TEMP')
[/autoit] [autoit][/autoit] [autoit]Dim $A_CLUSTERSTATUS
_FileReadToArray(@ScriptDir & '\RRCL.TEMP',$A_CLUSTERSTATUS)
$Input = "online"
If @error Then Exit
$Pos = _ArraySearch ($A_CLUSTERSTATUS, $Input, 0, 0, 0, True)
Select
Case $Pos = -1
MsgBox(0, "Not Found", '"' & $Input & '" was not found in the array.')
Case Else
MsgBox(0, "Found", '"' & $Input & '" was found in the array at pos ' & $Pos & ".")
EndSelect
_ArrayDisplay($A_CLUSTERSTATUS)
leider funzt des ned ![]()
bitte um Hilfe
lg aus Wien
TOMTOM
Danke für eure Hilfe
Bitte als gelöst markieren ![]()
am besten ich schick mal das ganze Script:
#comments-start
CopyRight 2007 (c) Garnreiter
(Schript vereinfacht und gekürzt 2007 (c) teh_hahn)
Version 7.0.0.1
#comments-end
#NoTrayIcon
#include <Date.au3>
#include <File.au3>
#include <Array.au3>
Opt("MustDeclareVars", 1)
Opt("RunErrorsFatal", 0)
Func CheckFile($s_filename, $i_mode = 2)
Local $h_file = -1
$h_file = FileOpen($s_filename, $i_mode)
If $h_file == -1 Then
MsgBox(16, "Error", "Unable to open file.")
Exit (1)
EndIf
Return ($h_file)
EndFunc ;==>CheckFile
Func FailMailExists($s_filename, $s_mandant)
Local $h_file = -1
$h_file = CheckFile($s_filename, 2)
FileWrite($h_file, "To: [email='Helpdesk@aa.bbb'][/email]" & @CRLF)
FileWrite($h_file, "Subject: " & @MDAY & "." & @MON & "." & @YEAR & " A C H T U N G !! Der Jack (Mandant: " & $s_mandant & ") hat Datenüberleitungs Probleme!" & @CRLF & @CRLF)
FileWrite($h_file, "Diese Files sind auf dem CRS nicht vorhanden :" & @CRLF & @CRLF)
Return ($h_file)
EndFunc ;==>FailMailExists
Local Const $S_CONFIGFILE = @ScriptDir & "\Export.ini"
Local Const $S_EMPTYVAL = "Keine Pfad konfiguriert"
Local Const $S_OKFILE = @ScriptDir & "\OK_MAIL.txt"
Local Const $S_FAILFILE = @ScriptDir & "\Fail_MAIL.txt"
Local Const $S_OKSMSFILE = @ScriptDir & "\OK_SMS.TXT"
Local Const $S_FAILSMSFILE = @ScriptDir & "\Fail_SMS.TXT"
;~ Local Const $s_smsrecipient = ""
Local $s_mandant = IniRead($S_CONFIGFILE, "MANDANT", "MAN", $S_EMPTYVAL)
;---ARRAY erstellen ---------------------------------------------------------------------------------;
Dim $A_FILEEXTS[7][2]
$A_FILEEXTS[0][0] = "*.A"
$A_FILEEXTS[1][0] = "*.J"
$A_FILEEXTS[2][0] = "*.K"
$A_FILEEXTS[3][0] = "*.B"
$A_FILEEXTS[4][0] = "*.S"
$A_FILEEXTS[5][0] = "*.U"
$A_FILEEXTS[6][0] = "*.V"
$A_FILEEXTS[0][1] = "A" & $s_mandant & " File (Mitarbeiter Export)"
$A_FILEEXTS[1][1] = "J" & $s_mandant & " File (Journal Export)"
$A_FILEEXTS[2][1] = "K" & $s_mandant & " File (Kunden Export)"
$A_FILEEXTS[3][1] = "B" & $s_mandant & " File (SAP Export)"
$A_FILEEXTS[4][1] = "S" & $s_mandant & " File (SAP Export)"
$A_FILEEXTS[5][1] = "U" & $s_mandant & " File (SAP Export)"
$A_FILEEXTS[6][1] = "V" & $s_mandant & " File (Buchungs Gesamt Preis Liste Export)"
Dim $A_FILEEXTM [1][2]
$A_FILEEXTM[0][0] = "*.M"
$A_FILEEXTM[0][1] = "M" & $s_mandant & " File (MIS Export)"
;---ARRAY erstellen Ende ----------------------------------------------------------------------------;
Local $s_crspath = IniRead($S_CONFIGFILE, "PFADE", "CRS", $S_EMPTYVAL)
Local $s_crsmpath = IniRead($S_CONFIGFILE, "PFADE", "CRSM", $S_EMPTYVAL)
Local $s_crswpath = IniRead($S_CONFIGFILE, "PFADE", "CRSW", $S_EMPTYVAL)
Local $s_rootpath = IniRead($S_CONFIGFILE, "PFADE", "root", $S_EMPTYVAL)
Local $s_timeend = IniRead($s_rootpath & "\log\time.stamp", "TIME", "ende", "Time_Stamp_Not_Found")
Local $s_mailsender = IniRead($S_CONFIGFILE, "MAIL", "FROM", "Jack@aa.bb")
Local $s_mailrecipient = "Thomas.G@aa.bb"
Local $s_mailrecipientNO = "Thomas.G@aa.bb"
Local $s_smsrecipient = "00000000000@SMSGATEWAY.aa.bb"
Local $s_smsrecipientNO = "000000000000@SMSGATEWAY.aa.bb"
;~ Local $s_mailrecipient= IniRead($S_CONFIGFILE, "MAIL", "TO", "Jack@aa.bb")
;~ Local $s_mailrecipientNO= IniRead($S_CONFIGFILE, "MAIL", "TON", "Jack@aa.bb")
;~ Local Const $s_smsrecipientNO = IniRead($S_CONFIGFILE, "MAIL", "TOSMS", "000000000000@SMSGATEWAY.aa.bb")
;~ Local Const $s_smsrecipient = "00000000000@SMSGATEWAY.aa.bb"
Local $s_mailserver = IniRead($S_CONFIGFILE, "MAIL", "SRV", "172.30.241.40")
Local $s_currentfile, $s_currentfilem, $s_filetime = "", $s_filetimem = ""
Local $a_filetime, $a_filetimem, $h_file = -1
;-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------;
;-----Datenverarbeitungsbereich-----------------------------------------------------------------------------------------------------------------------------------------------------------;
;-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------;
;~ For $i In $A_FILEEXTS
For $i = 1 To UBound($A_FILEEXTS[0][0]) Step 1
;~ For $i = 0 To $A_FILEEXTS Step 1
$s_currentfile = $s_crswpath & "\" & $A_FILEEXTS[$i][0] & $s_mandant
If FileExists($s_currentfile) Then
$a_filetime = FileGetTime($s_currentfile, 1, 0)
If _DateTimeFormat(_DateAdd('d', -1, $a_filetime[0] & "/" & $a_filetime[1] & "/" & $a_filetime[2]), 2) == $s_timeend Then
If Not FileExists($S_OKFILE) Then
;~ If Not FileExists($S_OKFILE) == 1 Then
$h_file = CheckFile($S_OKFILE, 2)
FileWriteLine($h_file, "To: [email='Helpdesk@verkehrsbuero.at'][/email]" & @CRLF)
FileWriteLine($h_file, "Subject: " & @MDAY & "." & @MON & "." & @YEAR & " Der Jack (Mandant: " & $s_mandant & ") hat die Daten auf den CRS übergeleitet!" & @CRLF & @CRLF)
FileWriteLine($h_file, "Die Files sind auf dem CRS vorhanden:" & @CRLF & @CRLF)
Else
$h_file = CheckFile($S_OKFILE, 1)
EndIf
FileWriteLine($h_file, "Das " & $A_FILEEXTS[$i][1] & " ist vorhanden" & @CRLF & @CRLF)
FileClose($h_file)
Else
If FileExists($S_FAILFILE) == 1 Then
$h_file = CheckFile($S_FAILFILE, 1)
Else
$h_file = FailMailExists($S_FAILFILE, $s_mandant)
EndIf
FileWriteLine($h_file, "Das " & $A_FILEEXTS[$i][1] & " ist mit falschen Datum vorhanden!" & @CRLF & @CRLF)
FileWriteLine($h_file, "Bitte die Überleitung auf der CTWS04 Überprüfen" & @CRLF & @CRLF)
FileClose($h_file)
EndIf
Else
If FileExists($S_FAILFILE) == 1 Then
$h_file = CheckFile($S_FAILFILE, 1)
Else
$h_file = FailMailExists($S_FAILFILE, $s_mandant)
EndIf
FileWriteLine($h_file, "Das " & $A_FILEEXTS[$i][1] & " ist nicht vorhanden" & @CRLF & @CRLF)
FileClose($h_file)
EndIf
_ArrayDelete($A_FILEEXTS[0], 0)
Next
;~ For $i In $A_FILEEXTM
For $i = 1 To UBound($A_FILEEXTM[0][0]) Step 1
;~ For $i = 0 To $A_FILEEXTM Step 1
$s_currentfilem = $s_crsmpath & "\" & $A_FILEEXTM[$i][0] & $s_mandant
If FileExists($s_currentfilem) Then
$a_filetimem = FileGetTime($s_currentfilem, 1, 0)
If _DateTimeFormat(_DateAdd('d', -1, $a_filetimem[0] & "/" & $a_filetimem[1] & "/" & $a_filetimem[2]), 2) == $s_timeend Then
If Not FileExists($S_OKFILE) Then
;~ If Not FileExists($S_OKFILE) == 1 Then
$h_file = CheckFile($S_OKFILE, 2)
FileWriteLine($h_file, "To: [email='Helpdesk@verkehrsbuero.at'][/email]" & @CRLF)
FileWriteLine($h_file, "Subject: " & @MDAY & "." & @MON & "." & @YEAR & " Der Jack (Mandant: " & $s_mandant & ") hat die Daten auf den CRS übergeleitet!" & @CRLF & @CRLF)
FileWriteLine($h_file, "Die Files sind auf dem CRS vorhanden:" & @CRLF & @CRLF)
Else
$h_file = CheckFile($S_OKFILE, 1)
EndIf
FileWriteLine($h_file, "Das " & $A_FILEEXTM[$i][1] & " ist vorhanden" & @CRLF & @CRLF)
FileClose($h_file)
Else
If FileExists($S_FAILFILE) == 1 Then
$h_file = CheckFile($S_FAILFILE, 1)
Else
$h_file = FailMailExists($S_FAILFILE, $s_mandant)
EndIf
FileWriteLine($h_file, "Das " & $A_FILEEXTM[$i][0] & " ist mit falschen Datum vorhanden!" & @CRLF & @CRLF)
FileWriteLine($h_file, "Bitte die Überleitung auf der CTWS04 Überprüfen" & @CRLF & @CRLF)
FileClose($h_file)
EndIf
Else
If FileExists($S_FAILFILE) == 1 Then
$h_file = CheckFile($S_FAILFILE, 1)
Else
$h_file = FailMailExists($S_FAILFILE, $s_mandant)
EndIf
FileWriteLine($h_file, "Das " & $A_FILEEXTM[$i][0] & " ist nicht vorhanden" & @CRLF & @CRLF)
FileClose($h_file)
EndIf
_ArrayDelete($A_FILEEXTM[0], 0)
Next
;-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------;
;-----MAIL & SMS Sendebereich-------------------------------------------------------------------------------------------------------------------------------------------------------------;
;-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------;
If FileExists($S_FAILFILE) == 1 Then
$h_file = CheckFile($S_FAILSMSFILE, 2)
FileWrite($h_file, " Der Jack-Mandant: " & $s_mandant & " hat Datenueberleitungsprobleme! Bitte um Kontrolle!")
FileClose($h_file)
RunWait(@ScriptDir & "\VMAILER.EXE " & $S_FAILSMSFILE & " " & $s_mailserver & " " & $s_smsrecipientNO & " " & $s_mailsender)
MsgBox(0, "Fail SMS", " Der Jack-Mandant: " & $s_mandant & " hat Datenueberleitungsprobleme! Bitte um Kontrolle!")
FileDelete($S_FAILSMSFILE)
Sleep(3000)
RunWait(@ScriptDir & "\VMAILER.EXE " & $S_FAILFILE & " " & $s_mailserver & " " & $s_mailrecipientNO & " " & $s_mailsender)
MsgBox(0, "Fail Mail", " Der Jack-Mandant: " & $s_mandant & " hat Datenueberleitungsprobleme! Bitte um Kontrolle!")
FileDelete($S_FAILFILE)
Else
$h_file = CheckFile($S_OKSMSFILE, 2)
FileWrite($h_file, " Der Jack-Mandant: " & $s_mandant & " hat alle Daten uebergeleitet")
FileClose($h_file)
RunWait(@ScriptDir & "\VMAILER.EXE " & $S_OKSMSFILE & " " & $s_mailserver & " " & $s_smsrecipient & " " & $s_mailsender)
MsgBox(0, "OK SMS", " Der Jack-Mandant: " & $s_mandant & " hat alle Daten uebergeleitet")
FileDelete($S_OKSMSFILE)
Sleep(3000)
RunWait(@ScriptDir & "\VMAILER.EXE " & $S_OKFILE & " " & $s_mailserver & " " & $s_mailrecipient & " " & $s_mailsender)
MsgBox(0, "OK Mail", " Der Jack-Mandant: " & $s_mandant & " hat alle Daten uebergeleitet")
FileDelete($S_OKFILE)
EndIf
Run(@ScriptDir & '\Speicher_Warnung.exe', @ScriptDir)
[/autoit] [autoit][/autoit] [autoit]Exit
[/autoit] ZitatAlles anzeigenOriginal von TOMTOM25m
Hi Leute,wie schaffe ich es das ich eine FOR Schleife so lange ausführe bis ein ARRAY leer ist ?
es ist bei mir so: ich mach mir ein ARRAY und befülle es:
[autoit]Dim $A_FILEEXTS
[/autoit]
$A_FILEEXTS= _ArrayCreate("*.A", "*.J", "*.K", "*.B", "*.S", "*.U", "*.V")
dann soll die FOR Schleife eine Dateiüberprüfung machen und zum Schluss wird der erste ARRAY Datensatz gelöscht.momentan fängt die FOR Schleife so an :
[autoit]For $i = 0 To 7 Step 1
[/autoit]
.........DATENVERARBEITUNG......................
_ArrayDelete($A_FILEEXTM,0)
NextDanke für eure Hilfe
So ich hab jetzt mal das ARRAY und die FOR Schleife abgeändert
ARRAY:
[autoit]Dim $A_FILEEXTS[7][2]
$A_FILEEXTS[0][0]="*.A"
$A_FILEEXTS[1][0]="*.J"
$A_FILEEXTS[2][0]="*.K"
$A_FILEEXTS[3][0]="*.B"
$A_FILEEXTS[4][0]="*.S"
$A_FILEEXTS[5][0]="*.U"
$A_FILEEXTS[6][0]="*.V"
$A_FILEEXTS[0][1]="A" & $s_mandant & " File (Mitarbeiter Export)"
$A_FILEEXTS[1][1]="J" & $s_mandant & " File (Journal Export)"
$A_FILEEXTS[2][1]="K" & $s_mandant & " File (Kunden Export)"
$A_FILEEXTS[3][1]="B" & $s_mandant & " File (SAP Export)"
$A_FILEEXTS[4][1]="S" & $s_mandant & " File (SAP Export)"
$A_FILEEXTS[5][1]="U" & $s_mandant & " File (SAP Export)"
$A_FILEEXTS[6][1]="V" & $s_mandant & " File (Buchungs Gesamt Preis Liste Export)"
Dim $A_FILEEXTM [1][2]
$A_FILEEXTM[0][0]="*.M"
$A_FILEEXTM[0][1]="M" & $s_mandant & " File (MIS Export)"
FOR Schleife :
[autoit]For $i = 1 To UBound($A_FILEEXTS[$i][0]) Step 1
[/autoit]es funzt aber trozdem nicht ![]()
Kann mir jemand helfen ..... bin leider anfänger und kämpfe gegen windmühlen .....
Hi Leute,
wie schaffe ich es das ich eine FOR Schleife so lange ausführe bis ein ARRAY leer ist ?
es ist bei mir so: ich mach mir ein ARRAY und befülle es:
[autoit]Dim $A_FILEEXTS
$A_FILEEXTS= _ArrayCreate("*.A", "*.J", "*.K", "*.B", "*.S", "*.U", "*.V")
dann soll die FOR Schleife eine Dateiüberprüfung machen und zum Schluss wird der erste ARRAY Datensatz gelöscht.
momentan fängt die FOR Schleife so an :
[autoit]For $i = 0 To 7 Step 1
.........DATENVERARBEITUNG......................
_ArrayDelete($A_FILEEXTM,0)
Next
Danke für eure Hilfe
ZitatAlles anzeigenOriginal von teh_hahn
Alter, Falter...Hab Dein Skript mal ein "wenig" verkleinert. (Wenn ich nicht total blind war, dann wird achtmal das Gleiche gemacht (nur mit anderer Dateiendung und Debugmeldung).
Hab mir das Skript nicht näher angeschaut, aber Du kannst Dir da noch vieles vieles einfacher machen. Du prüfst z.B. zum Ende hin nochmal auf Dateien, auf die Du zu Anfang geprüft hast (Wo sollen die denn hin sein? Dein Skript löscht doch nichts.)
Lass Dir mal den ausgelesenen Timestamp aus der INI und den von Dir erzeugten Timestamp in ner MSGBox ausgeben und überprüfe deine Abfragen vor Fehlermeldungen, dann wird das was.
Spoiler anzeigen
[autoit]#NoTrayIcon
[/autoit] [autoit][/autoit] [autoit]
#include <Date.au3>
#include <File.au3>Opt("MustDeclareVars", 1)
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]
Opt("RunErrorsFatal", 0)Func CheckFile($s_filename, $i_mode = 2)
[/autoit] [autoit][/autoit] [autoit]
Local $h_file = -1$h_file = FileOpen($s_filename, $i_mode)
[/autoit] [autoit][/autoit] [autoit]
If $h_file == -1 Then
MsgBox(16, "Error", "Unable to open file.")
Exit (1)
EndIfReturn ($h_file)
[/autoit] [autoit][/autoit] [autoit]
EndFunc ;==>CheckFileFunc FailMailExists($s_filename, $s_mandant)
[/autoit] [autoit][/autoit] [autoit]
Local $h_file = -1$h_file = CheckFile($s_filename, 2)
[/autoit] [autoit][/autoit] [autoit]
FileWrite($h_file, "To: [email='Helpdesk@verkehrsbuero.at'][/email]" & @CRLF)
FileWrite($h_file, "Subject: " & @MDAY & "." & @MON & "." & @YEAR & " ACHTUNG !! Der Jack (Mandant: " & $s_mandant & ") hat Datenüberleitungs Probleme!" & @CRLF & @CRLF)
FileWrite($h_file, "Diese Files sind auf dem CRS nicht vorhanden :" & @CRLF & @CRLF)Return ($h_file)
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]
EndFunc ;==>FailMailExistsLocal Const $S_CONFIGFILE = @ScriptDir & "\Export.ini"
[/autoit] [autoit][/autoit] [autoit]
Local Const $S_EMPTYVAL = "Keine Pfad konfiguriert"
Local Const $S_OKFILE = @ScriptDir & "\OK_MAIL.txt"
Local Const $S_FAILFILE = @ScriptDir & "\Fail_MAIL.txt"
Local Const $S_OKSMSFILE = @ScriptDir & "\OK_SMS.TXT"
Local Const $S_FAILSMSFILE = @ScriptDir & "\Fail_SMS.TXT"
Local Const $s_smsrecipient = "*"
Local Const $A_FILEEXT[8] = ["*.A", "*.J", "\*.K", "\*.B", "\*.S", "\*.U", "*.V", "\*.M"]Local $s_mandant = IniRead($S_CONFIGFILE, "MANDANT", "MAN", $S_EMPTYVAL)
[/autoit] [autoit][/autoit] [autoit]
Local $A_DESCRIPTION[8] = ["A" & $s_mandant & " File (Mitarbeiter Export)", "J" & $s_mandant & " File (Journal Export)", _
"K" & $s_mandant & " File (Kunden Export)", "B" & $s_mandant & " File (SAP Export)", _
"S" & $s_mandant & " File (SAP Export)", "U" & $s_mandant & " File (SAP Export)", _
"V" & $s_mandant & " File (Buchungs Gesamt Preis Liste Export)", "M" & $s_mandant & " File (MIS Export)"]Local $s_crspath = IniRead($S_CONFIGFILE, "PFADE", "CRS", $S_EMPTYVAL)
[/autoit] [autoit][/autoit] [autoit]
Local $s_crsmpath = IniRead($S_CONFIGFILE, "PFADE", "CRSM", $S_EMPTYVAL)
Local $s_crswpath = IniRead($S_CONFIGFILE, "PFADE", "CRSW", $S_EMPTYVAL)
Local $s_rootpath = IniRead($S_CONFIGFILE, "PFADE", "root", $S_EMPTYVAL)
Local $s_timeend = IniRead($s_rootpath & "\log\time.stamp", "TIME", "ende", "NotFound")
Local $s_mailsender = IniRead($S_CONFIGFILE, "MAIL", "FROM", "Jack@verkehr*.lan")
Local $s_mailserver = IniRead($S_CONFIGFILE, "MAIL", "SRV", "172.30.241.40")Local $s_currentfile, $s_filetime = ""
[/autoit] [autoit][/autoit] [autoit]
Local $a_filetime, $h_file = -1For $i = 0 To $A_FILEEXT[0] Step 1
[/autoit] [autoit][/autoit] [autoit]
$s_currentfile = $s_crswpath & "\" & $A_FILEEXT[$i] & $s_mandantIf FileExists($s_currentfile) == 1 Then
[/autoit] [autoit][/autoit] [autoit]
$a_filetime = FileGetTime($s_currentfile, 1, 0)
If _DateTimeFormat(_DateAdd('d', -1, $a_filetime[0] & "/" & $a_filetime[1] & "/" & $a_filetime[2]), 2) = $s_timeend Then
If FileExists($S_OKFILE) == 1 Then
$h_file = CheckFile($S_OKFILE, 1)
FileWriteLine($h_file, "To: [email='Helpdesk@verkehrsbuero.at'][/email]" & @CRLF)
FileWriteLine($h_file, "Subject: " & @MDAY & "." & @MON & "." & @YEAR & " Der Jack (Mandant: " & $s_mandant & ") hat die Daten auf den CRS übergeleitet!" & @CRLF & @CRLF)
FileWriteLine($h_file, "Die Files sind auf dem CRS vorhanden:" & @CRLF & @CRLF)
Else
$h_file = CheckFile($S_OKFILE, 2)
EndIf
FileWriteLine($h_file, "Das " & $A_DESCRIPTION[$i] & " ist vorhanden" & @CRLF & @CRLF)
FileClose($h_file)
Else
If FileExists($S_FAILFILE) == 1 Then
$h_file = FailMailExists($S_FAILFILE, $s_mandant)
Else
$h_file = CheckFile($S_FAILFILE, 2)
EndIf
FileWriteLine($h_file, "Das " & $A_DESCRIPTION[$i] & " ist mit falschen Datum vorhanden" & @CRLF)
FileWriteLine($h_file, "Bitte die Überleitung auf der CTWS04 Überprüfen" & @CRLF)
FileClose($h_file)
EndIf
Else
If FileExists($S_FAILFILE) == 1 Then
$h_file = CheckFile($S_FAILFILE, 1)
Else
$h_file = FailMailExists($S_FAILFILE, $s_mandant)
EndIf
FileWriteLine($h_file, "Das " & $A_DESCRIPTION[$i] & " ist nicht vorhanden" & @CRLF)
FileClose($h_file)
EndIf
NextIf FileExists($S_FAILFILE) == 1 Then
[/autoit] [autoit][/autoit] [autoit]
$h_file = CheckFile($S_FAILSMSFILE, 1)
FileWrite($h_file, " Der Jack-Mandant: " & $s_mandant & " hat Datenueberleitungsprobleme! Bitte um Kontrolle!")
FileClose($h_file)
RunWait(@ScriptDir & "\VMAILER.EXE " & $S_FAILSMSFILE & " " & $s_mailserver & " " & $s_smsrecipient & " " & $s_mailsender)
FileDelete($S_FAILSMSFILE)
Else
$h_file = CheckFile($S_OKSMSFILE, 1)
FileWrite($h_file, " Der Jack-Mandant: " & $s_mandant & " hat alle Daten uebergeleitet")
FileClose($h_file)
RunWait(@ScriptDir & "\VMAILER.EXE " & $S_OKSMSFILE & " " & $s_mailserver & " [email='06646258027@SMSGATEWAY.verkehrsbuero.lan'][/email] " & $s_mailsender)
FileDelete($S_OKSMSFILE)
EndIfIf FileExists($S_FAILSMSFILE) Then
[/autoit] [autoit][/autoit] [autoit]
RunWait(@ScriptDir & "\VMAILER.EXE " & $S_FAILFILE & " " & $s_mailserver & " " & $s_smsrecipient & " " & $s_mailsender)
Else
RunWait(@ScriptDir & "\VMAILER.EXE " & $S_OKFILE & " " & $s_mailserver & " " & $s_smsrecipient & " " & $s_mailsender)
EndIfIf FileExists($S_OKFILE) == 1 Then
[/autoit] [autoit][/autoit] [autoit]
FileDelete($S_OKFILE)
EndIfIf FileExists($S_FAILFILE) == 1 Then
[/autoit] [autoit][/autoit] [autoit]
FileDelete($S_FAILFILE)
EndIfRun(@ScriptDir & '\Speicher_Warnung.exe', @ScriptDir)
[/autoit] [autoit][/autoit] [autoit]Exit (0)
[/autoit]
Zur Frage:
ZitatHab mir das Skript nicht näher angeschaut, aber Du kannst Dir da noch vieles vieles einfacher machen. Du prüfst z.B. zum Ende hin nochmal auf Dateien, auf die Du zu Anfang geprüft hast (Wo sollen die denn hin sein? Dein Skript löscht doch nichts.)
also
es soll bei einer OK-Meldung so ablaufen:
eine SMS an mich mit der OK-Meldung
ein Mail an meine Kollegen mit der OK-Meldung
es soll bei einer Fail-Meldung so ablaufen:
eine SMS an einen SMS-Verteiler (da sind alle Helpdeskhandys drinnen) mit der kurzen Meldung das ein Fehler aufgetreten ist.
eine Mail an alle Helpdesk Mitarbeiter mit der genauen Fehlerbeschreibung.
danke für die Hilfe
TOMTOM
![]()