Screenshot per mail versenden

  • hallo, ich möchte einen screenshot per mail versenden, dabei soll das erzeugen des screenshots in einer schleife laufen, genau so wie das versenden! also die exe dann immer gestartet sein soll!
    über strg+f4 wird screenshot erzeugt, über strg+f5 soll mail mit erzeugten screenshot's verschickt werden!

    Spoiler anzeigen
    [autoit]


    #include <File.au3>
    #include <ScreenCapture.au3>
    While 1
    Sleep(1)
    ;HotKeySet("{PRINTSCREEN}", "Capture_start")
    ;HotKeySet("+!d", "Capture_start") ;Shift-Alt-d
    HotKeySet("^{F4}", "Capture_start") ;Strg-F4
    HotKeySet("^{F5}","_INetSmtpMailCom")

    [/autoit] [autoit][/autoit] [autoit]

    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    Func Capture_start()

    [/autoit] [autoit][/autoit] [autoit]

    ; Capture full screen
    If FileExists(@MyDocumentsDir & "\screenshot") Then
    ;MsgBox(4096, "C:\autoexec.bat File", "Exists")
    Else
    ;MsgBox(4096,"C:\autoexec.bat File", "Does NOT exists")
    DirCreate(@MyDocumentsDir & "\screenshot")
    EndIf
    ;FileDelete(@MyDocumentsDir & "\Printscreen*.*"
    _ScreenCapture_Capture(@MyDocumentsDir & "\screenshot\screenshot_"& @SEC & @MIN & @HOUR & ".jpg")

    [/autoit] [autoit][/autoit] [autoit]

    MsgBox(0,"","Screenshot erstellt!",1)

    [/autoit] [autoit][/autoit] [autoit]

    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc")
    ;##################################
    ; Include
    ;##################################
    ;#Include<file.au3>
    ;##################################
    ; Variables
    ;##################################
    $s_SmtpServer = "ipadresse" ; address for the smtp-server to use - REQUIRED
    $s_FromName = @UserName ;@UserName ; name from who the email was sent
    $s_FromAddress = @UserName & "@domain.de" ; address from where the mail should come
    $s_ToAddress = "empfänger@domain.de" ; destination address of the email - REQUIRED
    $s_Subject = "Supportmeldung "; subject from the email - can be anything you want it to be
    $as_Body = ("IP Addresse: ") ; the messagebody from the mail - can be left blank but then you get a blank mail
    $s_AttachFiles = "" ; the file you want to attach- leave blank if not needed
    $s_CcAddress = "" ; address for cc - leave blank if not needed
    $s_BccAddress = " "
    $s_Username = "xxxxxx" ; username for the account used from where the mail gets sent - Optional (Needed for eg GMail)
    $s_Password = "xxxxxxxxxxxxx" ; password for the account used from where the mail gets sent - Optional (Needed for eg GMail)
    $IPPort = 25 ; port used for sending the mail
    $ssl = 0 ; enables/disables secure socket layer sending - put to 1 if using httpS
    ;~ $IPPort=465 ; GMAIL port used for sending the mail
    ;~ $ssl=1 ; GMAILenables/disables secure socket layer sending - put to 1 if using httpS

    [/autoit] [autoit][/autoit] [autoit]

    ;##################################
    ; Script
    ;##################################
    Global $oMyRet[2]
    Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc")
    $rc = _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body, $s_AttachFiles, $s_CcAddress, $s_BccAddress, $s_Username, $s_Password, $IPPort, $ssl)
    If @error Then
    MsgBox(0, "Error sending message", "Error code:" & @error & " Description:" & $rc)
    EndIf
    ;

    [/autoit] [autoit][/autoit] [autoit]

    Func _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject = "", $as_Body = "", $s_AttachFiles = "", $s_CcAddress = "", $s_BccAddress = "", $s_Username = "", $s_Password = "",$IPPort=25, $ssl=0)
    $objEmail = ObjCreate("CDO.Message")
    $objEmail.From = '"' & $s_FromName & '" <' & $s_FromAddress & '>'
    $objEmail.To = $s_ToAddress
    Local $i_Error = 0
    Local $i_Error_desciption = ""
    If $s_CcAddress <> "" Then $objEmail.Cc = $s_CcAddress
    If $s_BccAddress <> "" Then $objEmail.Bcc = $s_BccAddress
    $objEmail.Subject = $s_Subject
    If StringInStr($as_Body,"<") and StringInStr($as_Body,">") Then
    $objEmail.HTMLBody = $as_Body
    Else
    $objEmail.Textbody = $as_Body & @CRLF
    EndIf
    If $s_AttachFiles <> "" Then
    Local $S_Files2Attach = StringSplit($s_AttachFiles, ";")
    For $x = 1 To $S_Files2Attach[0]
    $S_Files2Attach[$x] = _PathFull ($S_Files2Attach[$x])
    If FileExists($S_Files2Attach[$x]) Then
    $objEmail.AddAttachment ($S_Files2Attach[$x])
    Else
    $i_Error_desciption = $i_Error_desciption & @lf & 'File not found to attach: ' & $S_Files2Attach[$x]
    SetError(1)
    return 0
    EndIf
    Next
    EndIf
    $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
    $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = $s_SmtpServer
    $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = $IPPort
    ;Authenticated SMTP
    If $s_Username <> "" Then
    $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
    $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") = $s_Username
    $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = $s_Password
    EndIf
    If $Ssl Then
    $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
    EndIf
    ;Update settings
    $objEmail.Configuration.Fields.Update
    ; Sent the Message
    $objEmail.Send
    if @error then
    SetError(2)
    return $oMyRet[1]
    EndIf
    EndFunc ;==>_INetSmtpMailCom
    ;
    ;
    ; Com Error Handler
    Func MyErrFunc()
    $HexNumber = Hex($oMyError.number, 8)
    $oMyRet[0] = $HexNumber
    $oMyRet[1] = StringStripWS($oMyError.description,3)
    ConsoleWrite("### COM Error ! Number: " & $HexNumber & " ScriptLine: " & $oMyError.scriptline & " Description:" & $oMyRet[1] & @LF)
    SetError(1); something to check for when this function returns
    Return
    EndFunc ;==>MyErrFunc

    [/autoit]

    wie und wo muss ich die mailfuntion einsetzen?

    gruß gmmg

    Edit GtaSpider: [12.12.2007 14:04]
    AutoIt Tags eingefügt
    Aufruf:

    Code
    [SPOILER][AUTOIT]
    AutoIt Code
    [/AUTOIT][/SPOILER]

    3 Mal editiert, zuletzt von gmmg (29. Dezember 2007 um 00:39)

    • Offizieller Beitrag

    Hallo

    Du willst das sich ein neues Bild automatisch in einer While schleife erzeugt und abgesendet wird,
    oder willst du das man immer auf STRG+F4 drücken kann, und dann erst das bild gemacht wird?

    Falls das 1. der Fall ist
    [autoit]

    #include <File.au3>
    #include <ScreenCapture.au3>
    ;HotKeySet("{PRINTSCREEN}", "Capture_start")
    ;HotKeySet("+!d", "Capture_start") ;Shift-Alt-d
    HotKeySet("^{F4}", "Capture_start") ;Strg-F4
    HotKeySet("^{F5}", "_INetSmtpMailCom")

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    Sleep(5000);Alle 5000ms (=5 Sekunden) wird funktion ausgeführt
    Capture_start()
    _INetSmtpMailCom()
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    Func Capture_start()

    [/autoit] [autoit][/autoit] [autoit]

    ; Capture full screen
    If FileExists(@MyDocumentsDir & "\screenshot") Then
    ;MsgBox(4096, "C:\autoexec.bat File", "Exists")
    Else
    ;MsgBox(4096,"C:\autoexec.bat File", "Does NOT exists")
    DirCreate(@MyDocumentsDir & "\screenshot")
    EndIf
    ;FileDelete(@MyDocumentsDir & "\Printscreen*.*"
    _ScreenCapture_Capture(@MyDocumentsDir & "\screenshot\screenshot_" & @SEC & @MIN & @HOUR & ".jpg")

    [/autoit] [autoit][/autoit] [autoit]

    MsgBox(0, "", "Screenshot erstellt!", 1)

    [/autoit] [autoit][/autoit] [autoit]

    EndFunc ;==>Capture_start

    [/autoit] [autoit][/autoit] [autoit]

    Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc")
    ;##################################
    ; Include
    ;##################################
    ;#Include<file.au3>
    ;##################################
    ; Variables
    ;##################################
    $s_SmtpServer = "ipadresse" ; address for the smtp-server to use - REQUIRED
    $s_FromName = @UserName ;@UserName ; name from who the email was sent
    $s_FromAddress = @UserName & "@domain.de" ; address from where the mail should come
    $s_ToAddress = "empfänger@domain.de" ; destination address of the email - REQUIRED
    $s_Subject = "Supportmeldung "; subject from the email - can be anything you want it to be
    $as_Body = ("IP Addresse: ") ; the messagebody from the mail - can be left blank but then you get a blank mail
    $s_AttachFiles = "" ; the file you want to attach- leave blank if not needed
    $s_CcAddress = "" ; address for cc - leave blank if not needed
    $s_BccAddress = " "
    $s_Username = "xxxxxx" ; username for the account used from where the mail gets sent - Optional (Needed for eg GMail)
    $s_Password = "xxxxxxxxxxxxx" ; password for the account used from where the mail gets sent - Optional (Needed for eg GMail)
    $IPPort = 25 ; port used for sending the mail
    $ssl = 0 ; enables/disables secure socket layer sending - put to 1 if using httpS
    ;~ $IPPort=465 ; GMAIL port used for sending the mail
    ;~ $ssl=1 ; GMAILenables/disables secure socket layer sending - put to 1 if using httpS

    [/autoit] [autoit][/autoit] [autoit]

    ;##################################
    ; Script
    ;##################################
    Global $oMyRet[2]
    Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc")
    $rc = _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body, $s_AttachFiles, $s_CcAddress, $s_BccAddress, $s_Username, $s_Password, $IPPort, $ssl)
    If @error Then
    MsgBox(0, "Error sending message", "Error code:" & @error & " Description:" & $rc)
    EndIf
    ;

    [/autoit] [autoit][/autoit] [autoit]

    Func _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject = "", $as_Body = "", $s_AttachFiles = "", $s_CcAddress = "", $s_BccAddress = "", $s_Username = "", $s_Password = "", $IPPort = 25, $ssl = 0)
    $objEmail = ObjCreate("CDO.Message")
    $objEmail.From = '"' & $s_FromName & '" <' & $s_FromAddress & '>'
    $objEmail.To = $s_ToAddress
    Local $i_Error = 0
    Local $i_Error_desciption = ""
    If $s_CcAddress <> "" Then $objEmail.Cc = $s_CcAddress
    If $s_BccAddress <> "" Then $objEmail.Bcc = $s_BccAddress
    $objEmail.Subject = $s_Subject
    If StringInStr($as_Body, "<") And StringInStr($as_Body, ">") Then
    $objEmail.HTMLBody = $as_Body
    Else
    $objEmail.Textbody = $as_Body & @CRLF
    EndIf
    If $s_AttachFiles <> "" Then
    Local $S_Files2Attach = StringSplit($s_AttachFiles, ";")
    For $x = 1 To $S_Files2Attach[0]
    $S_Files2Attach[$x] = _PathFull($S_Files2Attach[$x])
    If FileExists($S_Files2Attach[$x]) Then
    $objEmail.AddAttachment($S_Files2Attach[$x])
    Else
    $i_Error_desciption = $i_Error_desciption & @LF & 'File not found to attach: ' & $S_Files2Attach[$x]
    SetError(1)
    Return 0
    EndIf
    Next
    EndIf
    $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
    $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = $s_SmtpServer
    $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = $IPPort
    ;Authenticated SMTP
    If $s_Username <> "" Then
    $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
    $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = $s_Username
    $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = $s_Password
    EndIf
    If $ssl Then
    $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
    EndIf
    ;Update settings
    $objEmail.Configuration.Fields.Update
    ; Sent the Message
    $objEmail.Send
    If @error Then
    SetError(2)
    Return $oMyRet[1]
    EndIf
    EndFunc ;==>_INetSmtpMailCom
    ;
    ;
    ; Com Error Handler
    Func MyErrFunc()
    $HexNumber = Hex($oMyError.number, 8)
    $oMyRet[0] = $HexNumber
    $oMyRet[1] = StringStripWS($oMyError.description, 3)
    ConsoleWrite("### COM Error ! Number: " & $HexNumber & " ScriptLine: " & $oMyError.scriptline & " Description:" & $oMyRet[1] & @LF)
    SetError(1); something to check for when this function returns
    Return
    EndFunc ;==>MyErrFunc

    [/autoit]
    Falls das 2. der Fall ist
    [autoit]

    #include <File.au3>
    #include <ScreenCapture.au3>
    ;HotKeySet("{PRINTSCREEN}", "Capture_start")
    ;HotKeySet("+!d", "Capture_start") ;Shift-Alt-d
    HotKeySet("^{F4}", "Capture_start") ;Strg-F4
    HotKeySet("^{F5}", "_INetSmtpMailCom")

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    Sleep(100)
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    Func Capture_start()

    [/autoit] [autoit][/autoit] [autoit]

    ; Capture full screen
    If FileExists(@MyDocumentsDir & "\screenshot") Then
    ;MsgBox(4096, "C:\autoexec.bat File", "Exists")
    Else
    ;MsgBox(4096,"C:\autoexec.bat File", "Does NOT exists")
    DirCreate(@MyDocumentsDir & "\screenshot")
    EndIf
    ;FileDelete(@MyDocumentsDir & "\Printscreen*.*"
    _ScreenCapture_Capture(@MyDocumentsDir & "\screenshot\screenshot_" & @SEC & @MIN & @HOUR & ".jpg")

    [/autoit] [autoit][/autoit] [autoit]

    MsgBox(0, "", "Screenshot erstellt!", 1)

    [/autoit] [autoit][/autoit] [autoit]

    EndFunc ;==>Capture_start

    [/autoit] [autoit][/autoit] [autoit]

    Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc")
    ;##################################
    ; Include
    ;##################################
    ;#Include<file.au3>
    ;##################################
    ; Variables
    ;##################################
    $s_SmtpServer = "ipadresse" ; address for the smtp-server to use - REQUIRED
    $s_FromName = @UserName ;@UserName ; name from who the email was sent
    $s_FromAddress = @UserName & "@domain.de" ; address from where the mail should come
    $s_ToAddress = "empfänger@domain.de" ; destination address of the email - REQUIRED
    $s_Subject = "Supportmeldung "; subject from the email - can be anything you want it to be
    $as_Body = ("IP Addresse: ") ; the messagebody from the mail - can be left blank but then you get a blank mail
    $s_AttachFiles = "" ; the file you want to attach- leave blank if not needed
    $s_CcAddress = "" ; address for cc - leave blank if not needed
    $s_BccAddress = " "
    $s_Username = "xxxxxx" ; username for the account used from where the mail gets sent - Optional (Needed for eg GMail)
    $s_Password = "xxxxxxxxxxxxx" ; password for the account used from where the mail gets sent - Optional (Needed for eg GMail)
    $IPPort = 25 ; port used for sending the mail
    $ssl = 0 ; enables/disables secure socket layer sending - put to 1 if using httpS
    ;~ $IPPort=465 ; GMAIL port used for sending the mail
    ;~ $ssl=1 ; GMAILenables/disables secure socket layer sending - put to 1 if using httpS

    [/autoit] [autoit][/autoit] [autoit]

    ;##################################
    ; Script
    ;##################################
    Global $oMyRet[2]
    Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc")
    $rc = _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body, $s_AttachFiles, $s_CcAddress, $s_BccAddress, $s_Username, $s_Password, $IPPort, $ssl)
    If @error Then
    MsgBox(0, "Error sending message", "Error code:" & @error & " Description:" & $rc)
    EndIf
    ;

    [/autoit] [autoit][/autoit] [autoit]

    Func _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject = "", $as_Body = "", $s_AttachFiles = "", $s_CcAddress = "", $s_BccAddress = "", $s_Username = "", $s_Password = "", $IPPort = 25, $ssl = 0)
    $objEmail = ObjCreate("CDO.Message")
    $objEmail.From = '"' & $s_FromName & '" <' & $s_FromAddress & '>'
    $objEmail.To = $s_ToAddress
    Local $i_Error = 0
    Local $i_Error_desciption = ""
    If $s_CcAddress <> "" Then $objEmail.Cc = $s_CcAddress
    If $s_BccAddress <> "" Then $objEmail.Bcc = $s_BccAddress
    $objEmail.Subject = $s_Subject
    If StringInStr($as_Body, "<") And StringInStr($as_Body, ">") Then
    $objEmail.HTMLBody = $as_Body
    Else
    $objEmail.Textbody = $as_Body & @CRLF
    EndIf
    If $s_AttachFiles <> "" Then
    Local $S_Files2Attach = StringSplit($s_AttachFiles, ";")
    For $x = 1 To $S_Files2Attach[0]
    $S_Files2Attach[$x] = _PathFull($S_Files2Attach[$x])
    If FileExists($S_Files2Attach[$x]) Then
    $objEmail.AddAttachment($S_Files2Attach[$x])
    Else
    $i_Error_desciption = $i_Error_desciption & @LF & 'File not found to attach: ' & $S_Files2Attach[$x]
    SetError(1)
    Return 0
    EndIf
    Next
    EndIf
    $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
    $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = $s_SmtpServer
    $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = $IPPort
    ;Authenticated SMTP
    If $s_Username <> "" Then
    $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
    $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = $s_Username
    $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = $s_Password
    EndIf
    If $ssl Then
    $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
    EndIf
    ;Update settings
    $objEmail.Configuration.Fields.Update
    ; Sent the Message
    $objEmail.Send
    If @error Then
    SetError(2)
    Return $oMyRet[1]
    EndIf
    EndFunc ;==>_INetSmtpMailCom
    ;
    ;
    ; Com Error Handler
    Func MyErrFunc()
    $HexNumber = Hex($oMyError.number, 8)
    $oMyRet[0] = $HexNumber
    $oMyRet[1] = StringStripWS($oMyError.description, 3)
    ConsoleWrite("### COM Error ! Number: " & $HexNumber & " ScriptLine: " & $oMyError.scriptline & " Description:" & $oMyRet[1] & @LF)
    SetError(1); something to check for when this function returns
    Return
    EndFunc ;==>MyErrFunc

    [/autoit]

    Mfg Spider

  • hi spider,

    das tool soll im hintergrund laufen!
    jedesmal wenn ich z.b. strg+ f4 drücke soll das bild abgespeichert werden ( dies können 3-6 bilder sein)
    wenn ich dann strg+ f5 drücke sollen die ganzen gespeicherten bilder als mailanhang versendet werden!

    bekomme in der zweiten variante eine fehlermeldung:

    >"C:\Programme\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Dokumente und Einstellungen\%username%\Desktop\scripte\Test\screenshot_mail.au3"
    C:\Dokumente und Einstellungen\%username%\Desktop\scripte\Test\screenshot_mail.au3 (65) : ==> Variable used without being declared.:
    $objEmail.From = '"' & $s_FromName & '" <' & $s_FromAddress & '>'
    $objEmail.From = '"' & ^ ERROR
    >Exit code: 1 Time: 2.568

    gruß gmmg

    Einmal editiert, zuletzt von gmmg (12. Dezember 2007 um 14:19)

  • ein weiteres problem, habe die dateien in einem Array, wie bekomme ich die einzelnen jetzt in eine variable oder die einzelnen in verschiedene variablen?

    Spoiler anzeigen
    [autoit]


    #include
    #Include

    [/autoit] [autoit][/autoit] [autoit]

    $FileList=_FileListToArray(@MyDocumentsDir & "\screenshot\")
    ;MsgBox(0,"",$FileList[1])

    [/autoit] [autoit][/autoit] [autoit]

    ;_ArrayDisplay($FileList,"$FileList")

    [/autoit] [autoit][/autoit] [autoit]

    For $i = 1 To $FileList[0]
    If @error = 1 then ExitLoop

    [/autoit] [autoit][/autoit] [autoit]

    $ab = $FileList[$i]

    [/autoit] [autoit][/autoit] [autoit]

    MsgBox(0,"",$ab)

    [/autoit] [autoit][/autoit] [autoit]

    Next

    [/autoit] [autoit][/autoit] [autoit]

    ;------

    [/autoit] [autoit][/autoit] [autoit]

    $s_AttachFiles = $a1&";"&$a2

    [/autoit] [autoit][/autoit] [autoit]

    ;------

    [/autoit] [autoit][/autoit] [autoit][/autoit]

    gruß gmmg


    </Array.au3></File.au3>

    Einmal editiert, zuletzt von gmmg (13. Dezember 2007 um 14:25)

  • [autoit]

    $FileList=_FileListToArray(@MyDocumentsDir & "\screenshot\")
    ;MsgBox(0,"",$FileList[1])

    [/autoit][autoit][/autoit][autoit]

    ;_ArrayDisplay($FileList,"$FileList")

    [/autoit][autoit][/autoit][autoit]

    For $i = 1 To $FileList[0]
    If @error = 1 then ExitLoop

    [/autoit][autoit][/autoit][autoit]

    If $FileList[$i] <> "" Then
    $s_AttacheFile = $FileList[$i]
    ;Weiter Anweisungen
    ;Wobei $sAttachFile jedesmal überschrieben wird und es und man mit dem Array besser weiterarbieten könnte
    EndIf

    [/autoit][autoit][/autoit][autoit]

    Next

    [/autoit]
  • hi,

    suche noch nach einer möglichkeit die dateien aus einem verzeichnis (datei a, datei b, datei c) bei der mailfunktion als
    $s_AttachFiles = (datei a;datei b;datei c) anzuhängen! dabei wird ja immer der pfad zur datei angegeben!
    dateien werden mit der screenshotfunktion erzeugt und haben immer unterschiedliche namen!
    meine idee war ja, die _FileListToArray funktion siehe bsp.: zu benutzen
    $FileList=_FileListToArray(@MyDocumentsDir & "\screenshot\")
    hier bekomme ich nun auch alle files des ordners in das array geschrieben!

    wie kann ich hier diese dateien weiterverarbeiten? ?( ich benötige entweder einen string welcher sich aus den dateien im array + pfadangaben zusammensetzt,

    (datei1;datei2;datei3)

    oder die einzelnen dateien in einer variable:
    $a1 = datei1
    $a2 = datei2
    $a3 = datei3

    vielleicht gibt es auch eine ganz andere möglichkeit!
    hat einer da erfahrungen bzw eine lösung?
    dank im vorraus

    gruß gmmg ;) :?:

  • @mega

    zippen geht nicht, da die jpg dateien, die erzeugt werden dann gleich von anderen verarbeitet werden,
    da ist das zu aufwendig, wenn die erst wieder enpackt werden müssen!

    benötige da eine andere lösung

    würde mich trozdem interessieren, wie die lösung mit zip aussehen würde?

    dank

    gruß gmmg

    Einmal editiert, zuletzt von gmmg (13. Dezember 2007 um 17:08)

  • [autoit][/autoit][autoit][/autoit][autoit]

    $FileList=_FileListToArray(@MyDocumentsDir & "\screenshot\")

    [/autoit][autoit][/autoit][autoit]

    _ArrayDisplay($FileList,"$FileList")

    [/autoit][autoit][/autoit][autoit]

    If $FileList = 0 Then
    MsgBox(0,"","kein screenshot vorhanden!")
    $s_AttachFiles = ""
    Else
    $size = $Filelist
    $s_AttachFiles =""
    $sConnector = ""
    if $size > 4 then $size = 4
    MsgBox(0,"",$size)
    for $i = 0 to $size

    $s_AttachFiles= $s_AttachFiles & $sConnector & (@MyDocumentsDir & "\screenshot\" & $FileList[$i +1])
    $sConnector =";"
    ;MsgBox(0,"",$a1&";"&$a2)
    ;$s_AttachFiles = ($a1&";"&$a2)

    [/autoit][autoit][/autoit][autoit]

    Next
    MsgBox(0,"",$s_AttachFiles)
    EndIf

    [/autoit]

    problem, habe testweise mal 4 files generiert, er geht auch durch die schleife und erzeugt den pfad, aber immer mit der gleichen datei!

    gruß gmmg

    2 Mal editiert, zuletzt von gmmg (14. Dezember 2007 um 11:27)

  • [autoit]


    $FileList=_FileListToArray(@MyDocumentsDir & "\screenshot\")

    [/autoit][autoit][/autoit][autoit]

    _ArrayDisplay($FileList,"$FileList")

    [/autoit][autoit][/autoit][autoit]

    If $FileList = 0 Then
    MsgBox(0,"","kein screenshot vorhanden!")
    $s_AttachFiles = ""
    Else
    $size = $Filelist
    $s_AttachFiles =""
    $sConnector = ""
    if $size > 5 then $size = 5
    for $i = 1 to $size

    $s_AttachFiles= $s_AttachFiles & $sConnector & (@MyDocumentsDir & "\screenshot\" & $FileList[$i])
    $sConnector =";"
    $i+=1
    ;MsgBox(0,"",$a1&";"&$a2)
    ;$s_AttachFiles = ($a1&";"&$a2)

    [/autoit][autoit][/autoit][autoit]

    Next
    MsgBox(0,"",$s_AttachFiles)
    EndIf

    [/autoit][autoit][/autoit][autoit][/autoit]
    • Offizieller Beitrag

    Hi,

    ich dachte an sowas:

    [autoit]

    #Include
    #Include

    [/autoit][autoit][/autoit][autoit]

    $re = _getFilePathes(@ScriptDir, '*.au3')
    _ArrayDisplay($re)

    [/autoit][autoit][/autoit][autoit]

    Func _getFilePathes($sPath, $sFilter = '(*.*)', $iFlag = 0)
    Local $FileList = _FileListToArray($sPath, $sFilter, $iFlag)
    If @error Then Return (@error * (-1))
    Local $re_A[UBound($FileList)]
    For $i=1 TO UBound($FileList) -1
    $re_A[$i] = $sPath & '\' & $FileList[$i]
    Next
    $re_A[0] = $FileList[0]
    Return $re_A
    EndFunc ;==>_getFilePathes

    [/autoit]

    So long,

    Mega
    </Array.au3></File.au3>

  • Danke , funktioniert soweit!

    Spoiler anzeigen
    [autoit]


    $re = _getFilePathes(@MyDocumentsDir & "\screenshot", '*.jpg')
    _ArrayDisplay($re)

    [/autoit] [autoit][/autoit] [autoit]

    Func _getFilePathes($sPath, $sFilter = '(*.*)', $iFlag = 0)
    Local $FileList = _FileListToArray($sPath, $sFilter, $iFlag)
    If @error Then Return (@error * (-1))
    Local $re_A[UBound($FileList)]
    For $i=1 TO UBound($FileList) -1
    $re_A[$i] = $sPath & '\' & $FileList[$i]
    Next
    $re_A[0] = $FileList[0]
    ;MsgBox(0,"",$re_A[0]) ; anzahl der Inhalte im array
    Return $re_A
    EndFunc ;==>_getFilePathes

    [/autoit] [autoit][/autoit] [autoit][/autoit]


    wie bekomme ich die "$s_AttachFiles" gefüllt?

    gruß gmmg ;)

    Einmal editiert, zuletzt von gmmg (14. Dezember 2007 um 14:39)

  • habe das jetzt so gemacht:

    Spoiler anzeigen
    [autoit]


    Global $s_AttachFiles

    [/autoit] [autoit][/autoit] [autoit]

    Func _getFilePathes($sPath, $sFilter = '(*.*)', $iFlag = 0)
    Local $FileList = _FileListToArray($sPath, $sFilter, $iFlag)
    If @error Then Return (@error * (-1))
    Local $re_A[UBound($FileList)]
    For $i=1 TO UBound($FileList) -1
    $re_A[$i] = $sPath & '\' & $FileList[$i]
    Next
    $re_A[0] = $FileList[0]
    ;MsgBox(0,"",$re_A[0]) ; anzahl der Inhalte im array

    If $re_A[0] = 1 Then
    ;MsgBox(0,"","1 file")
    $s_AttachFiles = $re_A[1]
    ;MsgBox(0,"",$s_AttachFiles)
    EndIf
    If $re_A[0] = 2 Then
    ;MsgBox(0,"","2 files")
    $s_AttachFiles = $re_A[2] &";"& $re_A[1]
    ;MsgBox(0,"",$s_AttachFiles)
    EndIf
    If $re_A[0] = 3 Then
    ;MsgBox(0,"","3 files")
    $s_AttachFiles = $re_A[3] &";"& $re_A[2] &";"& $re_A[1]
    ;MsgBox(0,"",$s_AttachFiles)
    EndIf
    If $re_A[0] = 4 Then
    ;MsgBox(0,"","4 files")
    $s_AttachFiles = $re_A[4] &";"& $re_A[3] &";"& $re_A[2] &";"& $re_A[1]
    ;MsgBox(0,"",$s_AttachFiles)
    EndIf
    If $re_A[0] = 5 Then
    ;MsgBox(0,"","5 files")
    $s_AttachFiles = $re_A[5] &";"& $re_A[4] &";"& $re_A[3] &";"& $re_A[2] &";"& $re_A[1]
    ;MsgBox(0,"",$s_AttachFiles)
    EndIf

    Return $re_A
    EndFunc ;==>_getFilePathes

    [/autoit]

    die function wird dann über einen case button1 aufgerufen und an die "$s_AttachFiles" übergeben
    ;--dateien in array lesen
    $re = _getFilePathes(@MyDocumentsDir & "\screenshot", '*.jpg')
    ;_ArrayDisplay($re)

    wer noch eine andere idde hat, dem bin ich dankbar :)
    gruß gmmg

    • Offizieller Beitrag

    Hi,

    warum nicht einfach so:

    [autoit]

    #Include #Include
    $re = MsgBox(0,"",_getFilePathes(@ScriptDir, '*.ini'))
    ;_ArrayDisplay($re)
    Func _getFilePathes($sPath, $sFilter = '(*.*)', $iFlag = 0) Local $FileList = _FileListToArray($sPath, $sFilter, $iFlag) If @error Then Return (@error * (-1)) Local $re_A[UBound($FileList)] For $i = 1 To UBound($FileList) - 1 $re_A[$i] = $sPath & '\' & $FileList[$i] Next $re_A[0] = $FileList[0] Return _ArrayToString($re_A, ';', 1) EndFunc ;==>_getFilePathes

    [/autoit]

    oder

    [autoit]


    MsgBox(0,"",_getFilePathes(@ScriptDir, '*.ini'))

    [/autoit][autoit][/autoit][autoit]

    Func _getFilePathes($sPath, $sFilter = '(*.*)', $iFlag = 0)
    Local $FileList = _FileListToArray($sPath, $sFilter, $iFlag)
    If @error Then Return (@error * (-1))
    Local $re_A = ''
    For $i = 1 To UBound($FileList) - 1
    $re_A &= $sPath & '\' & $FileList[$i] & ';'
    Next
    Return $re_A
    EndFunc ;==>_getFilePathes

    [/autoit]

    So long,

    Mega

  • Func _getFilePathes($sPath, $sFilter = '(*.*)', $iFlag = 0) Local $FileList = _FileListToArray($sPath, $sFilter, $iFlag) If @error Then Return (@error * (-1)) Local $re_A = '' For $i = 1 To UBound($FileList) - 1 $re_A &= $sPath & '\' & $FileList[$i] & ';' Next Return $re_A EndFunc ;==>_getFilePathes


    Hi mega,

    bekomme eine fehlermeldung aber die daten werden trozdem verschickt!
    fehlermeldung kommt nur, wenn mehr als eine datei angehangen wird! kann also sein, das die stringerzeugung nicht ganz stimmt!
    habe mal ein bild angehangen
    an welcher stelle muss ich den die variable "$s_AttachFiles" mit der "$re_A" füllen?

    meine version (post Freitag, 14. Dezember 2007, 14:42) funktioniert ja soweit!

    gruß gmmg

    • Offizieller Beitrag

    HI,

    versuch mal deinem Code so zu posten, dass ich ihn in Gesamtheit testen kann. (Passwörter und Email ****) Wie soll denn dein an die Emailfunktion zu übergebender String aussehen?

    Ich dachte so: (Beispiel bei 4 Dateien)

    Voller Pfad;Voller Pfad;Voller Pfad;Voller Pfad;

    So long,

    Mega