Problem mit 2 Scripten

  • Hab folgendes Problem.

    Ich starte ein script.
    In diesem starte ich einen 2. Script.
    Der 2. Script überprüft mit der der ie.au3 auf einer Seite (die mit dem ersten Script mit der ie.au3 geöffnet wurde) ob ein bestimmtes Wort existiert und soll mich dann benachrichtigen.

    Nur leider geht das 2. Script einfach zu wenn das Wort existiert.

    Wenn ich aber das 2. Script per Hand starte, sei es die .au3 oder die compiled .exe dann funktioniert es einwandfrei.

    Auch wenn ich das erste script offen habe und dann per Hand das 2. Script starte funktioniert es auch einwandfrei.

    Nur wenn ich das 2. über das erste starte funktioniert es nicht.

    Was kann das sein??

    Einmal editiert, zuletzt von Spion (13. Mai 2007 um 21:07)

  • Zitat

    Original von peethebee
    Hi!

    Ich habe keine Glaskugel...
    Als Ersatz könnte Quellcode herhalten :D

    peethebee

    Warum hast du auch keine Glaskugel :rofl:

    Also 1. Script

    Spoiler anzeigen
    [autoit]


    #cs
    AutoIt Version: 3.0
    Sprache: De
    Author: MON_Spion
    Script Function:

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

    #ce

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

    #include <ie.au3>
    #include <GuiConstants.au3>
    #include <GuiTab.au3>
    #include <String.au3>
    #include <INet.au3>

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

    Dim $oIE
    Dim $neuenachrichten
    $guiexplorer = ObjCreate("Shell.Explorer.2")
    $titel = IniRead( "config.ini", "Titel", "Titel", "Fehler")
    $name = IniRead( "config.ini", "Login", "Name", "Fehler")
    $pwd = IniRead( "config.ini", "Login", "Passwort", "Fehler")
    $uni= IniRead( "config.ini", "Login", "Uni", "Fehler")
    $firefox= IniRead( "config.ini", "firefox", "pfad", "Fehler") & "\firefox.exe"
    $ally = IniRead( "config.ini", "Login", "ally", "Fehler")
    $statuni = StringReplace($uni, ". Universum", "")

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

    ;INI Kontrolle
    While $name = ""
    If MsgBox( 0, $titel, "Konfiguriere erst dein Tool") = 1 Then Run( "setup.exe")
    Exit
    WEnd
    While $pwd = ""
    If MsgBox( 0, $titel, "Konfiguriere erst dein Tool") = 1 Then Run( "setup.exe")
    Exit
    WEnd
    While $uni = ""
    If MsgBox( 0, $titel, "Konfiguriere erst dein Tool") = 1 Then Run( "setup.exe")
    Exit
    WEnd
    ;INI Kontrolle

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

    ;log in
    If ProcessExists("iexplore.exe") Then
    Else
    $sUrl = "http://ogame.de/portal/?lang=de&frameset=1"
    $oIE = _IECreate($sUrl, 0, 1) ;0,1 visible...0,0 invisible
    _IELoadWait ($oIE)
    $oForm = _IEFormGetCollection($oIE, 0)
    $oUniversum = _IEFormElementGetObjByName($oForm, "Uni")
    _IEFormElementOptionSelect($oUniversum, $uni, 1, "byText")
    $oLogin = _IEFormElementGetObjByName($oForm, "login")
    _IEFormElementSetValue($oLogin, $name)
    $oPassword = _IEFormElementGetObjByName($oForm, "pass")
    _IEFormElementSetValue($oPassword, $pwd)
    Send("{Tab}")
    Send("{Enter}")
    sleep(2000)
    EndIf
    ;log in

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

    ;GUI
    $gui = GuiCreate( $titel, 1000, 800)
    ;GUI

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

    ;------------------------------------------------------------------------------------------------------------------------------------------------------Tabs
    $tabcreate = GuiCtrlCreateTab(0, 0, 600, 23)

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

    ;Übersicht
    GuiCtrlCreateTabItem("Übersicht ")

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

    GUICtrlCreateTabItem("")
    ;Übersicht

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

    ;Tools
    GuiCtrlCreateTabItem("Tools ")
    GUICtrlCreateLabel("Benachrichtigung", 200, 100)
    $ton = GUICtrlCreateCheckbox ("Benachrichtigen per Alarmsignal?", 200, 130, 150, 20)
    $sms = GUICtrlCreateCheckbox ("Benachrichtigen per SMS?", 200, 160, 150, 20)
    $alarmstarten = GUICtrlCreateButton("Starten", 200, 190, 100)

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

    GUICtrlCreateTabItem("")
    ;Tools

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

    ;------------------------------------------------------------------------------------------------------------------------------------------------------Taps

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

    GuiSetState()

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

    Do
    $msg = GUIGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
    ;------------------------------------------------------------------------------------------------------------------------------------------------------Tabfunc
    Case $msg = $tabcreate
    Switch GUICtrlRead($tabcreate)
    Case 0 ;Übersicht
    Case 2 ;Tools
    ;------------------------------------------------------------------------------------------------------------------------------------------------------Tabfunc
    EndSwitch
    Case $msg = $alarmstarten
    IniWrite(@ScriptDir & "\engine\var.ini", "variable", "ton", GUICtrlRead($ton))
    IniWrite(@ScriptDir & "\engine\var.ini", "variable", "sms", GUICtrlRead($sms))
    Run (@ScriptDir & "\engine\alarm.exe")
    EndSelect
    Until $msg = $GUI_EVENT_CLOSE

    [/autoit]

    2. Script

    Spoiler anzeigen
    [autoit]


    #include <ie.au3>
    #include <INet.au3>
    #include <GuiConstants.au3>
    #include <Misc.au3>

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

    $s_SmtpServer = IniRead("config.ini", "mail", "smtp", "Fehler")
    $s_FromName = "name"
    $s_FromAddress = "mail@server.de"
    $s_ToAddress = IniRead( "config.ini", "mail", "empf", "Fehler")
    $s_Subject = "Mitteilung"
    $s_UName = IniRead( "config.ini", "mail", "name", "Fehler")
    $s_PWD = IniRead( "config.ini", "mail", "pwd", "Fehler")
    $ton = IniRead( "var.ini", "variable", "ton", "Fehler")
    $sms = IniRead( "var.ini", "variable", "sms", "Fehler")

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

    GuiCreate("Alarm", 300, 300)
    GUISetState(@SW_SHOW)
    GuiCtrlCreateLabel("Aktiv", 30, 50)
    $stop = GUICtrlCreateButton("Abbrechen", 30, 80, 100)

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

    Do
    $oIE = _IEAttach ("TestSeite")
    $U_Frame = _IEFrameGetObjByName($oIE,"INHALT")
    $random = Random(5000,10000,1)
    sleep($random)
    _IELinkClickByText($U_Frame,"Übersicht")
    $H_Frame = _IEFrameGetObjByName($oIE,"Hauptframe")
    $html = _IEDocReadHTML($H_Frame)
    $angriff = StringRegExp( $html, "Test", 0)
    Until $angriff = 1

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

    If $sms = 1 Then
    Dim $as_Body[2]
    $as_Body[0] = "Mitteilung"
    $as_Body[1] = ""
    $Response = _INetSmtpMailAuth ($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_UName, $s_PWD, $s_Subject, $as_Body, "EHLO ")
    $err = @error
    Else
    $Response = 11
    EndIf
    If $Response = 1 Then
    MsgBox(0, "Sendebricht", "SMS wurde versendet.")
    EndIf
    If $Response = 11 Then
    Else
    MsgBox(0, "Sendebericht", "SMS wurde nicht versendet. Fehlercode:" & $err)
    EndIf
    If $ton = 1 Then
    SoundPlay (@ScriptDir & "\sounds\alarm.wav",0)
    MsgBox (0,"Benachrichtigung","Wort existiert")
    EndIf

    [/autoit]

    :Edit
    Und es geht bei Alarmsignal wie auch beim smsversand einfach zu.

    Einmal editiert, zuletzt von Spion (13. Mai 2007 um 21:03)