1. Dashboard
  2. Mitglieder
    1. Letzte Aktivitäten
    2. Benutzer online
    3. Team
    4. Mitgliedersuche
  3. Forenregeln
  4. Forum
    1. Unerledigte Themen
  • Anmelden
  • Registrieren
  • Suche
Alles
  • Alles
  • Artikel
  • Seiten
  • Forum
  • Erweiterte Suche
  1. AutoIt.de - Das deutschsprachige Forum.
  2. Mitglieder
  3. gmmg

Beiträge von gmmg

  • Mysql Insert + Update Data

    • gmmg
    • 15. Februar 2010 um 13:24

    hallo progandy,

    danke für die info!

    kann keine func _MySQL_UnInitLibrary finden, ist es eventuell folgende?

    _MySQL_EndLibrary()

    wo füge ich das folgende script ein? warum das StringTrimRight?

    [autoit]


    $s_Row_txt_t1 = StringSplit($aRecords[$x], ";")
    $s_Row_txt=''
    For $i = 1 To $s_Row_txt_t1[0]
    $s_Row_txt_t1[$i] = _MySQL_Real_Escape_String($MysqlConn, $s_Row_txt_t1[$i])
    $s_Row_txt = "'" & $s_Row_txt_t1[$i] & "' ,"
    Next
    $s_Row_txt = StringTrimRight($s_Row_txt, 1)

    [/autoit]

    versteh das gerade nicht ganz ... kannst du mir das erklären?

    hier nochmal mein for next abschnitt ...

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

    For $x = 2 to $aRecords[0]
    Msgbox(0,'Record:', $aRecords[$x])

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

    $s_Row_txt_t1 = StringSplit($aRecords[$x], ";") ; split für ON DUPLICATE KEY UPDATE werte

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

    $s_Row_txt = StringReplace($aRecords[$x], ";", "','") ; anpassen des eingelesenen strings

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

    $s_Row_txt = "'" & $s_Row_txt & "'"
    ;MsgBox(0,"",$s_Row_txt)

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

    Local $sQuery = "INSERT INTO otmailid (BU_NR,ERF_DAT,SB_MA,AG_NR,KU_NR,MAILADRESSE,TYP) VALUES (" & $s_Row_txt & ")" & _
    " ON DUPLICATE KEY UPDATE `ERF_DAT` = (" & "'" & $s_Row_txt_t1[2] & "'" & ") ," & _
    "`SB_MA` = (" & "'" & $s_Row_txt_t1[3] & "'" & ")," & _
    "`AG_NR` = (" & "'" & $s_Row_txt_t1[4] & "'" & ")," & _
    "`KU_NR` = (" & "'" & $s_Row_txt_t1[5] & "'" & ")," & _
    "`MAILADRESSE` = (" & "'" & $s_Row_txt_t1[6] & "'" & ")," & _
    "`TYP` = (" & "'" & $s_Row_txt_t1[7] & "'" & ")"
    ;MsgBox(0,"",$sQuery)

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

    _MySQL_Real_Query($MysqlConn, $sQuery)

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

    Next

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

    ; Verbindung beenden
    _MySQL_Close($MysqlConn)
    ; MYSQL beenden
    _MySQL_EndLibrary()

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


    gruß gmmg

  • Mysql Insert + Update Data

    • gmmg
    • 15. Februar 2010 um 09:37

    hallo zusammen,

    folgend nochmal das script!

    Spoiler anzeigen
    [autoit][/autoit] [autoit][/autoit] [autoit]

    #Include <File.au3>
    #include <mysql.au3>
    #include <array.au3>

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

    DIM $aRecords

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

    $file = "C:\otmailid.txt"

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

    If Not _FileReadToArray($file,$aRecords) Then
    MsgBox(4096,"Error", " Error reading log to Array error:" & @error)
    Exit
    EndIf

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

    ; db verbindungsvariablen
    $ipadd = "127.0.0.1"
    $sname = "root"
    $spasswort = ""
    $db = "otmailid"

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

    _MySQL_InitLibrary()
    If @error Then Exit MsgBox(0, "Fehler", "libmysql.dll nicht gefunden")

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

    $MysqlConn = _MySQL_Init()

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

    $connected = _MySQL_Real_Connect($MysqlConn,$ipadd,$sname,$spasswort,$db)
    If $connected = 0 Then
    $errno = _MySQL_errno($MysqlConn)
    MsgBox(0,"Fehler","Login Server ist nicht Erreichbar")
    Exit
    Endif

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

    For $x = 2 to $aRecords[0]
    Msgbox(0,'Record:', $aRecords[$x])

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

    $s_Row_txt_t1 = StringSplit($aRecords[$x], ";")
    ;$s_Row_txt_t1[1] contains the first split
    ;MsgBox(0,"",$s_Row_txt_t1[1])
    ;MsgBox(0,"",$s_Row_txt_t1[2])
    ;MsgBox(0,"",$s_Row_txt_t1[3])

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

    $s_Row_txt = StringReplace($aRecords[$x], ";", "','")

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

    $s_Row_txt = "'" & $s_Row_txt & "'"
    ;MsgBox(0,"",$s_Row_txt)

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

    ;Local $sQuery = "INSERT INTO test (A,B,C) VALUES (" & $s_Row_txt & ")" & "ON DUPLICATE KEY UPDATE (`C`) VALUES (" & $s_Row_txt_t1[3] & ")"
    Local $sQuery = "INSERT INTO otmailid (BU_NR,ERF_DAT,SB_MA,AG_NR,KU_NR,MAILADRESSE,TYP) VALUES (" & $s_Row_txt & ")" & _
    " ON DUPLICATE KEY UPDATE `ERF_DAT` = (" & "'" & $s_Row_txt_t1[2] & "'" & ") ," & _
    "`SB_MA` = (" & "'" & $s_Row_txt_t1[3] & "'" & ")," & _
    "`AG_NR` = (" & "'" & $s_Row_txt_t1[4] & "'" & ")," & _
    "`KU_NR` = (" & "'" & $s_Row_txt_t1[5] & "'" & ")," & _
    "`MAILADRESSE` = (" & "'" & $s_Row_txt_t1[6] & "'" & ")," & _
    "`TYP` = (" & "'" & $s_Row_txt_t1[7] & "'" & ")"
    ;MsgBox(0,"",$sQuery)

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

    _MySQL_Real_Query($MysqlConn, $sQuery)

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

    Local $res = _MySQL_Store_Result($MysqlConn)
    Local $row1 = 0
    ;a=VALUES(a),

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

    If $res<>0 Then
    $row1 = _MySQL_Fetch_Row_StringArray($res)
    _MySQL_Free_Result($res)
    EndIf

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

    Next

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

    MsgBox(0,"","einfügen in tabelle fertig",5)

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

    _MySQL_Close($MysqlConn)

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

    was kann man am quelltext noch verbessern?

    gruß gmmg ;)

  • Mysql Insert + Update Data

    • gmmg
    • 14. Februar 2010 um 18:30

    so, hier mein beispiel!

    Spoiler anzeigen
    [autoit][/autoit] [autoit][/autoit] [autoit]

    #Include <File.au3>
    #include <mysql.au3>
    #include <array.au3>

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

    DIM $aRecords

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

    $file = "C:\test.txt"

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

    If Not _FileReadToArray($file,$aRecords) Then
    MsgBox(4096,"Error", " Error reading log to Array error:" & @error)
    Exit
    EndIf

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

    ; db verbindungsvariablen
    $ipadd = "127.0.0.1"
    $sname = "root"
    $spasswort = ""
    $db = "otmailid"

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

    _MySQL_InitLibrary()
    If @error Then Exit MsgBox(0, "Fehler", "libmysql.dll nicht gefunden")

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

    $MysqlConn = _MySQL_Init()

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

    $connected = _MySQL_Real_Connect($MysqlConn,$ipadd,$sname,$spasswort,$db)
    If $connected = 0 Then
    $errno = _MySQL_errno($MysqlConn)
    MsgBox(0,"Fehler","Login Server ist nicht Erreichbar")
    Exit
    Endif

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

    For $x = 2 to $aRecords[0]
    ;Msgbox(0,'Record:', $aRecords[$x])

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

    $s_Row_txt_t1 = StringSplit($aRecords[$x], ";")

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

    $s_Row_txt = StringReplace($aRecords[$x], ";", "','")

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

    $s_Row_txt = "'" & $s_Row_txt & "'"
    MsgBox(0,"",$s_Row_txt)

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

    ;Local $sQuery = "INSERT INTO test (A,B,C) VALUES (" & $s_Row_txt & ")"
    Local $sQuery = "INSERT INTO test (A,B,C) VALUES (" & $s_Row_txt & ")" & _
    " ON DUPLICATE KEY UPDATE `B` = (" & "'" & $s_Row_txt_t1[2] & "'" & ") , `C` = (" & "'" & $s_Row_txt_t1[3] & "'" & ")"
    MsgBox(0,"",$sQuery)

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

    _MySQL_Real_Query($MysqlConn, $sQuery)

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

    Local $res = _MySQL_Store_Result($MysqlConn)
    Local $row1 = 0

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

    If $res<>0 Then
    $row1 = _MySQL_Fetch_Row_StringArray($res)
    _MySQL_Free_Result($res)
    EndIf

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

    Next

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

    ;MsgBox(0,"","einfügen in tabelle fertig",5)

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

    _MySQL_Close($MysqlConn)

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

    kann man da noch was verbessern?

    zur info, möchte täglich die test.txt einlesen!

    neue datensätze sollen angefügt werden, vorhandene (A = primary key) sollen mit einem update befehl geändert werden!
    wie kann ich jetzt dem ganzen eine updatebefehl hinzufügen?

    Local $sQuery = "INSERT INTO test (A,B,C) VALUES (" & $s_Row_txt & ")"

    komme hier jetzt gerade nicht weiter ... wie baue ich mir die query auf?

    meine gedanken ...
    ich lese die txt in ein array u. füge die daten der tabelle hinzu, wenn jetzt ein datensatz (spalte A = primary key) vorhanden ist, soll es ein update auf diesen datensatz ( Spalte B,C) geben

    update ....
    folgend funktioniert es :

    [autoit]


    Local $sQuery = "INSERT INTO test (A,B,C) VALUES (" & $s_Row_txt & ")" & _
    " ON DUPLICATE KEY UPDATE `B` = (" & "'" & $s_Row_txt_t1[2] & "'" & ") , `C` = (" & "'" & $s_Row_txt_t1[3] & "'" & ")"
    MsgBox(0,"",$sQuery)

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

    gibt es noch vorschläge zur verbesserung?

    gruß gmmg

    Dateien

    test.txt 93 Byte – 445 Downloads
  • Mysql Insert + Update Data

    • gmmg
    • 14. Februar 2010 um 17:06

    danke, :thumbup:

    das hilft erstmal weiter!

    lese aber auch gerade im englischen forum ...

    ich mach mal was fertig und dann poste ich es ....

    gruß gmmg

  • Mysql Insert + Update Data

    • gmmg
    • 14. Februar 2010 um 16:47

    hallo,

    danke euch beiden!

    "progandy" hat ja die funktionen genannt, die ich da einsetzen soll!
    da ich mit mysql und autoit nocht nichts gemacht habe, muss ich mich da erst einlesen!

    beispiele, wie man die funktion bedient, helfen da meist einfach weiter ...

    gruß gmmg

  • Mysql Insert + Update Data

    • gmmg
    • 14. Februar 2010 um 14:43

    hallo ,

    ich beschäftige mich gerade mit der MySQL UDF - mit libmySQL.dll!

    hier benötige ich ein paar beispiele für eine insert bzw. update in eine tabelle!

    habe mal meine vorherige anfrage als zitat eingefügt!

    kann mir da jemand mit paar beispielen helfen? :?:

    danke

    gruß gmmg


    Zitat von gmmg

    hallo zusammen,

    habe mir gerade die mysql udf angesehen, weil ich eine lösung suche daten in eine DB automatisiert zu schreiben bzw. wenn vorhanden updaten ...
    zum testen habe ich die DB cdcol von xampp benutzt!

    zugriff, daten lesen funktioniert ...

    folgende sind ja enthalten:

    "Beauty","Ryuichi Sakamoto","1990","1"
    "Goodbye Country (Hello Nightclub)","Groove Armada","2001","4"
    "Glee","Bran Van 3000","1997","5"

    folgende möchte ich aus eine txt.hinzufügen (das einlesen der datei in ein array ist kein problem)

    (namen nur als beispiel, stehen aber so formatiert in einer täglichen datei)
    ---------------------------------------
    Horsti;Horst Köhler;1977;1
    Angie;Angela Merke;1978;1
    ---------------------------------------

    wie bekomme ich es jetzt hin, die daten einzufügen bzw. wenn vorhanden ein update auf diese zu machen?
    also ein Insert bzw. Update

    Spoiler anzeigen
    [autoit]


    #cs ----------------------------------------------------------------------------

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

    AutoIt Version: 3.2.8.1 (beta)
    Author: Prog@ndy

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

    Script Function:
    MySQL-Plugin Demo Script

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

    #ce ----------------------------------------------------------------------------

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

    #include <array.au3>
    #include "mysql.au3"

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

    ; db verbindungsvariablen
    $adress = "127.0.0.1"
    $user = "root"
    $pass = ""
    $dbname = "cdcol"

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

    ; MYSQL starten, DLL im PATH (enthält auch @ScriptDir), sont Pfad zur DLL angeben. DLL muss libmysql.dll heißen.
    _MySQL_InitLibrary()
    If @error Then Exit MsgBox(0, '', "")
    ;MsgBox(0, "DLL Version:",_MySQL_Get_Client_Version() & @CRLF & _MySQL_Get_Client_Info())

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

    $MysqlConn = _MySQL_Init()

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

    ; verbinden mit XAMPP cdcol
    $connected = _MySQL_Real_Connect($MysqlConn, $adress, $user, $pass, $dbname)
    If $connected = 0 Then Exit MsgBox(16, 'Connection Error', _MySQL_Error($MysqlConn))

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

    $query = "SELECT * FROM cds"
    _MySQL_Real_Query($MysqlConn, $query)

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

    $res = _MySQL_Store_Result($MysqlConn)
    $fields = _MySQL_Num_Fields($res)
    $rows = _MySQL_Num_Rows($res)
    ;MsgBox(0, "", $rows & "-" & $fields)

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

    $row1 = _MySQL_Fetch_Row_StringArray($res)
    _ArrayDisplay($row1)
    ; Zugriff
    MsgBox(0, '', "Zugriff Methode 2 - Reihe für Reihe")
    _MySQL_Data_Seek($res, 0) ; nur zum Zurücksetzen an den Anfang der Abfrage
    Do
    $row1 = _MySQL_Fetch_Row_StringArray($res)
    If @error Then ExitLoop
    _ArrayDisplay($row1)
    Until @error

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

    ; Abfrage freigeben
    _MySQL_Free_Result($res)

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

    ; Verbindung beenden
    _MySQL_Close($MysqlConn)
    ; MYSQL beenden
    _MySQL_EndLibrary()

    [/autoit]

    danke

    gruß gmmg

    Alles anzeigen
    Zitat von progandy

    Das hat jetzt nicht direkt mit der UDF was zu tin, sondern mit SQL ;)
    Du musst die Daten einlesen, mit _MySQL_Real_Escape_String Datenbank sicher machen und dann eine Querystring zusammenbauen. Diesen führst du dann mit _MySQL_Real_Query aus.
    Am einfachsten machst du einen REPLACE-Befehl und nimmst z.B. den Benutzernamen als einzigartigen Schlüssel (UNIQUE KEY, das muss beim erstellen der Tabelle angegeben werden).
    Weiter MySQL-Grundalgen findest du hier:
    http://openbook.galileocomputing.de/dreamweaver8/24_kap24_001.htm
    http://dev.mysql.com/doc/refman/5.1/de/replace.html
    http://dev.mysql.com/doc/refman/5.1…-duplicate.html
    Edit: Wenn du dazu mehr Hilfe brauchst, ist eventuell ein neuer Thread besser geeignet.

    Alles anzeigen
  • MySQL UDF - mit libmySQL.dll (kein ODBC)

    • gmmg
    • 12. Februar 2010 um 13:43

    hi progandy,

    danke für die info! werde es mal probieren ...

    werde einen neuen Thread dazu aufmachen!

    ein paar beispiele wären da hilfreich!

    gruß gmmg

  • MySQL UDF - mit libmySQL.dll (kein ODBC)

    • gmmg
    • 12. Februar 2010 um 13:06

    hallo zusammen,

    habe mir gerade die mysql udf angesehen, weil ich eine lösung suche daten in eine DB automatisiert zu schreiben bzw. wenn vorhanden updaten ...
    zum testen habe ich die DB cdcol von xampp benutzt!

    zugriff, daten lesen funktioniert ...

    folgende sind ja enthalten:

    "Beauty","Ryuichi Sakamoto","1990","1"
    "Goodbye Country (Hello Nightclub)","Groove Armada","2001","4"
    "Glee","Bran Van 3000","1997","5"

    folgende möchte ich aus eine txt.hinzufügen (das einlesen der datei in ein array ist kein problem)

    (namen nur als beispiel, stehen aber so formatiert in einer täglichen datei)
    ---------------------------------------
    Horsti;Horst Köhler;1977;1
    Angie;Angela Merke;1978;1
    ---------------------------------------

    wie bekomme ich es jetzt hin, die daten einzufügen bzw. wenn vorhanden ein update auf diese zu machen?
    also ein Insert bzw. Update

    Spoiler anzeigen
    [autoit]


    #cs ----------------------------------------------------------------------------

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

    AutoIt Version: 3.2.8.1 (beta)
    Author: Prog@ndy

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

    Script Function:
    MySQL-Plugin Demo Script

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

    #ce ----------------------------------------------------------------------------

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

    #include <array.au3>
    #include "mysql.au3"

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

    ; db verbindungsvariablen
    $adress = "127.0.0.1"
    $user = "root"
    $pass = ""
    $dbname = "cdcol"

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

    ; MYSQL starten, DLL im PATH (enthält auch @ScriptDir), sont Pfad zur DLL angeben. DLL muss libmysql.dll heißen.
    _MySQL_InitLibrary()
    If @error Then Exit MsgBox(0, '', "")
    ;MsgBox(0, "DLL Version:",_MySQL_Get_Client_Version() & @CRLF & _MySQL_Get_Client_Info())

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

    $MysqlConn = _MySQL_Init()

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

    ; verbinden mit XAMPP cdcol
    $connected = _MySQL_Real_Connect($MysqlConn, $adress, $user, $pass, $dbname)
    If $connected = 0 Then Exit MsgBox(16, 'Connection Error', _MySQL_Error($MysqlConn))

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

    $query = "SELECT * FROM cds"
    _MySQL_Real_Query($MysqlConn, $query)

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

    $res = _MySQL_Store_Result($MysqlConn)
    $fields = _MySQL_Num_Fields($res)
    $rows = _MySQL_Num_Rows($res)
    ;MsgBox(0, "", $rows & "-" & $fields)

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

    $row1 = _MySQL_Fetch_Row_StringArray($res)
    _ArrayDisplay($row1)
    ; Zugriff
    MsgBox(0, '', "Zugriff Methode 2 - Reihe für Reihe")
    _MySQL_Data_Seek($res, 0) ; nur zum Zurücksetzen an den Anfang der Abfrage
    Do
    $row1 = _MySQL_Fetch_Row_StringArray($res)
    If @error Then ExitLoop
    _ArrayDisplay($row1)
    Until @error

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

    ; Abfrage freigeben
    _MySQL_Free_Result($res)

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

    ; Verbindung beenden
    _MySQL_Close($MysqlConn)
    ; MYSQL beenden
    _MySQL_EndLibrary()

    [/autoit]

    danke

    gruß gmmg

  • Drucker für den angemeldeten Benutzer über WMI abfragen.

    • gmmg
    • 11. Dezember 2009 um 08:38

    hallo,

    wie ojo schon geschrieben hat über die registry!
    ich hatte da irgendwo auch ein beispiel, finde es aber gerade nicht!
    gruß gmmg

  • MS Access - Zugriff auf passwortgeschützte MDB über OLEDB

    • gmmg
    • 9. Dezember 2009 um 20:18

    Hallo,
    benutze schon seit längerem über autoit den zugriff auf access mdb's!

    jetzt wurde die mdb mit Datenbankpasswort zum öffnen versenhen und ich war auf der suche nach einer lösung, um dies mit der access.au3 zu lösen, aber ohne erfolg, bis ich über google gefunden habe, wo man das passwort übergeben kann ...

    [autoit]


    $adoCon.Open ("Provider=Microsoft.Jet.OLEDB.4.0; Jet OLEDB:Database Password=12345678; Data Source=" & $_dbname)

    [/autoit]


    hier mal eine kleines beispiel, welches eine spalte einer tabelle ausliest ..

    Spoiler anzeigen
    [autoit]


    $s_dbname = @scriptdir & "\DB\test\test1_1.mdb"
    $s_db_pwd = "12345678"

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

    ; table
    $tbln_1 = "Adressenliste"
    $fldn_1 = "Vorname" ;bla
    $format = "Text(150)"

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

    $query = "SELECT * FROM " & $tbln_1
    $strData = _ReadOneFld($query, $s_dbname, $fldn_1) ; db auslesen
    MsgBox(0,"",$strData)

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

    Func _ReadOneFld($_sql, $_dbname, $_field)
    Dim $_output
    $adoCon = ObjCreate ("ADODB.Connection")
    $adoCon.Open ("Provider=Microsoft.Jet.OLEDB.4.0; Jet OLEDB:Database Password=" & $s_db_pwd & "; Data Source=" & $_dbname)
    $adoRs = ObjCreate ("ADODB.Recordset")
    $adoRs.CursorType = 1
    $adoRs.LockType = 3
    $adoRs.Open ($_sql, $adoCon)

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

    With $adoRs
    If .RecordCount Then
    While Not .EOF
    $_output = $_output & .Fields ($_field).Value & @CRLF
    .MoveNext
    WEnd
    EndIf
    EndWith
    $adoCon.Close
    Return $_output
    EndFunc ;==>_ReadOneFld

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

    vielleicht benötigt es mal jemand :)

    gruß gmmg

  • Softwareverteilung Hephaistos

    • gmmg
    • 26. November 2009 um 16:00

    hallo chip,

    klingt mal nicht schlecht!
    kannst du das script auch veröffentlichen, sodass andere auch weiterentwickeln können?

    wir benutzen selbst das paket von altiris!

    gruß gmmg

  • LDAP loginname bzw. username herausfinden

    • gmmg
    • 9. Oktober 2009 um 12:34

    also in meiner adfunction.au3 ist folgendes drin:

    ; _ADDNToSamAccountName : Returns the SamAccountName of an FQDN
    ; _ADSamAccountNameToFQDN : Returns a FQDN from a SamAccountName

    gruß gmmmg

    Dateien

    adfunctions.au3 82,09 kB – 505 Downloads
  • _IECreate funkt nich

    • gmmg
    • 9. Oktober 2009 um 12:24

    benutzt du den ie8?

    gruß gmmg

  • Ton ein/ausschalten

    • gmmg
    • 9. Oktober 2009 um 12:12

    hallo,

    es gibt eine MasterVolume.au3!

    ach so, hatte auch schonmal was mit der audio.au3 gemacht!

    hier mal ein beispiel:

    Spoiler anzeigen
    [autoit]


    ;#include <audio.au3>
    ;_SoundSetMasterVolume(0)
    ;_SoundSetMicrophoneVolume(0)
    ;_SoundSetMasterWaveVolume(0)

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

    ;===============================================================================
    ;
    ; Function Name: _isMute
    ; Description:: Check for mute sound
    ; Parameter(s): ControlID
    ; Voulme = 1000
    ; Wave = 2000
    ; SW-Synthesizer = 3000
    ; CD-Player = 4000
    ; Mikrofon = 5000
    ; Line-In = 6000
    ; Requirement(s): ---
    ; Return Value(s): 0 = not muted, 1 = muted, -1 = timeout, -2 = ControlID not found
    ; Author(s): Thorsten Meger (Xenobiologist)
    ;
    ;===============================================================================

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

    ;ProcessClose("sndvol32.exe")

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

    Global $opt = 1000
    Global $opt_1 = 6666

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

    Run("sndvol32.exe", "", @SW_HIDE) ; sndvol32.exe /t

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

    Sleep(2000)

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

    ControlCommand('mmsys.cpl', '', $opt_1,"Check", "")

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

    ControlHide ('[CLASS:Volume Control]', '', $opt )

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

    ControlGetFocus("sndvol32.exe")
    ControlCommand('[CLASS:Volume Control]', '', $opt,"IsEnabled", "")
    ControlCommand('[CLASS:Volume Control]', '', $opt,"unCheck", "")
    ;ControlCommand('[CLASS:Volume Control]', '', $opt,"unCheck", "")
    ;ControlCommand ( "title", "text", controlID, "command" [, "option"] )

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

    Sleep (5000)

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

    If _isMute() = 0 Then ControlCommand('[CLASS:Volume Control]', '', $opt,"Check", "")

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

    ;ProcessClose("sndvol32.exe")

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

    ;MsgBox(0,"",_isMute())

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

    Func _isMute($opt = 1000)
    Local $retVal = 0, $ex = False
    If Not WinExists('[CLASS:Volume Control]') Then
    Run('sndvol32', '', @SW_HIDE)
    $ex = True
    EndIf
    If WinWait('[CLASS:Volume Control]', '', 2) = 0 Then Return -1
    $retVal = ControlCommand('[CLASS:Volume Control]', '', $opt, 'isChecked')
    If @error Then Return -2
    If $ex = True Then WinClose('[CLASS:Volume Control]')
    ;$retVal = 1
    Return $retVal
    EndFunc ;==>_isMute

    [/autoit]


    hier ein weiteren beispiel um die audioeingenschaften in der systemsteuerungl zu verändern!

    Spoiler anzeigen
    [autoit]


    ; sound deaktivieren und lautsprechersymbol ausblenden

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

    Opt('WinWaitDelay')
    Run("rundll32.exe shell32.dll,Control_RunDLL mmsys.cpl,,")
    WinWait("Eigenschaften von Sounds und Audiogeräte")
    WinSetState("Eigenschaften von Sounds und Audiogeräte","",@SW_HIDE)
    Opt('WinWaitDelay')

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

    Sleep(2000)

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

    Global $opt_1 = 6666
    Global $opt_2 = 6697
    Global $opt_3 = 12321
    Global $opt_4 = 1

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

    ControlCommand("Eigenschaften von Sounds und Audiogeräte","", $opt_1, "unCheck","")
    ControlCommand("Eigenschaften von Sounds und Audiogeräte","", $opt_2, "Check","")

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

    Sleep(1000)

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

    ControlCommand("Eigenschaften von Sounds und Audiogeräte","", $opt_3, "Check", "")
    ControlCommand("Eigenschaften von Sounds und Audiogeräte","", $opt_4, "Check", "")

    [/autoit]


    gruß gmmg

  • LDAP loginname bzw. username herausfinden

    • gmmg
    • 2. Oktober 2009 um 09:14

    hallo gerhardschr,

    was willst du denn überhaupt genau machen?
    ich nehme an ihr habt einen domaincontroller (windows 2003) ?
    den USERNAME bekommst du hier auch mit @username!

    alles andere mit der adfunctions.au3!

    gruß gmmg

  • problem mit runas

    • gmmg
    • 25. August 2009 um 13:00

    If Not IsAdmin() Then
    ; Bis Version 3.2.10.0
    ;~ RunAsSet("user", @LogonDomain, "pwd")
    ;~ Run(@ScriptFullPath, @ScriptDir, @SW_HIDE)
    ;~ RunAsSet()
    ; AB Version 3.2.12.0
    RunAs("user", @LogonDomain, "pwd", 0, @ScriptFullPath, @ScriptDir, @SW_HIDE)
    Exit
    EndIf

    If IsAdmin() Then
    MsgBox(0, "", "Admin-Rechte erkannt.",1)
    EndIf

    weitere befehle

    gruß gmmg

  • IT Helpdesktool mit Mailversand

    • gmmg
    • 13. Juli 2009 um 13:00

    lösung meines problems, hab es nun selbst herausgefunden!
    in der wile schleife rufe ich durch hotkeyset die screenshot funktion auf!
    um nun nach gemachten screenshot die schleife zu beenden, muss ich in der funktion eine variable setzen, die ich dann in der schleife abfrage!

    [autoit]


    ;-----------codeauschnitt ------------------
    If $jn = 6 Then ;wenn ja gedrückt dann

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

    Dim $sc = 0
    while 1
    Sleep(1)
    HotKeySet("^{F4}", "Capture_start") ;Strg-F4
    If $sc = 1 Then ExitLoop
    WEnd

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

    Func Capture_start()
    ; Capture full screen
    _ScreenCapture_Capture(@MyDocumentsDir & "\Printscreen.jpg")
    MsgBox(0,"","Screenshot erstellt!",1)
    $sc = 1
    EndFunc

    [/autoit][autoit][/autoit][autoit][/autoit]
  • IT Helpdesktool mit Mailversand

    • gmmg
    • 10. Juli 2009 um 14:28

    hallo zusammen,

    benötige hilfe bei einem code schnipsel!
    der betroffene bereich ist im script auskommentiert!

    hier das script!

    Spoiler anzeigen
    [autoit]


    #Region ;**** Directives created by AutoIt3Wrapper_GUI ****
    #AutoIt3Wrapper_icon=..\Icons\ICONGROUP_32515.ico
    #AutoIt3Wrapper_outfile=IT-Helpdesk.exe
    #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
    #include <GUIConstants.au3>
    #include <File.au3>
    #include <Array.au3>
    #include <adfunctions.au3>
    #include <ScreenCapture.au3>
    #include <Date.au3>
    #include <WinAPI.au3>
    #include <WindowsConstants.au3>

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

    $mail = _ADGetObjectAttribute(@UserName,"mail")
    $username = @UserName

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

    ;----------------------------------
    #Region ### START Koda GUI section ###
    $Form1 = GUICreate("", 341, 390, 198, 150, 0x00040000, 0x00000080)
    ;WinSetTrans($Form1, "", 500) ;fenster transparent machen
    GUICtrlSetDefColor(0xFF0000) ;setzt textfarbe für alle elemente
    GUISetBkColor(0xFFFF00) ; setzt hintergrundfarbe
    ;GUICtrlSetColor(-1, 0xFFFFFF)
    ;DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "int", 7)
    $Group2 = GUICtrlCreateGroup("IT-Helpdesk - Call: 0700-0000000 (14 Cent/Min)", 8, 8, 324, 354)
    $Edit1 = GUICtrlCreateEdit("", 36, 122, 257, 73)
    GUICtrlSetColor(-1, 0x000000)
    GUICtrlSetData(-1, StringFormat(""))
    $Button1 = GUICtrlCreateButton("Senden", 36, 242, 121, 33)
    GUICtrlSetState(-1, $GUI_DISABLE)
    GUICtrlSetFont(-1, 9, 400, 0, "Arial")
    $Button2 = GUICtrlCreateButton("Abbruch", 172, 242, 121, 33)
    GUICtrlSetFont(-1, 9, 400, 0, "Arial")
    $Label2 = GUICtrlCreateLabel(@UserName & " / " & @ComputerName & " / " & @IPAddress1, 28, 316, 280, 17, 0x01)
    GUICtrlSetFont(-1, 9, 400, 0, "Arial")
    DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "int", 0)
    $Checkbox1 = GUICtrlCreateCheckbox("Dringend", 36, 210, 193, 17)
    GUICtrlSetColor(-1, 0xFF0000)
    DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "int", 7)
    GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
    $Label3 = GUICtrlCreateLabel("Wähle das System!", 36, 42, 112, 17)
    GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
    $Combobox1 = GUICtrlCreateCombo("", 36, 66, 129, 25)
    GUICtrlSetData(-1, "As400|Amadeus|Bistro|Blank|Buma|Drucker|Galileo|Jack|Mediatrix|Merlin|Produktdb|PC|Sonstiges|Telefon")
    GUICtrlSetFont(-1, 9, 400, 0, "Arial")
    $Label1 = GUICtrlCreateLabel("Gib eine Fehlerbeschreibung ein!", 36, 98, 191, 17)
    GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
    $Label4 = GUICtrlCreateLabel("testf", 95, 336, 150, 14)
    GUICtrlSetFont(-1, 7, 400, 0, "Arial")
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

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

    ; feiertage festlegen
    $ft1 ="01.01"
    $ft2 ="01.05"
    $ft3 ="03.10"
    $ft4 ="31.10"
    $ft5 ="25.12"
    $ft6 ="26.12"

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

    ; datum (tag, monat) festlegen
    $day = @MDAY & "."& @MON

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

    While 1
    $nMsg = GUIGetMsg()

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

    Switch $nMsg

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

    Case $GUI_EVENT_CLOSE
    Exit

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

    Case $Combobox1
    GUICtrlSetState($Button1, $GUI_ENABLE)

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

    Case $Checkbox1

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

    ;checkbox überprüfen und anhand des rückgabewertes sms freischalten oder auch nicht
    If GUICtrlRead($Checkbox1, $GUI_CHECKED)= $GUI_CHECKED Then
    $cb1 = GUICtrlRead($Checkbox1, $GUI_CHECKED)
    Else
    $cb1 = GUICtrlRead($Checkbox1, $GUI_UNCHECKED)= $GUI_UNCHECKED
    EndIf

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

    Case $Button1
    GUICtrlSetState($Button2, $GUI_DISABLE)

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

    ;######################################
    ; combobox1 auf wert prüfen
    ;######################################
    If GUICtrlRead($Combobox1, $GUI_CHECKED)= $GUI_CHECKED Then
    $cbo1 = GUICtrlRead($Combobox1, $GUI_CHECKED)
    Else
    $cbo1 = GUICtrlRead($Combobox1, $GUI_UNCHECKED)= $GUI_UNCHECKED
    EndIf

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

    IF $cbo1 = False Then
    $cboa1 = GUICtrlRead($Combobox1, $GUI_CHECKED)
    Else
    $cboa1 = " "
    EndIf
    ;-----------
    ;MsgBox(0, "gewählt", $cba1)

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

    Global $answer_combo1 = GUICtrlRead($Combobox1)
    ;MsgBox(0, "gewählt", $answer_combo1)

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

    ;######################################
    ; checkbox1 auf wert prüfen
    ;######################################
    If GUICtrlRead($Checkbox1, $GUI_CHECKED)= $GUI_CHECKED Then
    $cb1 = GUICtrlRead($Checkbox1, $GUI_CHECKED)
    Else
    $cb1 = GUICtrlRead($Checkbox1, $GUI_UNCHECKED)= $GUI_UNCHECKED
    EndIf

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

    IF $cb1 = False Then
    $cba1 = GUICtrlRead($Checkbox1, $GUI_CHECKED)
    Else
    $cba1 = " "
    EndIf
    ;MsgBox(0, "gewählt", $cba2)
    $answer = GUICtrlRead($Edit1)

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

    If IsMemberOf("Callcenter",@UserName) = 1 Or IsMemberOf("Callcenter-Flug",@UserName) = 1 Then
    Global $CAddress = "steuerung@xxxxxx.de"
    Else
    Global $CAddress = ""
    EndIf

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

    If IsMemberOf("team-buchhaltung",@UserName) = 1 Then
    Global $sCAddress = "bhaltung@xxxxx.de"
    Else
    Global $CAddress = ""
    EndIf

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

    ; Frage --> Datei -- Screenshot anhängen
    ;----------------------------------------
    Global $var = (@MyDocumentsDir & "\Printscreen.jpg")
    Global $jn = MsgBox(4, "Hinweis!", "Screenshot anhängen JA/NEIN ?" & @CRLF & @CRLF & "Button JA anklicken, Fenster mit Fehlermeldung auswählen" & @CRLF & "und Tastenkombination STRG+F4 drücken!"& @CRLF)
    If $jn = 6 Then ;wenn ja gedrückt dann

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

    ;~ while 1
    ;~ Sleep(1)
    ;~ ;HotKeySet("{PRINTSCREEN}", "Capture_start")
    ;~ ;HotKeySet("+!d", "Capture_start") ;Shift-Alt-d
    ;~ HotKeySet("^{F4}", "Capture_start") ;Strg-F4
    ;~ WEnd

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

    ;~ Func Capture_start()
    ;~ ; Capture full screen
    ;~ _ScreenCapture_Capture(@MyDocumentsDir & "\Printscreen.jpg")
    ;~ MsgBox(0,"","Screenshot erstellt!",1)
    ;~ ExitLoop
    ;~ EndFunc

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

    ;~ ; nach aktueller zeit oder wochenende
    ;~ IF _NowTime() > "18:00:00" or _NowTime() < "08:00:00" or @WDAY = 7 or @WDAY = 1 Then
    ;~ Global $CAddress = "steuerung@xxxxx.de"
    ;~ Sendmail()
    ;~ MsgBox(0,"Info", "Bitte an die Steuerung wenden!",5)
    ;~ Exit
    ;~ EndIf
    ;~ ; nach feiertagen
    ;~ IF $day = $ft1 or $day = $ft2 or $day = $ft3 or $day = $ft4 or $day = $ft5 or $day = $ft6 Then
    ;~ Global $CAddress = "steuerung@xxxxxxx.de"
    ;~ Sendmail()
    ;~ MsgBox(0,"Info", "Bitte an die Steuerung wenden!",5)
    ;~ Exit
    ;~ EndIf
    ;~ Sendmail()
    ;~ Exit
    ;###################
    Else ; nein gedrückt
    ;MsgBox(0,"","test")
    ; nach aktueller zeit oder wochenende
    IF _NowTime() > "18:00:00" or _NowTime() < "08:00:00" or @WDAY = 7 or @WDAY = 1 Then
    Global $CAddress = "steuerung@xxxxxxxm.de"
    Sendmail()
    MsgBox(0,"Info", "Bitte an die Steuerung wenden!",5)
    Exit
    EndIf
    ; nach feiertagen
    IF $day = $ft1 or $day = $ft2 or $day = $ft3 or $day = $ft4 or $day = $ft5 or $day = $ft6 Then
    Global $CAddress = "steuerung@xxxxxx.de"
    Sendmail()
    MsgBox(0,"Info", "Bitte an die Steuerung wenden!",5)
    Exit
    EndIf
    Sendmail()
    EndIf

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

    Exit
    Case $Button2
    Exit
    EndSwitch
    WEnd
    #Region------------------------------------Functions----------------------------

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

    Func Sendmail()

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

    ; message definieren
    $bodymsg = ("PC Login: " & @UserName & @CRLF & "IP Addresse: " & @IPAddress1 & @CRLF & "Computername: "& @ComputerName & @CRLF & "System: "& $answer_combo1 & @CRLF & @CRLF & "Fehlerbeschreibung: " & @CRLF & @CRLF & $answer)

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

    Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc_1")
    ;##################################
    ; Variables
    ;##################################
    $s_SmtpServer = "0.0.0.0" ; address for the smtp-server to use - REQUIRED
    $s_FromName = $username ; name from who the email was sent
    $s_FromAddress = $mail ; address from where the mail should come
    $s_ToAddress = "support@xxxxx.de" ; destination address of the email - REQUIRED
    ;$s_Subject = "";$sb ; subject from the email - can be anything you want it to be
    $s_Subject = "Supportmeldung " & $answer_combo1 & " - " & @ComputerName &" --" & $cba1
    $s_Body = $bodymsg ; the messagebody from the mail - can be left blank but then you get a blank mail
    IF $jn = 6 Then ; the file you want to attach- leave blank if not needed
    $s_AttachFiles = $var
    Else
    $s_AttachFiles = ""
    EndIf
    $s_CcAddress = $CAddress ; address for cc - leave blank if not needed
    $s_BccAddress = "" ; address for bcc - leave blank if not needed
    $s_Username = "tool" ; username for the account used from where the mail gets sent - Optional (Needed for eg GMail)
    $s_Password = "xxxxxxx" ; 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_1")
    $rc = _INetSmtpMailCom_1($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $s_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]

    EndFunc ;==>Sendmail

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

    ;###################################################

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

    Func _INetSmtpMailCom_1($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject = "", $s_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($s_Body,"<") and StringInStr($s_Body,">") Then
    $objEmail.HTMLBody = $s_Body
    Else
    $objEmail.Textbody = $s_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_1()
    $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_1
    ;---------------------------------------------------------

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

    ; IsMemberOf
    ; Takes the groupname (SamAccountName with or without the leading 'CN=', and the SamAccountName of the user
    ; Returns 1 if the the user is a member of the group, 0 otherwise

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

    Func IsMemberOf($group, $user)
    If StringLeft($group, 3) <> "CN=" Then
    $group = "CN=" & $group
    EndIf
    Dim $usergroups[1], $i = 1

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

    Dim $objConnection, $oUsr

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

    $objConnection = ObjCreate("ADODB.Connection") ; Create COM object to AD
    $objConnection.Provider = "ADsDSOObject"
    $objConnection.Open ("Active Directory Provider") ; Open connection to AD

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

    $objRootDSE = ObjGet("LDAP://RootDSE")
    Global $strDNSDomain = $objRootDSE.Get ("defaultNamingContext") ; Retrieve the current AD domain name

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

    $strQuery = "<LDAP://" & $strDNSDomain & ">;(sAMAccountName=" & $user & ");ADsPath;subtree"
    $objRecordSet = $objConnection.Execute ($strQuery) ; Retrieve the FQDN for the logged on user
    $ldap_entry = $objRecordSet.fields (0).value
    $oUsr = ObjGet($ldap_entry) ; Retrieve the COM Object for the logged on user
    $groups = $oUsr.groups ; Get the list of group objects from the user

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

    For $groupname In $groups
    If $groupname.name = $group Then Return 1

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

    Next
    Return 0

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

    EndFunc ;==>IsMemberOf

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

    #EndRegion---------------------------------Endfunctions-------------------------

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

    bekomme im folgenden code fehler!
    kann da mal einer schauen, ob man das optimaler lösen kann?

    nach dem drücken auf den senden button kommt die abfraghe ob ein screenshot gemacht werden soll, wenn ja ist das script in einer while schleife u. da gibts dann probleme!

    [autoit]


    ; Frage --> Datei -- Screenshot anhängen
    ;----------------------------------------
    Global $var = (@MyDocumentsDir & "\Printscreen.jpg")
    Global $jn = MsgBox(4, "Hinweis!", "Screenshot anhängen JA/NEIN ?" & @CRLF & @CRLF & "Button JA anklicken, Fenster mit Fehlermeldung auswählen" & @CRLF & "und Tastenkombination STRG+F4 drücken!"& @CRLF)
    If $jn = 6 Then ;wenn ja gedrückt dann

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

    while 1
    Sleep(1)
    ;HotKeySet("{PRINTSCREEN}", "Capture_start")
    ;HotKeySet("+!d", "Capture_start") ;Shift-Alt-d
    HotKeySet("^{F4}", "Capture_start") ;Strg-F4
    WEnd

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

    Func Capture_start()
    ; Capture full screen
    _ScreenCapture_Capture(@MyDocumentsDir & "\Printscreen.jpg")
    MsgBox(0,"","Screenshot erstellt!",1)
    ExitLoop
    EndFunc

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

    ; nach aktueller zeit oder wochenende
    IF _NowTime() > "18:00:00" or _NowTime() < "08:00:00" or @WDAY = 7 or @WDAY = 1 Then
    Global $CAddress = "steuerung@xxxxx.de"
    Sendmail()
    MsgBox(0,"Info", "Bitte an die Steuerung wenden!",5)
    Exit
    EndIf
    ; nach feiertagen
    IF $day = $ft1 or $day = $ft2 or $day = $ft3 or $day = $ft4 or $day = $ft5 or $day = $ft6 Then
    Global $CAddress = "steuerung@xxxxxx.de"
    Sendmail()
    MsgBox(0,"Info", "Bitte an die Steuerung wenden!",5)
    Exit
    EndIf
    Sendmail()
    Exit

    [/autoit]

    fehlermeldungen:

    Spoiler anzeigen

    C:\scripte\01_Helpdesk\IT-Helpdesk.au3(157,20) : ERROR: missing EndIf.
    Func
    ~~~~~~~~~~~~~~~~~~~^
    C:\scripte\01_Helpdesk\IT-Helpdesk.au3(148,55) : REF: missing EndIf.
    If $jn = 6 Then ;wenn ja gedrückt dann
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
    C:\scripte\01_Helpdesk\IT-Helpdesk.au3(157,20) : ERROR: missing EndSwitch.
    Func
    ~~~~~~~~~~~~~~~~~~~^
    C:\scripte\01_Helpdesk\IT-Helpdesk.au3(67,16) : REF: missing EndSwitch.
    Switch $nMsg
    ~~~~~~~~~~~~~~~^
    C:\scripte\01_Helpdesk\IT-Helpdesk.au3(157,20) : ERROR: missing Wend.
    Func
    ~~~~~~~~~~~~~~~~~~~^
    C:\scripte\01_Helpdesk\IT-Helpdesk.au3(64,1) : REF: missing Wend.
    While
    ^
    C:\scripte\01_Helpdesk\IT-Helpdesk.au3(161,32) : ERROR: 'ExitLoop' not allowed outside loop.
    ExitLoop
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
    C:\scripte\01_Helpdesk\IT-Helpdesk.au3(181,16) : ERROR: syntax error
    Else
    ~~~~~~~~~~~~~~~^
    C:\scripte\01_Helpdesk\IT-Helpdesk.au3(132,52) : ERROR: IsMemberOf(): undefined function.
    If IsMemberOf("Callcenter",@UserName)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
    C:\scripte\01_Helpdesk\IT-Helpdesk.au3(167,33) : ERROR: Sendmail(): undefined function.
    Sendmail()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
    C:\scripte\01_Helpdesk\IT-Helpdesk.au3 - 7 error(s), 0 warning(s)

    danke im voraus ;)

    gruß gmmgl

  • problem mit winxp sp3 und der adfunctions

    • gmmg
    • 7. Juli 2009 um 07:37

    Andy

    danke für den tipp,
    lag wirklich am zugriff zum active directory!
    musste den pc nochmal neu in die domäne aufnehmen, danach ging es dann ohne probleme!

    gruß gmmg

  • problem mit winxp sp3 und der adfunctions

    • gmmg
    • 6. Juli 2009 um 16:18

    hallo zusammen,

    musste meinen pc gerade neu aufsetzten!
    bekomme jetzt mit dem windows xp sp3 folgende fehlermeldung im script!
    D:\lwc\scripte\Erfassungsbogen\adfunctions.au3 (140) : ==> Variable must be of type "Object".:
    Global $strDNSDomain = $objRootDSE.Get("defaultNamingContext")
    Global $strDNSDomain = $objRootDSE^ ERROR

    script

    Spoiler anzeigen
    [autoit][/autoit] [autoit][/autoit] [autoit]

    #include <GuiStatusBar.au3>
    #include <File.au3>
    #include <GUIConstants.au3>
    #Include <Array.au3>
    #include <adfunctions.au3>
    #include <Date.au3>
    #include <GUIListBox.au3>
    #Include <GuiComboBox.au3>
    #Include <Misc.au3>
    #include <File.au3>
    #include <Process.au3>
    #include <String.au3>

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

    DIM $Input7, $Input8 , $Input9, $Input10, $Input11, $Input12, $Input13, $Input14, $Input15
    DIM $Label10, $Label11, $Label12, $Label13, $Label14, $Label15, $Label16, $Label17, $Label18
    DIM $Group3
    DIM $oMyRet

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

    $mail = _ADGetObjectAttribute(@UserName,"mail")
    $muser = @UserName

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

    $file = (@ScriptDir & "\portale.txt")
    Dim $aRecords
    Dim $sString
    If Not _FileReadToArray($file,$aRecords) Then
    MsgBox(4096,"Error", " Error reading log to Array error:" & @error)
    Exit
    EndIf

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

    For $x = 1 to $aRecords[0]
    ; Msgbox(0,'Record:' & $x, $aRecords[$x])
    ;Next

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

    $sString &= $aRecords[$x]
    Next
    ;MsgBox(0,"", $sString)

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

    $DATAC1 = "Angebot|Rückfrage|Stornierung|Umbuchung|RSB Buchung"
    $DATAC2 = $sString

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

    ;===========================================
    ; database
    ;===========================================
    $dbn = @ScriptDir & "\portale.mdb"

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

    ;===========================================
    ; table portale
    ;===========================================
    $tbln_1 = "portale"
    ;$fldname_tbl1_0 = "pr" ;bla
    ;$format = "Text(150)"
    $fldn_tbl1_1 = "projekt" ;bla
    $format = "Text(150)"
    $fldn_tbl1_2 = "teilprojekt" ;bla
    $format = "Text(200)"
    $fldn_tbl1_3 = "mail" ;bla
    $format = "Text(150)"

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

    ;===========================================
    ; table mails
    ;===========================================

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

    $tbln_2 = "mails"

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

    $fldn_tbl2_1 = "teilprojekt" ;bla
    $format = "Text(150)"
    $fldn_tbl2_2 = "mail" ;bla
    $format = "Text(150)"

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

    $query = "SELECT * FROM "& $tbln_1
    $strData = _ReadOneFld($query, $dbn, $fldn_tbl1_1) ; db auslesen
    ;MsgBox(0,"",$strData)
    $E1 = StringStripWS($strData,3)

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

    #Region ### START Koda GUI section ### Form=C:\Erfassungsbogen\Form1.kxf
    $erfbo = GUICreate("Erfassungsbogen 3.0.0.2", 740, 530, 219, 137)
    GUISetBkColor(0x00708090) ; setzt hintergrundfarbe
    ;$Label1 = GUICtrlCreateLabel("Portal", 16, 16, 39, 20)
    ;GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
    $Label3 = GUICtrlCreateLabel("Anrufgrund", 16, 44, 120, 20)
    GUICtrlSetFont(-1, 10, 600, 0, "MS Sans Serif")
    GUICtrlSetColor(-1, 0xFFFFFF)
    $Label2 = GUICtrlCreateLabel("Vorname, Name", 16, 68, 120, 20)
    GUICtrlSetFont(-1, 10, 600, 0, "MS Sans Serif")
    GUICtrlSetColor(-1, 0xFFFFFF)
    $Label4 = GUICtrlCreateLabel("Telefon", 16, 92, 120, 20)
    GUICtrlSetFont(-1, 10, 600, 0, "MS Sans Serif")
    GUICtrlSetColor(-1, 0xFFFFFF)
    $Label5 = GUICtrlCreateLabel("E-Mail", 16, 114, 120, 20)
    GUICtrlSetFont(-1, 10, 600, 0, "MS Sans Serif")
    GUICtrlSetColor(-1, 0xFFFFFF)
    $Label6 = GUICtrlCreateLabel("Veranstalter", 16, 136, 120, 20)
    GUICtrlSetFont(-1, 10, 600, 0, "MS Sans Serif")
    GUICtrlSetColor(-1, 0xFFFFFF)
    $Label7 = GUICtrlCreateLabel("Vorgang", 16, 160, 120, 20)
    GUICtrlSetFont(-1, 10, 600, 0, "MS Sans Serif")
    GUICtrlSetColor(-1, 0xFFFFFF)
    $Label8 = GUICtrlCreateLabel("Fakten", 16, 184, 120, 20)
    GUICtrlSetFont(-1, 10, 600, 0, "MS Sans Serif")
    GUICtrlSetColor(-1, 0xFFFFFF)
    ;$Input1 = GUICtrlCreateInput("", 136, 16, 249, 21)
    $Combo1 = GUICtrlCreateCombo(" ... Bitte auswählen", 145, 40, 240, 25 )
    GUICtrlSetData(-1, $DATAC1, " ... Bitte auswählen")
    $Input2 = GUICtrlCreateInput("", 145, 64, 240, 21)
    $Input3 = GUICtrlCreateInput("", 145, 88, 240, 21)
    $Input4 = GUICtrlCreateInput("", 145, 112, 240, 21)
    $Input5 = GUICtrlCreateInput("", 145, 136, 240, 21)
    $Input6 = GUICtrlCreateInput("", 145, 160, 240, 21)
    $Edit2 = GUICtrlCreateEdit("", 145, 184, 240, 81)
    GUICtrlSetData(-1, "")
    $Group2 = GUICtrlCreateGroup("ITYX", 16, 272, 497, 249)
    GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
    GUICtrlSetColor(-1, 0xFFFFFF)

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

    ;DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "int", 0)
    ; Local $group = GUICtrlCreateGroup("Group 1", 190, 60, 90, 140)
    ; GUICtrlSetColor(-1,0x0000FF)
    ;DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "int", 1)

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

    $List1 = GUICtrlCreateList("", 32, 296, 249, 214)
    GUICtrlSetData(-1, $DATAC2)
    $List2 = GUICtrlCreateList("", 296, 296, 201, 214)
    GUICtrlSetData(-1, "")
    $Button1 = GUICtrlCreateButton("Löschen", 584, 392, 97, 25, 0)
    GUICtrlSetBkColor(-1,0xff4D00)
    $Button2 = GUICtrlCreateButton("Senden", 584, 432, 97, 25, 0)
    GUICtrlSetBkColor(-1,0x66CC00)
    $Label9 = GUICtrlCreateLabel("mail gesendet!", 600, 480, 104, 17)
    GUICtrlSetColor(-1, 0xFFFFFF)
    GUICtrlSetState(-1, $GUI_HIDE)
    DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "int", 0)
    $Checkbox1 = GUICtrlCreateCheckbox("Dringend", 600, 360, 90, 17)
    GUICtrlSetColor(-1, 0xFFFFFF)
    DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "int", 7)
    GUISetState(@SW_SHOW)

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

    #EndRegion ### END Koda GUI section ###

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

    Sleep(2000)

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

    ;------------ updater 11.06.2009 versionsvergleich ----------------
    $path1 = "\\server\netlogon\ErfassungsbogenUpdate\"
    $path2 = "C:\OT-Tools\Erfassungsbogen\"

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

    $file = "CallCenterErfassungsbogen.exe"
    $file1 = "portale.mdb"
    $file2 = "portale.txt"

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

    $sVersion1 = $path1 & $file
    $sVersion2 = $path2 & $file

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

    $quelle = $path1 & $file
    $quelle1 = $path1 & $file1
    $quelle2 = $path1 & $file2

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

    $ziel = $path2

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

    $ver1 = FileGetVersion($sVersion1) ;server
    $ver2 = FileGetVersion($sVersion2) ;local

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

    ;MsgBox(0, "Explorer version", $ver1 & " / " & $ver2)

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

    IF $ver1 > $ver2 Then

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

    BlockInput(1)
    MsgBox(0,"","Update vorhanden!",1)
    Run(@ScriptDir & "\updater.exe") ; run updater.exe Run($sVersion2, "", @SW_MAXIMIZE)
    BlockInput(0)
    Exit
    Else
    MsgBox(0,"","kein Update vorhanden!",1)
    EndIf

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

    ;------------ ende updater 11.06.2009 versionsvergleich ----------------

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

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $List1

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

    ;~ If GUICtrlRead($List1) = "abocard" Then
    ;~ GUICtrlSetData($List2, "")
    ;~ GUICtrlSetData($List2, "A1|A3|A3")
    ;~ EndIf
    ;If GUICtrlRead($List1) = "abocard" Then GUICtrlSetData($List2, $DATAC2)

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

    $wert1 = GUICtrlRead($List1)
    $query1 = "SELECT * FROM "& $tbln_1 & " WHERE projekt = " & "'" & $wert1 & "'"
    $strData1 = _ReadOneFld($query1, $dbn, $fldn_tbl1_2) ; db auslesen

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

    ;MsgBox(64,"", StringStripWS($strData1,3)) ;leerzeichen abschneiden
    ;MsgBox(0,"",$strData1)

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

    GUICtrlSetData($List2, "")
    GUICtrlSetData($List2, StringStripWS($strData1,3))

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

    Case $Button2

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

    $wert2 = GUICtrlRead($List2)
    $query2 = "SELECT * FROM "& $tbln_2 & " WHERE teilprojekt = " & "'" & $wert2 & "'"
    $strData2 = _ReadOneFld($query2, $dbn, $fldn_tbl2_2) ; db auslesen

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

    $portal = GUICtrlRead($List1)
    $teilp = GUICtrlRead($List2)
    $name = GUICtrlRead($Input2)
    $tel = GUICtrlRead($Input3)
    $tmail = GUICtrlRead($Input4)
    $ver = GUICtrlRead($Input5)
    $vor = GUICtrlRead($Input6)
    $fakt = GUICtrlRead($Edit2)
    $gda = GUICtrlRead($Combo1)
    ;--------------------------
    $i1 = GUICtrlRead($Input7)
    $i2 = GUICtrlRead($Input8)
    $i3 = GUICtrlRead($Input9)
    $i4 = GUICtrlRead($Input10)
    $i5 = GUICtrlRead($Input11)
    $i6 = GUICtrlRead($Input12)
    $i7 = GUICtrlRead($Input13)
    $i8 = GUICtrlRead($Input14)
    $i9 = GUICtrlRead($Input15)
    ;--------------------------
    $cb1 = GUICtrlRead($Checkbox1)
    ;MsgBox(0,"",$cb1 & "checked")
    If $cb1 = 1 Then $cbtext = "Dringend"
    If $cb1 = 4 Then $cbtext = ""

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

    $date = _Now()
    $sp = "-----------------------------------------"
    $sp1 = "#########################################"
    ;--------------------subjekt-------------------
    $sb = "Erfassungsbogen " & $portal & " / " & $teilp & " / " & $cbtext
    ;----------------------------------------------

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

    ;-------------------mail body------------------
    $mbody1 = $sp1 & @CRLF & $date & @CRLF & $sp1 & @CRLF & "Portal: " & $portal & @CRLF & $sp & @CRLF & "Vorname, Name: " & $name & @CRLF & $sp & @CRLF & "Telefon: " & $tel & @CRLF & $sp & @CRLF & "Mail: " & $tmail & @CRLF & $sp & @CRLF & "Veranstalter: " & $ver & @CRLF & $sp & @CRLF & "Vorgang: " & $vor & @CRLF & $sp & @CRLF & "Fakten: " & @CRLF & @CRLF & $fakt & @CRLF & @CRLF
    ;----------------------------------------------
    $mbody_angebot = $gda & @CRLF & $sp1 & @CRLF & "Erwachsene: " & $i1 & @CRLF & $sp & @CRLF & "Kinder: " & $i2 & @CRLF & $sp & @CRLF & "Reiseziel: " & $i3 & @CRLF & $sp & @CRLF & "1. Flughafen: " & $i4 & @CRLF & $sp & @CRLF & "2. Flughafen: " & $i5 & @CRLF & $sp & @CRLF & "Verpflegung: " & $i6 & @CRLF & $sp & @CRLF & "Zimmer: " & $i7
    ;----------------------------------------------
    $mbody_umbuchung = $gda & @CRLF & $sp1 & @CRLF & "Hotel: " & $i1 & @CRLF & $sp & @CRLF & "Zimmer: " & $i2 & @CRLF & $sp & @CRLF & "Verpflegung: " & $i3 & @CRLF & $sp & @CRLF & "Termin: " & $i4 & @CRLF & $sp & @CRLF & "Flughafen: " & $i5 & @CRLF & $sp & @CRLF & "Dauer: " & $i6 & @CRLF & $sp & @CRLF & "Personen: " & $i7 & @CRLF & $sp & @CRLF & "Reiseziel: " & $i8 & @CRLF & $sp & @CRLF & "Zimmer: " & $i9
    ;----------------------------------------------
    $mbody_rsbbuchung = $gda & @CRLF & $sp1 & @CRLF & "Agenturnummer: " & $i1 & @CRLF & $sp & @CRLF & "Telefonnummer: " & $i2
    ;----------------------------------------------

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

    ;MsgBox(0,"",$mbody)

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

    If $gda = " ... Bitte auswählen" Then
    MsgBox(0,"Info","Bitte Grund des Anrufes auswählen!")
    Else
    If $portal = "" Then ; MsgBox(0,"",$portal)
    MsgBox(0,"Info","Bitte Projekt auswählen!")
    Else
    If $teilp = "" Then ; MsgBox(0,"",$portal)
    MsgBox(0,"Info","Bitte Teilprojekt auswählen!")
    Else

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

    BlockInput (1)

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

    Sendmail()
    GUICtrlSetState($Button2, $GUI_DISABLE) ;senden button deaktivieren
    _GUICtrlListBox_ResetContent($List1)
    GUICtrlSetData($List1, $DATAC2)
    _GUICtrlListBox_ResetContent($List2)
    BlockInput (0)
    Sleep (3000)
    GUICtrlSetState($Label9, $GUI_SHOW)
    ;MsgBox(64,"","Mail gesendet",3)
    ;Sleep (8000) ;8 sekunden
    ;GUICtrlSetState($Label9, $GUI_HIDE) ;mail gesendet label
    ;GUICtrlSetState($Button2, $GUI_ENABLE) ;senden button aktivieren

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

    EndIf
    EndIf

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

    EndIf

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

    Case $Button1 ;löschen

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

    _Del()
    GUICtrlSetState($Button2, $GUI_ENABLE)
    GUICtrlSetState($Label9, $GUI_HIDE)
    GUICtrlSetData($Input2, "")
    GUICtrlSetData($Input3, "")
    GUICtrlSetData($Input4, "")
    GUICtrlSetData($Input5, "")
    GUICtrlSetData($Input6, "")
    GUICtrlSetData($Edit2, "")

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

    GUICtrlDelete($Combo1)
    $Combo1 = GUICtrlCreateCombo(" ... Bitte auswählen", 145, 40, 240, 25 )
    GUICtrlSetData(-1, $DATAC1, " ... Bitte auswählen")

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

    _GUICtrlListBox_ResetContent($List1)
    GUICtrlSetData($List1, $DATAC2)
    _GUICtrlListBox_ResetContent($List2)

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

    ControlCommand("","Dringend",$Checkbox1, "UnCheck", "") ;checkbox unchecked

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

    Case $Combo1

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

    $gda = GUICtrlRead($Combo1)

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

    ;MsgBox(0,"",$gda)
    IF $gda = " ... Bitte auswählen" Then _Del()
    IF $gda = "Angebot" Then _AngebotShow()
    IF $gda = "Rückfrage" Then _Del()
    IF $gda = "Stornierung" Then _Del()
    IF $gda = "Umbuchung" Then _UmbuchungShow()
    IF $gda = "RSB Buchung" Then _RSBBuchungShow()

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

    EndSwitch
    WEnd

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

    Func Sendmail()

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

    Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc_1")
    ;##################################
    ; Variables
    ;##################################
    $s_SmtpServer = "0.0.0.0" ; address for the smtp-server to use - REQUIRED
    $s_FromName = $muser ; name from who the email was sent
    $s_FromAddress = $mail ; address from where the mail should come
    $s_ToAddress = $strData2 ; destination address of the email - REQUIRED
    $s_Subject = $sb ; subject from the email - can be anything you want it to be
    ;$as_Body = $mbody1 ; the messagebody from the mail - can be left blank but then you get a blank mail
    IF $gda = "Stornierung" Then $as_Body = $mbody1
    IF $gda = "Rückfrage" Then $as_Body = $mbody1
    If $gda = "Angebot" Then $as_Body = $mbody1 & @CRLF & $sp1 & @CRLF & $mbody_angebot
    If $gda = "Umbuchung" Then $as_Body = $mbody1 & @CRLF & $sp1 & @CRLF & $mbody_umbuchung
    If $gda = "RSB Buchung" Then $as_Body = $mbody1 & @CRLF & $sp1 & @CRLF & $mbody_rsbbuchung
    $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 = "" ; address for bcc - leave blank if not needed
    $s_Username = "tool" ; username for the account used from where the mail gets sent - Optional (Needed for eg GMail)
    $s_Password = "xxxxxxx" ; 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_1")
    $rc = _INetSmtpMailCom_1($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]

    EndFunc ;==>Sendmail

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

    ;###################################################

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

    Func _INetSmtpMailCom_1($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_1()
    $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_1

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

    ;###################################################

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

    Func _ReadOneFld($_sql, $_dbname, $_field)
    Dim $_output
    $adoCon = ObjCreate ("ADODB.Connection")
    $adoCon.Open ("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & $_dbname)
    $adoRs = ObjCreate ("ADODB.Recordset")
    $adoRs.CursorType = 1
    $adoRs.LockType = 3
    $adoRs.Open ($_sql, $adoCon)

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

    With $adoRs
    If .RecordCount Then
    While Not .EOF
    $_output = $_output & .Fields ($_field).Value & @CRLF
    .MoveNext
    WEnd
    EndIf
    EndWith
    $adoCon.Close
    Return $_output
    EndFunc ;==>_ReadOneFld

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

    Func _AngebotShow()

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

    GUICtrlDelete($Group3)
    GUICtrlDelete($Input7)
    GUICtrlDelete($Input8)
    GUICtrlDelete($Input9)
    GUICtrlDelete($Input10)
    GUICtrlDelete($Input11)
    GUICtrlDelete($Input12)
    GUICtrlDelete($Input13)
    GUICtrlDelete($Input14)
    GUICtrlDelete($Input15)
    ;----------------------
    GUICtrlDelete($Label10)
    GUICtrlDelete($Label11)
    GUICtrlDelete($Label12)
    GUICtrlDelete($Label13)
    GUICtrlDelete($Label14)
    GUICtrlDelete($Label15)
    GUICtrlDelete($Label16)
    GUICtrlDelete($Label17)
    GUICtrlDelete($Label18)
    ;----------------------
    $Group3 = GUICtrlCreateGroup("Angebot", 400, 16, 321, 249)
    GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
    GUICtrlSetColor(-1, 0xFFFFFF)
    $Label10 = GUICtrlCreateLabel("Erwachsene", 416, 48, 90, 17)
    GUICtrlSetColor(-1, 0xFFFFFF)
    $Label11 = GUICtrlCreateLabel("Kinder", 416, 72, 90, 17)
    GUICtrlSetColor(-1, 0xFFFFFF)
    $Label12 = GUICtrlCreateLabel("Reiseziel", 416, 96, 90, 17)
    GUICtrlSetColor(-1, 0xFFFFFF)
    $Label13 = GUICtrlCreateLabel("1. Flughafen", 416, 120, 90, 17)
    GUICtrlSetColor(-1, 0xFFFFFF)
    $Label14 = GUICtrlCreateLabel("2. Flughafen", 416, 144, 90, 17)
    GUICtrlSetColor(-1, 0xFFFFFF)
    $Label15 = GUICtrlCreateLabel("Verpflegung", 416, 168, 90, 17)
    GUICtrlSetColor(-1, 0xFFFFFF)
    $Label16 = GUICtrlCreateLabel("Zimmer", 416, 192, 90, 17)
    GUICtrlSetColor(-1, 0xFFFFFF)
    $Input7 = GUICtrlCreateInput("", 510, 48, 195, 21)
    $Input8 = GUICtrlCreateInput("", 510, 72, 195, 21)
    $Input9 = GUICtrlCreateInput("", 510, 96, 195, 21)
    $Input10 = GUICtrlCreateInput("", 510, 120, 195, 21)
    $Input11 = GUICtrlCreateInput("", 510, 144, 195, 21)
    $Input12 = GUICtrlCreateInput("", 510, 168, 195, 21)
    $Input13 = GUICtrlCreateInput("", 510, 192, 195, 21)
    ;GUICtrlSetTip($Input13, "test")

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

    EndFunc

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

    Func _UmbuchungShow()

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

    GUICtrlDelete($Group3)
    GUICtrlDelete($Input7)
    GUICtrlDelete($Input8)
    GUICtrlDelete($Input9)
    GUICtrlDelete($Input10)
    GUICtrlDelete($Input11)
    GUICtrlDelete($Input12)
    GUICtrlDelete($Input13)
    GUICtrlDelete($Input14)
    GUICtrlDelete($Input15)
    ;----------------------
    GUICtrlDelete($Label10)
    GUICtrlDelete($Label11)
    GUICtrlDelete($Label12)
    GUICtrlDelete($Label13)
    GUICtrlDelete($Label14)
    GUICtrlDelete($Label15)
    GUICtrlDelete($Label16)
    GUICtrlDelete($Label17)
    GUICtrlDelete($Label18)
    ;----------------------
    $Group3 = GUICtrlCreateGroup("Umbuchung", 400, 16, 321, 258)
    GUICtrlSetColor(-1, 0xFFFFFF)
    GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
    $Label10 = GUICtrlCreateLabel("Hotel", 416, 48, 90, 17)
    GUICtrlSetColor(-1, 0xFFFFFF)
    $Label11 = GUICtrlCreateLabel("Zimmer", 416, 72, 90, 17)
    GUICtrlSetColor(-1, 0xFFFFFF)
    $Label12 = GUICtrlCreateLabel("Verpflegung", 416, 96, 90, 17)
    GUICtrlSetColor(-1, 0xFFFFFF)
    $Label13 = GUICtrlCreateLabel("Termin", 416, 120, 90, 17)
    GUICtrlSetColor(-1, 0xFFFFFF)
    $Label14 = GUICtrlCreateLabel("Flughafen", 416, 144, 90, 17)
    GUICtrlSetColor(-1, 0xFFFFFF)
    $Label15 = GUICtrlCreateLabel("Dauer", 416, 168, 90, 17)
    GUICtrlSetColor(-1, 0xFFFFFF)
    $Label16 = GUICtrlCreateLabel("Personen", 416, 192, 90, 17)
    GUICtrlSetColor(-1, 0xFFFFFF)
    $Label17 = GUICtrlCreateLabel("Reiseziel", 416, 216, 90, 17)
    GUICtrlSetColor(-1, 0xFFFFFF)
    $Label18 = GUICtrlCreateLabel("Zimmer", 416, 240, 90, 17)
    GUICtrlSetColor(-1, 0xFFFFFF)
    ;----------------------
    $Input7 = GUICtrlCreateInput("", 510, 48, 195, 21)
    $Input8 = GUICtrlCreateInput("", 510, 72, 195, 21)
    $Input9 = GUICtrlCreateInput("", 510, 96, 195, 21)
    $Input10 = GUICtrlCreateInput("", 510, 120, 195, 21)
    $Input11 = GUICtrlCreateInput("", 510, 144, 195, 21)
    $Input12 = GUICtrlCreateInput("", 510, 168, 195, 21)
    $Input13 = GUICtrlCreateInput("", 510, 192, 195, 21)
    $Input14 = GUICtrlCreateInput("", 510, 216, 195, 21)
    $Input15 = GUICtrlCreateInput("", 510, 240, 195, 21)

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

    EndFunc

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

    Func _RSBBuchungShow()

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

    GUICtrlDelete($Group3)
    GUICtrlDelete($Input7)
    GUICtrlDelete($Input8)
    GUICtrlDelete($Input9)
    GUICtrlDelete($Input10)
    GUICtrlDelete($Input11)
    GUICtrlDelete($Input12)
    GUICtrlDelete($Input13)
    GUICtrlDelete($Input14)
    GUICtrlDelete($Input15)
    ;----------------------
    GUICtrlDelete($Label10)
    GUICtrlDelete($Label11)
    GUICtrlDelete($Label12)
    GUICtrlDelete($Label13)
    GUICtrlDelete($Label14)
    GUICtrlDelete($Label15)
    GUICtrlDelete($Label16)
    GUICtrlDelete($Label17)
    GUICtrlDelete($Label18)
    ;----------------------
    $Group3 = GUICtrlCreateGroup("RSB Buchung", 400, 16, 321, 249)
    GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
    GUICtrlSetColor(-1, 0xFFFFFF)
    $Label10 = GUICtrlCreateLabel("Agentur", 416, 48, 90, 17)
    GUICtrlSetColor(-1, 0xFFFFFF)
    $Label11 = GUICtrlCreateLabel("Telefon", 416, 72, 90, 17)
    GUICtrlSetColor(-1, 0xFFFFFF)
    ;----------------------
    $Input7 = GUICtrlCreateInput("", 510, 48, 195, 21)
    GUICtrlSetTip(-1, "Agenturnummer")
    $Input8 = GUICtrlCreateInput("", 510, 72, 195, 21)
    GUICtrlSetTip(-1, "Telefonnummer")

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

    EndFunc

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

    Func _Del()

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

    GUICtrlDelete($Group3)
    GUICtrlDelete($Input7)
    GUICtrlDelete($Input8)
    GUICtrlDelete($Input9)
    GUICtrlDelete($Input10)
    GUICtrlDelete($Input11)
    GUICtrlDelete($Input12)
    GUICtrlDelete($Input13)
    GUICtrlDelete($Input14)
    GUICtrlDelete($Input15)
    ;----------------------
    GUICtrlDelete($Label10)
    GUICtrlDelete($Label11)
    GUICtrlDelete($Label12)
    GUICtrlDelete($Label13)
    GUICtrlDelete($Label14)
    GUICtrlDelete($Label15)
    GUICtrlDelete($Label16)
    GUICtrlDelete($Label17)
    GUICtrlDelete($Label18)

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

    EndFunc

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

    hab das auch mit der neuesten adfunctions ohne erfolg geteset!
    hat einer eine idee wie amn das auch mit sp3 gefixt bekommt?

    danke

    gruß gmmg

Spenden

Jeder Euro hilft uns, Euch zu helfen.

Download

AutoIt Tutorial
AutoIt Buch
Onlinehilfe
AutoIt Entwickler
  1. Datenschutzerklärung
  2. Impressum
  3. Shoutbox-Archiv
Community-Software: WoltLab Suite™