Brauche hilfe bei der anpassung eines programms ( daten lesen und in Excel schreiben )

  • Hallo alle zusammen.

    Ich hoffe dass mir hier jemand schnell weiter helfen kann

    Ich hatte von jemanden ein Programm bekommen womit ich Daten

    Bei mir auslesen kann und diese in eine Excel liste speichern konnte.


    Damals benötigte ich nur eine information von der jeweiligen Seite.

    Jetzt muss ich 2 auslesen die dann geschrieben werden sollen in Spalte B und C

    Jede spalte für eine information

    Spoiler anzeigen
    [autoit]

    HotKeySet("{ESC}", "_Exit")
    BlockInput (1)
    #include <Excel.au3>
    $sPath = @ScriptDir & "\Test1.xls"
    $oExcel = _ExcelBookOpen($sPath, 0)
    $iRow = 1

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

    While True
    $value = _ExcelReadCell($oExcel, "A" & $iRow)
    If $value = "" Then ExitLoop
    $return = _Data($value)
    _ExcelWriteCell($oExcel, $return, "B" & $iRow)
    $iRow += 1
    WEnd
    _ExcelBookClose($oExcel)
    Func _Data($value)
    ClipPut($value)
    WinActivate ( "QWS3270")
    WinWaitActive("QWS3270")
    Sleep (300)
    MouseClick("LEFT", 394, 397, 1, 0)
    Send ("^v")
    Send ("{ENTER}")
    Send ("9")
    Send ("{ENTER}")
    Sleep (300)
    MouseClick("LEFT", 360 , 394, 1, 0)
    Send("{LSHIFT down}")
    Send("{right 4}")
    Send("{LSHIFT up}")
    Send ("^c")

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

    Return ClipGet()
    EndFunc
    BlockInput (0)
    MsgBox (0, "Fertig", "Alle Daten in der XLS gespeichert", 2)
    ProcessClose("EXCEL.exe")
    Func _Exit()

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

    Exit
    EndFunc

    [/autoit]


    das ist das uhrsprüngliche programm funktioniert dadellos nur das ich damit nur eine info abrufen kann

    ich müste es aber haben das er die 2 te info auch ausliest und in spalte C schreibt

    das währe der weg zur 2ten info.

    Spoiler anzeigen
    [autoit]


    MouseClick("LEFT", 450 , 366, 1, 0)
    Send("{LSHIFT down}")
    Send("{right 4}")
    Send("{LSHIFT up}")
    Send ("^c")

    [/autoit]

    danke schon mal im vorraus

    Adam

    Einmal editiert, zuletzt von Adamkaller (6. Dezember 2012 um 08:14)

  • Hi,

    ich kann es natürlich nicht testen, aber wenn ich deine Anfrage richtig verstehe, dürfte das so funktionieren:

    Spoiler anzeigen
    [autoit]

    HotKeySet("{ESC}", "_Exit")
    BlockInput (1)

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

    #include <Excel.au3>
    $sPath = @ScriptDir & "\Test1.xls"
    $oExcel = _ExcelBookOpen($sPath, 0)
    $iRow = 1

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

    While True
    $value = _ExcelReadCell($oExcel, "A" & $iRow)
    If $value = "" Then ExitLoop
    _Data($value)
    if $val1 <> "" then _ExcelWriteCell($oExcel, $val1, "B" & $iRow)
    if $val2 <> "" then _ExcelWriteCell($oExcel, $val2, "C" & $iRow
    $iRow += 1
    WEnd

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

    _ExcelBookClose($oExcel)

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

    Func _Data($value)
    ClipPut($value)
    WinActivate ( "QWS3270")
    WinWaitActive("QWS3270")
    Sleep (300)

    MouseClick("LEFT", 394, 397, 1, 0)

    Send ("^v")
    Send ("{ENTER}")
    Send ("9")
    Send ("{ENTER}")
    Sleep (300)

    MouseClick("LEFT", 360 , 394, 1, 0)
    Send("{LSHIFT down}")
    Send("{right 4}")
    Send("{LSHIFT up}")
    Send ("^c")

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

    $val1 = ClipGet()

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

    MouseClick("LEFT", 450 , 366, 1, 0)
    Send("{LSHIFT down}")
    Send("{right 4}")
    Send("{LSHIFT up}")
    Send ("^c")

    $val2 = ClipGet()
    EndFunc

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

    BlockInput (0)

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

    MsgBox (0, "Fertig", "Alle Daten in der XLS gespeichert", 2)

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

    ProcessClose("EXCEL.exe")

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

    Func _Exit()
    Exit
    EndFunc

    [/autoit]

    Gruß
    x0r

    Simon nörgelt, Simon nervt - aber Simon verbessert die Welt. Glaubt er.

  • hallo

    Ich danke dir erst mal. Nein hatte nicht ganz geklappt kommt ein error beim excel schreiben

    aber an hand deines scrips habe ich meinen denkfehler gefunden und konnte es zum laufen bringen.

    Manchmal sieht man denn walt vorlauter Bäumen nicht :)

    Gruß Adam