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. kesandal

Beiträge von kesandal

  • Mein Programm lässt sich nicht (mehr) schließen ;)

    • kesandal
    • 23. August 2007 um 23:20

    Ich muss Dich enttäuschen..
    Der Close-Button funktioniert immer noch nicht :(
    Ich klicke zunächst auf "Start AIS" und dann auf "Close"...

    Wenn ich direkt am Anfang auf "Close" klicke, funktioniert es.

  • Mein Programm lässt sich nicht (mehr) schließen ;)

    • kesandal
    • 23. August 2007 um 22:54

    kannst Du mir bitte noch sagen wo der Fehler war ? Ich suche die Unterschiede :D


    Anyway.. Vielen Dank für die sehr schnelle Hilfe

  • Mein Programm lässt sich nicht (mehr) schließen ;)

    • kesandal
    • 23. August 2007 um 22:40

    Man entschuldige bitte den grausamen Programmierstyl :D

    Spoiler anzeigen
    [autoit]


    #include <GUIConstants.au3>
    #Include <date.au3>
    #include <Array.au3>
    #include <GuiEdit.au3>

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

    Opt("RunErrorsFatal", 0)

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

    Opt("GUIOnEventMode", 1)
    Opt("MouseCoordMode", 1);1=absolute, 0=relative, 2=client
    Opt("PixelCoordMode", 1);1=absolute, 0=relative, 2=client

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

    Dim $usr_deskW = @DesktopWidth ; Auflösung vertikal vom User
    Dim $usr_deskH = @DesktopHeight ; Auslösung horizontal vom User

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

    Dim $hostdate = "0"
    Dim $hosttime = "0"
    Dim $statusmsg = ""

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

    Global $logmsgid = 0

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

    Dim $WindowAIS_Icon_Status = 0
    Dim $WindowAIS_Icon_Blue = 1278188

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

    Dim $WindowAISStatus = 0

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

    Dim $WindowAIS_Executable = ""
    Dim $WindowAISError = 0

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

    Global $WindowAIS_find
    Global $WindowAIS_Top
    Global $WindowAIS_Bottom

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

    ;;;;;;;;;;;;;;;;; M A I N F E N S T E R S T A R T ;;;;;;;;;;;;;;;;;

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

    $ParentGUI = GUICreate(":: AIS :: Main-Window", 283, 139, 429, 568)
    $Executable = GUICtrlCreateInput("", 8, 32, 265, 21)
    $Label1 = GUICtrlCreateLabel("File", 8, 8, 61, 17)
    $cmdStart = GUICtrlCreateButton("Start AIS", 200, 104, 73, 25, 0)
    $cmdClose = GUICtrlCreateButton("Close", 40, 104, 73, 25, 0)
    $cmdMinimize = GUICtrlCreateButton("Minimize", 120, 104, 73, 25, 0)
    GUISetState(@SW_SHOW)

    ;;;;;;;;;;;;;;;;; M A I N F E N S T E R E N D E ;;;;;;;;;;;;;;;;;;

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

    ;;;;;;;;;;;;;;;;; S T A T U S F E N S T E R S T A R T ;;;;;;;;;;;;;;;;;

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

    $ChildGUI = GUICreate(":: AIS :: Status-Window", 382, 178, 270, 420)
    GUISetBkColor(0xC0DCC0)
    $ltopic = GUICtrlCreateLabel("Status-Window", 8, 8, 106, 20)
    GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
    GUICtrlSetBkColor(-1, 0xC0DCC0)
    $statustext = GUICtrlCreateEdit("", 8, 32, 369, 137, BitOR($ES_AUTOVSCROLL,$ES_READONLY,$ES_WANTRETURN,$WS_VSCROLL))
    $llogs = GUICtrlCreateLabel("Logs", 352, 8, 27, 17)
    GUICtrlSetBkColor(-1, 0xC0DCC0)
    $llogsnum = GUICtrlCreateLabel("", 296, 8, 44, 12)
    GUICtrlSetBkColor(-1, 0xC0DCC0)

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

    GUISetState(@SW_SHOW)
    WinSetOnTop("Status-Window","",1)

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

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

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

    ;;;;;;;;;;;;;;;;; S T A T U S F E N S T E R E N D E ;;;;;;;;;;;;;;;;;;

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

    StatusText("Program started")

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

    ; Events
    GUICtrlSetOnEvent($cmdClose, "GUIClose")
    GUICtrlSetOnEvent($cmdMinimize,"GUIMainMinimize")
    GUICtrlSetOnEvent($cmdStart, "AIStart")

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

    While 1
    sleep(100)
    WEnd

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

    Func AIStart()
    Global $f_FirstLoop = 0

    While 1
    m_Global()

    sleep(1000)
    WEnd
    EndFunc

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

    Func m_Global()

    If not $WindowAISError = 1 Then
    If not $WindowAIS_FirstLoop = 1 Then
    If Not WindowAIS_Find() Then
    WindowAIS_Start()
    Else
    WindowAIS_()
    EndIf
    $WindowAIS_FirstLoop = 1
    Else
    WindowAIS_()
    EndIf
    EndIf
    EndFunc

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

    Func WindowAIS_()
    $WindowAIS_Icon_Status = PixelGetColor (13,($WindowAIS_Top+45))

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

    Select
    case $WindowAIS_Icon_Status = $WindowAIS_Icon_Blue
    ;TO-DO alles ok !
    case Else
    StatusText("WindowAIS : [WARNING] Icon unknown !")
    If Not WindowAIS_Find() Then
    WindowAIS_Start()
    EndIf
    EndSelect
    EndFunc

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

    Func WindowAIS_Start()
    StatusText("Trying to start WindowAIS ")
    $WindowAIS_Executable = GUICtrlRead($iWindowAIS_Executable)
    Run($WindowAIS_Executable)
    If @error = 1 Then
    StatusText("WindowAIS : [WARNING] Executable hasn't been found !")
    $WindowAISError= 1
    Else
    StatusText("WindowAIS started")
    sleep(2500)
    EndIf
    EndFunc

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

    Func WindowAIS_Find()
    StatusText("Searching WindowAIS ")
    $WindowAIS_find = SearchArea("0", "0", $usr_deskW, $usr_deskW, "01F3AFFDD74E", "0", "1")
    Select
    Case Not @error
    $WindowAIS_Top = ($WindowAIS_find[1]-1)
    $WindowAIS_Bottom = (($WindowAIS_find[1]+59))
    StatusText("WindowAIS : Window has been found !")
    StatusText("WindowAIS : top: " & $WindowAIS_Top)
    StatusText("WindowAIS : bottom: "& $WindowAIS_Bottom)

    Return 1
    Case @error = 1
    StatusText("[ERROR] Window not found!")
    Return 0
    EndSelect
    EndFunc

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

    Func GUIClose()
    $var = MsgBox(4,"Really Close???","Are you sure you want to close AIS??")
    if $var = 6 then
    GUIDelete($ParentGUI)
    GUIDelete($ChildGUI)
    exit
    endif
    EndFunc

    Func GUIMainMinimize()
    GUISetState(@SW_SHOW,$ChildGUI)
    EndFunc

    Func StatusText($statusmsg)
    $logmsgid += 1
    GUICtrlSetData($llogsnum,$logmsgid)
    $prefix = "[" & _NowDate() & " / " & _NowTime() & "] : "
    $log = GUICtrlRead($statustext)
    $log = $log & $prefix & $statusmsg &@CRLF
    GUICtrlSetData($statustext,$log)
    _GUICtrlEditLineScroll ($statustext, 0,1000000 )
    EndFunc

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

    EndFunc

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

    Func SearchArea($left, $top, $right, $bottom, $areavalue, $shadevariation = 0, $step = 1)
    ;===============================================================================
    ;
    ; Description: Searches a rectangle of pixels for the pixel areavalue provided.
    ; Areavalue is combination of one or more pixel point.
    ; Syntax: _PixelsSearch ( left, top, right, bottom, color [, shade-variation] [, step]] )
    ; Parameter(s): left - left coordinate of rectangle.
    ; top - top coordinate of rectangle.
    ; right - right coordinate of rectangle.
    ; bottom - coordinate of rectangle.
    ; checksum - checksum value of the region.
    ; shadevariation - A number between 0 and 255 to indicate the allowed number of shades of
    ; variation of the red, green, and blue components of the colour. Default is 0 (exact match).
    ; step - Instead of searching each pixel use a value larger than 1 to skip pixels (for speed).
    ; E.g. A value of 2 will only check every other pixel. Default is 1.
    ; Return Value(s): On Success - Returns a two-element array of pixel's coordinates. (Array[0] = x, Array[1] = y)
    ; On Failure - Sets @error to 1 if region is not found.
    ; - Sets @error to 2 if areavalue is invalid
    ; Author(s): quixote79
    ; Note(s): Similar to PixelSearch()
    ; It works only under Opt("MouseCoordMode", 1) and Opt("PixelCoordMode", 1)
    ;
    ;===============================================================================

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

    $areavaluelength = StringLen($areavalue) / 12
    If IsInt($areavaluelength) = 1 Then
    Local $x[$areavaluelength]
    Local $y[$areavaluelength]
    Local $color[$areavaluelength]
    If $areavaluelength <> 1 Then
    Local $xg[$areavaluelength - 1]
    Local $yg[$areavaluelength - 1]
    EndIf
    For $a = 0 To $areavaluelength - 1
    $x[$a] = Dec(StringMid($areavalue, 12 * $a + 1, 3))
    $y[$a] = Dec(StringMid($areavalue, 12 * $a + 4, 3))
    $color[$a] = Dec(StringMid($areavalue, 12 * $a + 7, 6))
    Next
    For $b = $areavaluelength - 2 To 0 Step - 1
    $xg[$b] = $x[$b + 1] - $x[0]
    $yg[$b] = $y[$b + 1] - $y[0]
    Next

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

    For $c = $top To $bottom
    $mleft = $left
    Do
    $fpos = PixelSearch($mleft, $c, $right, $c, $color[0], $shadevariation, $step)
    If Not @error Then
    $state = 0
    For $d = 0 To $areavaluelength - 2
    If PixelGetColor($fpos[0] + $xg[$d], $fpos[1] + $yg[$d]) <> $color[$d + 1] Then
    $state = 1
    ExitLoop
    EndIf
    Next
    If $state = 0 Then
    Return $fpos
    ExitLoop
    Else
    $mleft = $fpos[0] + $step
    EndIf
    Else
    ExitLoop
    EndIf
    Until $mleft >= $right
    Next
    SetError(1)
    Else
    SetError(2)
    EndIf
    EndFunc ;==>_PixelsSearch

    [/autoit]
  • Mein Programm lässt sich nicht (mehr) schließen ;)

    • kesandal
    • 23. August 2007 um 22:18

    Hallo zusammen :)
    könnt ihr mir bitte sagen, warum das Programm beim Klick auf meinen
    Schließen-Button (cmdClose) nicht geschlossen wird ? :(

    Hier ein Ausschnitt aus meinem Programm:

    [autoit]


    GUICtrlSetOnEvent($cmdClose, "GUIClose")
    GUICtrlSetOnEvent($cmdMinimize,"GUIMainMinimize")
    GUICtrlSetOnEvent($cmdStart, "AIStart")

    While 1
    sleep(100)
    WEnd



    Func AIStart()
    While 1
    m_Global()
    sleep(1000)
    WEnd
    EndFunc

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

    Func GUIClose()
    $var = MsgBox(4,"Really Close???","Are you sure you want to close AIS??")
    if $var = 6 then
    GUIDelete($ParentGUI)
    GUIDelete($ChildGUI)
    exit
    endif
    EndFunc

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


    Vielen Dank im Voraus !


    €dit: Als ich früher meine AIStart Funktion nicht hatte bzw. dort keine while 1 war, funktionierte es ;)

  • Text in einem Bild suchen

    • kesandal
    • 28. Mai 2007 um 00:22

    Hallo zusammen,
    ich frage mich, ob es möglich ist mit Autoit einen Text auf dem Bildschirm zu suchen..
    Der Text ist immer gleich, hat immer die gleiche Größe / Farbe.
    Die Position ist aber nicht immer identisch (da verschiedene Auflösungen).
    Währe PixelGetColor vielleicht ein Ansatz dafür ?

    Mein Script soll die Konfiguration von einem Spiel (InGame) erkennen und entsprechend meiner Vorgaben einstellen.

    Es würde auch schon helfen - falls möglich - via Vergleich zu suchen.
    Sprich ich habe ein Referenzbild das ich in Autoit einladen würde und dann auf dem Bildschirm suche.

    Die Suche soll ferner nur einmal stattfinden.. Also nicht ständig "auf die Sekunde" aktuell sein.

    Hoffe ihr könnt mir helfen, danke

    kesandal

  • Problem beim setzen von Checkbox

    • kesandal
    • 26. Mai 2007 um 18:40

    klappt nun, danke

  • Problem beim setzen von Checkbox

    • kesandal
    • 26. Mai 2007 um 18:28

    Glaube das geht nicht... Weil speichere meine Variablen mit

    Local $Pref[1][2] = [ ["CheckBox-Value", GUICtrlRead($myCheckBox)] ]

    (Das Array ist gekürzt... )

    IniWriteSection(".\config.ini","Prefs",$Pref,$Pref)


    Edit:


    Speichern in Ini:
    Local $Pref[4][2] = [ _
    ["x1", GUICtrlRead($mmx1)], _
    ["x2", GUICtrlRead($mmx2)], _
    ["x3", GUICtrlRead($mmx3)], _
    ["x4", GUICtrlRead($mmx4)]]

    IniWriteSection(".\config.ini","Prefs",$Pref,$Pref)

    Lesen aus ini:
    $configGeneral = IniReadSection ( ".\config.ini", "Pref")
    GUICtrlSetData($mmx1,$configGeneral[1][1])
    GUICtrlSetData($mmx2,$configGeneral[2][1])
    GUICtrlSetData($mmx3,$configGeneral[3][1])
    GUICtrlSetData($mmx4,$configGeneral[4][1])

  • Problem beim setzen von Checkbox

    • kesandal
    • 26. Mai 2007 um 18:11

    Hallo zusammen,
    beim schließen von meinem Script, wird der Zustand der Checkboxes , Inputfelder etc. in eine Ini-File gespeichert..

    So steht dann in meiner Ini-File für eine Checkbox z.B. : myCheckBox=4

    Beim öffnen soll nun die Ini ausgelesen werden und entsprechend die Checkboxes etc. gesetzt werden...

    Mit den Inputfeldern klappt das..
    Bei den CheckBoxen, radioButtons nicht..

    Bsp.
    GUICtrlSeState($myCheckBox,$configGeneral[1][1])

    Liefert den Wert 4 zurück... Um eine Checkbox aber auf "True" zu setzen brauche ich den Befehl
    GUICtrlSetState($myCheckBox,$GUI_CHECKED)


    Jemand von Euch eine Idee für dieses Problem?

    Thx,
    kesa

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™