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

Beiträge von Fresapore

  • Mathe-Trainer (Grundrechenarten)

    • Fresapore
    • 14. November 2010 um 22:43

    An sich nett gemacht,
    Schönes Design ;)
    aber man kann als Höchstgrenze eine niedrigere Zahl als die Minsestgrenze eingeben, dann kommt als Aufgabe immer 0*0, 0+0, 0/0 (was komischerweise geht ;)) und 0-0.......

  • Bild hover unsichtbar

    • Fresapore
    • 11. November 2010 um 17:44

    Oh stimmt, das hatte ich nicht beachtet:

    Spoiler anzeigen
    [autoit]

    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>

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

    Global $Hoverbild
    $hoverjn = 0
    $act = 0
    $Form1 = GUICreate("Form1", 615, 440, 192, 124, BitOR($GUI_SS_DEFAULT_GUI,$WS_MAXIMIZEBOX,$WS_SIZEBOX,$WS_THICKFRAME,$WS_TABSTOP))
    $Pic1 = GUICtrlCreatePic("C:\Bild1.jpg", 24, 14, 567, 403)
    GUICtrlSetResizing(-1, $GUI_DOCKAUTO)
    $Pic2 = GUICtrlCreatePic("C:\bt1.jpg", 188, 110, 209, 133)
    GUICtrlSetResizing(-1, $GUI_DOCKAUTO)
    GUISetState(@SW_SHOW)

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

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    EndSwitch
    $pos = GUIGetCursorInfo()
    $size = wingetpos("Form1")
    if $size[2]/(615/188) < $pos[0] and $pos[0] < $size[2]/(615/397) and $size[3]/(440/110) < $pos[1] and $pos[1] < $size[3]/(440/243) Then
    $hoverjn = 1
    Else
    $hoverjn = 0
    EndIf
    if $hoverjn <> $act Then
    if $hoverjn = 1 Then
    $act = 1
    guictrlsetstate($pic2, $GUI_HIDE)
    Else
    $act = 0
    guictrlsetstate($pic2, $GUI_SHOW)
    EndIf
    EndIf
    WEnd

    [/autoit]
  • Bild hover unsichtbar

    • Fresapore
    • 10. November 2010 um 23:10

    Naja, wenn das Bild versteckt ist, ist die Maus auch nicht mehr über dem Bild ;) Deshalb kann man das ganz einfach mit der Position der Maus machen:

    Spoiler anzeigen
    [autoit]

    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>

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

    Global $Hoverbild
    $hoverjn = 0
    $act = 0
    $Form1 = GUICreate("Form1", 615, 440, 192, 124, BitOR($GUI_SS_DEFAULT_GUI,$WS_MAXIMIZEBOX,$WS_SIZEBOX,$WS_THICKFRAME,$WS_TABSTOP))
    $Pic1 = GUICtrlCreatePic("C:\Bild1.jpg", 24, 14, 567, 403) ; das ist das Hintergrundbild!
    GUICtrlSetResizing(-1, $GUI_DOCKAUTO)
    $Pic2 = GUICtrlCreatePic("C:\bt1.jpg", 188, 110, 209, 133) ; das ist das Bild auf das der Cursor reagiert!
    GUICtrlSetResizing(-1, $GUI_DOCKAUTO)
    GUISetState(@SW_SHOW)

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

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    EndSwitch
    $pos = GUIGetCursorInfo()
    if 188 < $pos[0] and $pos[0] < 397 and 110 < $pos[1] and $pos[1] < 243 Then
    $hoverjn = 1
    Else
    $hoverjn = 0
    EndIf
    if $hoverjn <> $act Then
    if $hoverjn = 1 Then
    $act = 1
    guictrlsetstate($pic2, $GUI_HIDE)
    Else
    $act = 0
    guictrlsetstate($pic2, $GUI_SHOW)
    EndIf
    EndIf
    WEnd

    [/autoit]
  • Sqrt - Wurzel ohne Längenbegrenzung ziehen

    • Fresapore
    • 8. November 2010 um 16:22

    Die säh dann GANZ GROB so aus:

    Spoiler anzeigen
    [autoit]

    $ergebnis = 0
    $testzahl = 0
    $zaehler = 0
    $multiplikator = 100
    $nachkommastellen = inputbox("Nachkommastellen", "Anzahl der Nachkommastellen")
    $berechnezahl = inputbox("Wurzel von", "Wurzel berechnen von:")
    while $zaehler <= $nachkommastellen+2
    while ($ergebnis + ($multiplikator*$testzahl))^2 <= $berechnezahl
    $testzahl += 1
    WEnd
    $testzahl -= 1
    $ergebnis += $multiplikator*($testzahl)
    $multiplikator = $multiplikator *(1/10)
    $zaehler += 1
    WEnd
    MsgBox(0, "Ergebnis", "Das Ergebnis der Wurzel ist: "&$ergebnis)
    Exit

    [/autoit]
  • Sqrt - Wurzel ohne Längenbegrenzung ziehen

    • Fresapore
    • 8. November 2010 um 16:04

    Du kannst ja die Wurzelfunktion einfach selbst schreiben..
    Mit dem Schachtelungsverfahren, dann kannst du selber entscheiden, wie viele Nachkommastellen es berechnen soll. ;)

  • hilfe bei meinem kleinen auto spiel

    • Fresapore
    • 17. Oktober 2010 um 20:37

    Ein Spiel mit Labels.. ;)
    Aber vllt solltest du die einzelnen Werte des Randes in der txt abspeichern, und den Rand anhand dieser Werte erstellen, dann kannst du einfacher mit den Variablen rechnen, um zu prüfen, ob $2 noch größer ist als der X-Wert des Randes...
    In den Funktionen fehlen noch, dass die Labels auch verschoben werden, mit dem Löschen und neu erstellen ist nicht gerade der schönste Weg...
    mach das mit

    [autoit]

    guictrlsetpos()

    [/autoit]
  • Ein Einstellungsmenü für anderen script FEHLER

    • Fresapore
    • 17. Oktober 2010 um 18:55

    Beim Guioneventmode kannst du den Befehl $msg = guigetmsg() nicht verwenden..
    Warum schreibst/löschst du denn in Inis in der Funktion _check1()?
    Würde da nicht sowas reichen wie:
    Wäre so nicht ausreichen?

    Spoiler anzeigen
    [autoit]

    #include <ButtonConstants.au3>
    #include <EditConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>

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

    Global $Konfig = @ScriptDir & "\Konfig.ini"
    Global $Transread = IniRead($Konfig,"Transparenz","ENABLEORDISABLE","ENABLE")
    Global $Waitread = IniRead($Konfig,"WaitTime","ENABLEORDISABLE","DISABLE")
    Global $Messageread = IniRead($Konfig,"Message","ENABLEORDISABLE","ENABLE")
    Opt("GUIOnEventMode", 1)

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

    Hotkeyset("{ESC}", "_exit")
    #Region ### START Koda GUI section ### Form=
    $SAVE = GUICreate("Form1", 454, 322, 192, 124, $WS_POPUPWINDOW)
    $Label5 = GUICtrlCreateLabel("Einstellungen", 104, 16, 195, 41)
    GUICtrlSetFont(-1, 24, 400, 0, "MS Sans Serif")
    $Checkbox1 = GUICtrlCreateCheckbox("Transparenz wenn Mauszeiger nicht auf Programmfenster ist?", 16, 88, 393, 41)
    GUICtrlSetOnEvent(-1,"_Check1")
    If $Transread = "ENABLE" Then
    GUICtrlSetState(-1, $GUI_CHECKED)
    Else
    GUICtrlSetState(-1, $GUI_UNCHECKED)
    EndIf
    GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
    $Checkbox2 = GUICtrlCreateCheckbox("Eine Zeit lang warten und erst dann Transparenz", 48, 128, 313, 25)
    GUICtrlSetOnEvent(-1,"_Check2")
    If $Waitread = "ENABLE" Then
    GUICtrlSetState(-1, $GUI_CHECKED)
    Else
    GUICtrlSetState(-1, $GUI_UNCHECKED)
    EndIf
    GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
    $Input1 = GUICtrlCreateInput("", 48, 160, 153, 24, $ES_NUMBER)
    GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
    $Label6 = GUICtrlCreateLabel("Nur Zahlen! (z.b. so:12) Keine Leerzeichen", 200, 160, 251, 20)
    GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
    $Checkbox3 = GUICtrlCreateCheckbox("Startanimation anzeigen", 16, 232, 225, 41)
    If $Messageread = "ENABLE" Then
    GUICtrlSetState(-1, $GUI_CHECKED)
    Else
    GUICtrlSetState(-1, $GUI_UNCHECKED)
    EndIf
    GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
    $Button1 = GUICtrlCreateButton("Speichern", 104, 272, 217, 41, $WS_GROUP)
    GUICtrlSetOnEvent(-1,"_Save")
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###
    _check1()
    _check2()
    While 1
    sleep(40)
    WEnd

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

    Func _Save()
    $Chek1read = GUICtrlRead($Checkbox1)
    $Chek2read = GUICtrlRead($Checkbox2)
    $Chek3read = GUICtrlRead($Checkbox3)
    If $Chek1read = $GUI_UNCHECKED Then
    IniDelete($Konfig,"Transparenz","ENABLEORDISABLE")
    IniWrite($Konfig,"Transparenz","ENABLEORDISABLE","DISABLE")
    IniDelete($Konfig,"WaitTime","ENABLEORDISABLE")
    IniWrite($Konfig,"WaitTime","ENABLEORDISABLE","DISABLE")
    EndIf
    If $Chek1read = $GUI_CHECKED Then
    IniDelete($Konfig,"Transparenz","ENABLEORDISABLE")
    IniWrite($Konfig,"Transparenz","ENABLEORDISABLE","ENABLE")
    If $Chek2read = $GUI_CHECKED Then
    IniDelete($Konfig,"WaitTime","ENABLEORDISABLE")
    IniWrite($Konfig,"WaitTime","ENABLEORDISABLE","ENABLE")
    Else
    IniDelete($Konfig,"WaitTime","ENABLEORDISABLE")
    IniWrite($Konfig,"WaitTime","ENABLEORDISABLE","DISABLE")
    EndIf
    EndIf
    If $Chek3read = $GUI_CHECKED Then
    IniDelete($Konfig,"Message","ENABLEORDISABLE")
    IniWrite($Konfig,"Message","ENABLEORDISABLE","ENABLE")
    Else
    IniDelete($Konfig,"Message","ENABLEORDISABLE")
    IniWrite($Konfig,"Message","ENABLEORDISABLE","DISABLE")
    EndIf
    GUIDelete($SAVE)
    EndFunc

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

    Func _Check1()
    if guictrlread($checkbox1) = $GUI_CHECKED then
    guictrlsetstate($checkbox2, $GUI_ENABLE)
    else
    guictrlsetstate($checkbox2, $GUI_DISABLE)
    EndIf
    EndFunc
    Func _Check2()
    if guictrlread($checkbox2) = $GUI_CHECKED and guictrlread($checkbox1) = $GUI_CHECKED then
    guictrlsetstate($Input1, $GUI_ENABLE)
    else
    guictrlsetstate($Input1, $GUI_DISABLE)
    EndIf
    EndFunc

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

    Func _exit()
    Exit
    EndFunc

    [/autoit]
  • Ein Einstellungsmenü für anderen script FEHLER

    • Fresapore
    • 17. Oktober 2010 um 15:59

    Schreib einfach

    [autoit]

    $Chek1read = GUICtrlRead($Checkbox1)
    $Chek2read = GUICtrlRead($Checkbox2)
    $Chek3read = GUICtrlRead($Checkbox3)

    [/autoit]


    in die whileschleife (Z. 50)
    aber es ist auch nicht grade schön, sowas mit einer while-Schleife zu lösen,

    [autoit]

    GUICtrlSetOnEvent

    [/autoit]

    wäre wohl schöner ;)

    €dit: Die Func _save() wird ausgefüht, denn das GUI verschwindet ja, und das steht in der _save()
    MfG,
    Fresapore

  • Bild auf Button

    • Fresapore
    • 17. Oktober 2010 um 14:00

    Hi RapIt :D
    Das Problem ist glaube ich, dass man nur unveränderte (keine Farbe ect.) Buttons mit Bildern versehen kann.
    Die "Farbe" $GUI_BKCOLOR_TRANSPARENT funtioniert aber für Buttons laut der Hilfe nicht.
    Vielleicht geht das nur, wenn man die bkcolor als Bild auf den button einfügt.

    MfG,
    Fresapore

  • Comboboxen verknüpfen

    • Fresapore
    • 14. Oktober 2010 um 12:28

    Wie ich das sehe, wird zwar ausgelesen, welcher Eintrag ausgewählt ist, aber nur einmal und sofort nach dem Erstellen.
    Die Auslesefunktion muss aber in der while-Schleife sein..

    MfG,
    Fresapore

  • Editor Scite mehrere Fenster?

    • Fresapore
    • 14. Oktober 2010 um 11:49

    hab ja den Link für die erklärung in meinem Post stehen.... ;)

  • Editor Scite mehrere Fenster?

    • Fresapore
    • 14. Oktober 2010 um 10:50

    Ich weiß nicht direkt davon, dass man mehrere Scripte gleichzeitig laufen lassen kann, aber du kannst es mit dem Aut2Exe ja als *.exe kompilieren, und die exe dann mehrmals ausführen.
    habe dich wohl falsch verstanden....
    MfG,
    Fresapore

    Edit: noch das hier gefunden.

  • Autoit irrlicht.au3 Hilfe?

    • Fresapore
    • 2. Oktober 2010 um 00:34

    Hi Sprenger120,
    vielen Dank! Funktioiert alles!
    War ja einfacher als gedacht ;)

    MfG,
    Fresapore

  • Autoit irrlicht.au3 Hilfe?

    • Fresapore
    • 1. Oktober 2010 um 23:02

    Hi @all,
    ich will mich in nächster Zeit mal mit der Irrlicht-engine unter autoit befassen..
    Habe (meines Wissens) alles notwendige (hier) heruntergeladen, allerdings funktionieren weder die Beispiele(andauernd ein "Unknown Function name", obwohl die IrrlichtPluginUtils.au3 eingebunden wird..), noch die Skripte aus der Irrlicht-Hilfe....
    Kann mir jemand genau sagen, was ich wo hin speichern und ausführen soll, und evtl mit nem kurzen Beispiel erklären...

    Danke im Vorraus,
    Fresapore

  • Band Information

    • Fresapore
    • 10. September 2010 um 16:26

    Sehr cool!
    Das mit dem Sortieren geht nach meines Wissens nach nicht über Styles, man müsste das dann aufwendig zu Fuss programmieren...

  • Mein Guicreator...

    • Fresapore
    • 8. September 2010 um 21:39

    Hm, Hm, hab jetzt eine Neue Version,
    hier werden Variablen zugewiesen, und man kann Controls noch im Nachhinein verändern, aber das ist noch sehr "buggy" und danach kann man auch keine neuen Controls mehr erstellen,
    ich weiß allerdings nicht genau warum, ich denke die Controls werden im "falschen GUI" erzeugt, aber k.A... ?(
    Vllt hat ja einer eine Idee... :huh:

    Spoiler anzeigen
    [autoit]

    #include <Misc.au3>
    #include <WindowsConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <GuiListView.au3>
    #include <File.au3>
    #Include <GuiEdit.au3>
    #include <UpDownConstants.au3>
    Opt("GUIOnEventMode", 1)

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

    ;Deklarationsteil---------------
    Global $pathcha = @SCRIPTDIR&"\changeslog.au3"
    Global $toolwidth = 200
    Global $toolheight = 200
    global $inspwidth = 500
    Global $inspheight = 50
    Global $attwidth = 200
    Global $attheight = 200
    Global $toolname = "Werkzeuge"
    Global $winname
    Global $Winpos[4]
    Global $newGUI
    Global $text
    Global $numbercontrol = 0
    Global $control[99]
    Global $conname[99]
    Global $contype[99]
    Global $conpos[99][4]
    Global $conclicked = 0
    ;-------------------------------

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

    ;GUIteil------------------------
    ;ToolGUI------------------------
    Global $toolsgui = GUICreate($toolname, $toolwidth, $toolheight, @DesktopWidth/2)
    Global $newwinbut = guictrlcreatebutton("Neues Fenster", 0, 0, $toolwidth/2, $toolheight/5)
    Global $delwinbut = guictrlcreatebutton("Fenster löschen", $toolwidth/2, 0, $toolwidth/2, $toolheight/5)
    guictrlsetstate(-1, $GUI_DISABLE)
    Global $newinputbut = guictrlcreatebutton("Neuer Input", 0, $toolheight/5, $toolwidth/2, $toolheight/5)
    guictrlsetstate(-1, $GUI_DISABLE)
    Global $newlabelbut = guictrlcreatebutton("Neuer Label", $toolwidth/2, $toolheight/5, $toolwidth/2, $toolheight/5)
    guictrlsetstate(-1, $GUI_DISABLE)
    Global $newbutbut = guictrlcreatebutton("Neuer Button", 0, $toolheight/5*2, $toolwidth/2, $toolheight/5)
    guictrlsetstate(-1, $GUI_DISABLE)
    Global $newradiobut = guictrlcreatebutton("Neuer Radiobutton", $toolwidth/2, $toolheight/5*2, $toolwidth/2, $toolheight/5)
    guictrlsetstate(-1, $GUI_DISABLE)
    Global $undobut = guictrlcreatebutton("Rückgängig", 0, $toolheight/5*3, $toolwidth/2, $toolheight/5)
    Global $savebut = guictrlcreatebutton("Als *.au3 speichern", $toolwidth/2, $toolheight/5*3, $toolwidth/2, $toolheight/5)
    guictrlsetstate(-1, $GUI_DISABLE)
    Global $infobut = GUICtrlCreateButton("Informationen", 0, $toolheight/5*4, $toolwidth/2, $toolheight/5)
    Global $helpbut = GUICtrlCreateButton("Hilfe", $toolwidth/2, $toolheight/5*4, $toolwidth/2, $toolheight/5)
    guisetstate()
    guisetonevent($GUI_EVENT_CLOSE, "_exit")
    GUICtrlSetOnEvent($newwinbut, "_testwin")
    GUICtrlSetOnEvent($delwinbut, "_delwin")
    GUICtrlSetOnEvent($savebut, "_saveau3")
    GUICtrlSetOnEvent($newinputbut, "_newinput")
    GUICtrlSetOnEvent($newbutbut, "_newbut")
    GUICtrlSetOnEvent($newlabelbut, "_newlabel")
    GUICtrlSetOnEvent($newradiobut, "_newradio")
    GUICtrlSetOnEvent($undobut, "_undo")
    GUICtrlSetOnEvent($infobut, "_getinfo")
    GUICtrlSetOnEvent($helpbut, "_gethelp")
    ;-------------------------------
    global $inspektorgui = guicreate("Inspektor", $inspwidth, $inspheight, @DESKTOPWIDTH/2-$inspwidth)
    Global $changeslist = guictrlcreatelistview("Name|Typ|X-Koord.|Y-Koord.|Breite|Höhe", 0,0, $inspwidth-100, $inspheight)
    Global $item = guictrlcreatelistviewitem(" | | | | | ", -1)
    Global $changebut = GUICtrlCreateButton("Ändern", $inspwidth-100, 0, 100, $inspheight)
    guisetstate()
    GUISetOnEvent($GUI_EVENT_CLOSE, "_exit")
    GUICtrlSetOnEvent($changebut, "_conchange")

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

    while 1
    if _ispressed(02) then
    $cmsg = GUIGetCursorInfo($newGUI)
    if not @error and IsArray($cmsg) Then
    if winactive($winname) Then
    if $cmsg[4] = 0 Then
    GUICtrlSetData($item, $Winname&"|"&"GUI"&"|"&$Winpos[0]&"|"&$winpos[1]&"|"&$Winpos[2]&"|"&$Winpos[3])
    EndIf
    For $y = 2 to $numbercontrol
    if $cmsg[0] > $conpos[$y][0] and $cmsg[0] < $conpos[$y][0]+$conpos[$y][2] and $cmsg[1] > $conpos[$y][1] and $cmsg[1] < $conpos[$y][1]+$conpos[$y][3] Then
    GUICtrlSetData($item, $conname[$y]&"|"&$contype[$y]&"|"&$conpos[$y][0]&"|"&$conpos[$y][1]&"|"&$conpos[$y][2]&"|"&$conpos[$y][3])
    $conclicked = $y
    EndIf
    Next
    EndIf
    EndIf
    Do
    Until not _ispressed(02)
    sleep(40)
    EndIf
    WEnd
    Func _newinput()
    _newcontrol(0)
    EndFunc
    Func _newbut()
    _newcontrol(1)
    EndFunc
    Func _newlabel()
    _newcontrol(2)
    EndFunc
    Func _newradio()
    _newcontrol(3)
    EndFunc
    Func _checkfocus()

    EndFunc

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

    Func _gethelp()
    MsgBox(0, "Hilfe", "Zum Erstellen eines neuen Fensters einfach auf 'Neues Fenster' drücken."&@CRLF&"Dort den gewünschten Namen eingeben und das Fenster durch Bewegen mit der Maus positionieren. Anschliessend einfach klicken."&@CRLF&@TAB&"ACHTUNG: Nachfolgendes Verschieben hat keinen Effekt mehr auf die festgelegte Position!"&@CRLF&"Die Größe des Fensters durch Bewegen mit der Maus definieren. Anschliessend einfach klicken."&@CRLF&"Erst dann können die vier zur Auswahl stehenden Controls auf die gleiche Weise erstellt werden."&@CRLF&"Mit Rechtsklick auf das jeweilige Control lassen sich die Werte im Inspektor ansehen. Mit Klick auf 'Ändern' können die Werte verändert werden."&@CRLF&" "&@CRLF&"Wenn das GUI fertig erstellt ist, einfach auf 'Als *.au3 speichern' klicken, und den gewünschten Speicherort/namen eingeben.")
    EndFunc
    Func _getinfo()
    if $winname <> "" Then
    $infotext = ""
    $infotext = $infotext&"Aktueller GUI-Titel: "&$Winname&@CRLF
    $infotext = $infotext&"Anzahl Controls: "&$numbercontrol-1&@CRLF
    $infotext = $infotext&@TAB&"Einzelinformationen: "&@CRLF
    for $z = 2 to $numbercontrol
    $infotext = $infotext&@TAB&@TAB&$z-1&"."&@CRLF
    $infotext = $infotext&@TAB&@TAB&"Name: "&$conname[$z]&@CRLF
    Switch $contype[$z]
    case 0
    $infotext = $infotext&@TAB&@TAB&"Typ: "&"Input"&@CRLF
    Case 1
    $infotext = $infotext&@TAB&@TAB&"Typ: "&"Button"&@CRLF
    Case 2
    $infotext = $infotext&@TAB&@TAB&"Typ: "&"Label"&@CRLF
    Case 3
    $infotext = $infotext&@TAB&@TAB&"Typ: "&"Radiobutton"&@CRLF
    EndSwitch
    $infotext = $infotext&@TAB&@TAB&"Abmessungen: X-Pos.: "&$conpos[$z][0]&" Y-Pos.: "&$conpos[$z][1]&" Länge: "&$conpos[$z][2]&" Höhe: "&$conpos[$z][3]&@CRLF
    $infotext = $infotext&@TAB&@TAB&" "&@CRLF
    Next
    MsgBox(0, "Informationen", $infotext)
    Else
    MsgBox(0, "Informationen", "Noch kein Fenster erstellt.")
    EndIf
    EndFunc

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

    Func _conchange()
    if $conclicked > 1 Then
    Global $Form = GUICreate('Ändere Attribute',$attwidth, $attheight, -1, -1, $WS_BORDER)
    guictrlcreatelabel('Name: ', 0, 0, $attwidth/2, $attheight/8)
    Global $newname = guictrlcreateinput($conname[$conclicked], $attwidth/2, 0, $attwidth/2, $attheight/8)
    guictrlcreatelabel('Typ: ', 0, $attheight/8, $attwidth/2, $attheight/8)
    Global $newtype = guictrlcreateinput($contype[$conclicked], $attwidth/2, $attheight/8, $attwidth/2, $attheight/8, $ES_READONLY)

    guictrlcreatelabel('X ', 0, $attheight/8*2, $attwidth/2, $attheight/8)
    Global $newx = guictrlcreateinput($conpos[$conclicked][0], $attwidth/2, $attheight/8*2, $attwidth/2, $attheight/8)
    guictrlcreateupdown(-1)
    GUICtrlSetLimit(-1, $winpos[2], 0)
    guictrlcreatelabel('Y: ', 0, $attheight/8*3, $attwidth/2, $attheight/8)
    Global $newy = guictrlcreateinput($conpos[$conclicked][1], $attwidth/2, $attheight/8*3, $attwidth/2, $attheight/8)
    guictrlcreateupdown(-1)
    GUICtrlSetLimit(-1, $winpos[3], 0)
    guictrlcreatelabel('Breite ', 0, $attheight/8*4, $attwidth/2, $attheight/8)
    Global $newb = guictrlcreateinput($conpos[$conclicked][2], $attwidth/2, $attheight/8*4, $attwidth/2, $attheight/8)
    guictrlcreateupdown(-1)
    GUICtrlSetLimit(-1, 9990, 0)
    guictrlcreatelabel('Höhe ', 0, $attheight/8*5, $attwidth/2, $attheight/8)
    Global $newh = guictrlcreateinput($conpos[$conclicked][3], $attwidth/2, $attheight/8*5, $attwidth/2, $attheight/8)
    guictrlcreateupdown(-1)
    GUICtrlSetLimit(-1, 9990, 0)
    $applybut = guictrlcreatebutton("Übernehmen", 0, $attheight/8*6, $attwidth/2, $attheight/8)
    $exitbut = guictrlcreatebutton("Abbrechen", $attwidth/2, $attheight/8*6, $attwidth/2, $attheight/8)
    GUISetState(@SW_SHOW)
    GUICtrlSetOnEvent($exitbut, "_closeGUI")
    GUICtrlSetOnEvent($applybut, "_changedata")
    Else
    MsgBox(0, "Fehler", "Kein Control ausgewählt!")
    EndIf
    EndFunc

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

    Func _closeGUI()
    guidelete($Form)
    EndFunc

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

    Func _changedata()
    $name = guictrlread($newname)
    $type = guictrlread($newtype)
    $xcoord = guictrlread($newx)
    $ycoord = guictrlread($newy)
    $width = guictrlread($newb)
    $height = guictrlread($newh)
    $conname[$conclicked] = $name
    $contype[$conclicked] = $type
    $conpos[$conclicked][0] = $xcoord
    $conpos[$conclicked][1] = $ycoord
    $conpos[$conclicked][2] = $width
    $conpos[$conclicked][3] = $height
    guidelete($Form)
    winactivate($Winname)
    guictrlsetdata($control[$conclicked], $name)
    guictrlsetpos($control[$conclicked], $xcoord, $ycoord, $width, $height)
    GUICtrlSetData($item, $conname[$y]&"|"&$contype[$y]&"|"&$conpos[$y][0]&"|"&$conpos[$y][1]&"|"&$conpos[$y][2]&"|"&$conpos[$y][3])
    EndFunc

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

    Func _testwin()
    if $winname <> "" Then
    $del = MsgBox(4, "Altes GUI", "Altes GUI überschreiben?")
    if $del = 6 then
    guidelete($newGUI)
    $numbercontrol = 0
    _newwin()
    EndIf
    Else
    _newwin()
    EndIf

    EndFunc

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

    Func _newwin()
    $Winname = inputbox("Neues Fenster", "1. Geben sie den Fenster-Namen ein."&@CRLF&"2. Positionieren sie das Fenster."&@CRLF&"3. Verändern sie die Größe des Fensters.")
    if $Winname <> "" Then
    $newGUI = GUICreate($winname, 150, 150)
    guisetstate()
    while not _ispressed(01)
    $mousepos = mousegetpos()
    $winpos = wingetpos($Winname)
    winmove($winname, "", $mousepos[0]-150, $mousepos[1]-170)
    ToolTip($winpos[0]&"/"&$winpos[1], $mousepos[0], $mousepos[1])
    sleep(40)
    WEnd
    $winpos = wingetpos($Winname)
    while _ispressed(01)
    WEnd
    _MouseTrap($winpos[0]+50, $winpos[1]+10, @Desktopwidth, @Desktopheight)
    while not _ispressed(01)
    $mousepos = mousegetpos()
    $winpos = wingetpos($Winname)
    winmove($winname, "",$winpos[0], $winpos[1] , $mousepos[0]-($winpos[0]-20), $mousepos[1]-($winpos[1]-20))
    ToolTip($winpos[2]&"/"&$winpos[3]-20, $mousepos[0], $mousepos[1])
    sleep(40)
    WEnd
    _mousetrap()
    ToolTip("")
    $numbercontrol = 1
    $winpos = wingetpos($Winname)
    guictrlsetstate($delwinbut, $GUI_ENABLE)
    guictrlsetstate($savebut, $GUI_ENABLE)
    guictrlsetstate($newinputbut, $GUI_ENABLE)
    guictrlsetstate($newlabelbut, $GUI_ENABLE)
    guictrlsetstate($newbutbut, $GUI_ENABLE)
    guictrlsetstate($newradiobut, $GUI_ENABLE)
    Else
    _removevar()
    EndIf
    EndFunc

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

    Func _newcontrol($type)
    $numbercontrol += 1
    $conname[$numbercontrol] = inputbox("Neues Control", "1. Geben sie den Control-Namen ein."&@CRLF&"2. Positionieren sie das Control."&@CRLF&"3. Verändern sie die Größe des Controls.")
    if $conname[$numbercontrol] <> "" Then
    $contype[$numbercontrol] = $type
    while _ispressed(01)
    WEnd
    $actpos = wingetpos($Winname)
    mousemove($actpos[0]+$winpos[2]/2, $actpos[1]+$actpos[3]/2, 0)
    switch $type
    Case 0
    $control[$numbercontrol] = guictrlcreateinput($conname[$numbercontrol], 0, 0, 100, 30)
    Case 1
    $control[$numbercontrol] = guictrlcreatebutton($conname[$numbercontrol], 0, 0, 100, 30)
    Case 2
    $control[$numbercontrol] = guictrlcreatelabel($conname[$numbercontrol], 0, 0, 100, 30)
    Case 3
    $control[$numbercontrol] = GUICtrlCreateRadio($conname[$numbercontrol], 0, 0, 100, 30)
    EndSwitch
    _mousetrap($actpos[0]+1, $actpos[1]+30, $actpos[0]+$actpos[2], $actpos[1]+$actpos[3])
    While not _ispressed(01)
    $mousepos = mousegetpos()
    guictrlsetpos($control[$numbercontrol], $mousepos[0]-$actpos[0]-101, $mousepos[1]-$actpos[1]-51)
    sleep(40)
    WEnd
    $tempconpos = controlgetpos($Winname, "", $control[$numbercontrol])
    $conpos[$numbercontrol][0] = $tempconpos[0]
    $conpos[$numbercontrol][1] = $tempconpos[1]
    while _ispressed(01)
    WEnd
    _mousetrap($conpos[$numbercontrol][0]+$actpos[0]+5, $conpos[$numbercontrol][1]+$actpos[1]+30, $actpos[0]+$actpos[2], $actpos[1]+$actpos[3])
    $actpos = wingetpos($Winname)
    While not _ispressed(01)
    $mousepos = mousegetpos()
    guictrlsetpos($control[$numbercontrol], $conpos[$numbercontrol][0], $conpos[$numbercontrol][1], $mousepos[0]-($actpos[0]+$conpos[$numbercontrol][0]), $mousepos[1]-($actpos[1]+$conpos[$numbercontrol][1]+20))
    sleep(40)
    WEnd
    _mousetrap()
    $tempconpos = controlgetpos($Winname, "", $control[$numbercontrol])
    $conpos[$numbercontrol][2] = $tempconpos[2]
    $conpos[$numbercontrol][3] = $tempconpos[3]
    Else
    $numbercontrol -= 1
    EndIf

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

    EndFunc

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

    Func _undo()
    if $numbercontrol > 1 Then
    guictrldelete($control[$numbercontrol])
    $conpos[$numbercontrol][0] = ""
    $conpos[$numbercontrol][1] = ""
    $conpos[$numbercontrol][2] = ""
    $conpos[$numbercontrol][3] = ""
    $conname[$numbercontrol] = ""
    $contype[$numbercontrol] = ""
    $numbercontrol -= 1
    Else
    MsgBox(0, "Error", "Nichts zu widerrufen!")
    EndIf
    EndFunc

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

    Func _saveau3()
    guisetstate(@SW_HIDE, $toolsGUI)
    guisetstate(@SW_HIDE, $newGUI)
    $fehler = 0
    $path = FileSaveDialog("Speichere *.au3...", @SCRIPTDIR&"\", "Autoit(*.au3)")
    if $path <> "" Then
    if stringright($path, 4) = ".au3" Then
    $newfile = fileopen($path, 10)
    if @error then $fehler = 1
    Else
    $path = $path&".au3"
    $newfile = fileopen($path, 10)
    if @error then $fehler = 1
    EndIf
    if not $fehler = 1 Then
    Global $genGUI = GUICreate("Erstelle Datei...", 300, 300, -1, $WS_EX_TOPMOST)
    $progress = guictrlcreateprogress(0, 20, 300, 50)
    GUICtrlCreateLabel("Aktuell: ", 0, 5, 40, 15)
    $aktuelllabel = guictrlcreatelabel("", 40, 5, 260, 15)
    $edit = guictrlcreateedit("Starte speichern...", 0, 75, 300, 195)
    guisetstate()
    $text = ""
    guictrlsetdata($aktuelllabel, "Erstelle Kopf...")
    guictrlsetdata($edit, guictrlread($edit)&@CRLF&"Erstelle Kopf...")
    $text = $text&"#include <GUIConstantsEx.au3>"&@CRLF
    $text = $text&"#include <WindowsConstants.au3>"&@CRLF
    guictrlsetdata($progress, 1)
    guictrlsetdata($edit, guictrlread($edit)&@CRLF&"Abgeschlossen!")
    guictrlsetdata($aktuelllabel, "Erstelle GUI...")
    $text = $text&"Dim $control["&$numbercontrol&"]"&@CRLF
    guictrlsetdata($edit, guictrlread($edit)&@CRLF&"Erstelle GUI...")
    $text = $text&"$Form = GUICreate('"&$winname&"',"&$winpos[2]&","&$winpos[3]-20&","&$winpos[0]&","&$winpos[1]&")"&@CRLF
    guictrlsetdata($progress, 50)
    guictrlsetdata($edit, guictrlread($edit)&@CRLF&"Abgeschlossen!")
    guictrlsetdata($aktuelllabel, "Lade GUIControls...")
    guictrlsetdata($edit, guictrlread($edit)&@CRLF&"Lade GUIControls...")
    For $x = 2 to $numbercontrol
    switch $contype[$x]
    Case 0
    $text = $text&"$control["&$x-1&"] = guictrlcreateinput('"&$conname[$x]&"', "&$conpos[$x][0]&", "&$conpos[$x][1]&", "&$conpos[$x][2]&", "&$conpos[$x][3]&")"&@CRLF
    Case 1
    $text = $text&"$control["&$x-1&"] = guictrlcreatebutton('"&$conname[$x]&"', "&$conpos[$x][0]&", "&$conpos[$x][1]&", "&$conpos[$x][2]&", "&$conpos[$x][3]&")"&@CRLF
    Case 2
    $text = $text&"$control["&$x-1&"] = guictrlcreatelabel('"&$conname[$x]&"', "&$conpos[$x][0]&", "&$conpos[$x][1]&", "&$conpos[$x][2]&", "&$conpos[$x][3]&")"&@CRLF
    Case 3
    $text = $text&"$control["&$x-1&"] = GUICtrlCreateRadio('"&$conname[$x]&"', "&$conpos[$x][0]&", "&$conpos[$x][1]&", "&$conpos[$x][2]&", "&$conpos[$x][3]&")"&@CRLF
    EndSwitch
    Next
    $text = $text&"GUISetState(@SW_SHOW)"&@CRLF
    $text = $text&" "&@CRLF
    guictrlsetdata($progress, 90)
    guictrlsetdata($edit, guictrlread($edit)&@CRLF&"Abgeschlossen!")
    guictrlsetdata($aktuelllabel, "Erstelle notwendigen Code...")
    guictrlsetdata($edit, guictrlread($edit)&@CRLF&"Erstelle notwendigen Code...")
    $text = $text&"While 1"&@CRLF
    $text = $text&@TAB&"$Msg = guigetmsg()"&@CRLF
    $text = $text&@TAB&"Switch $msg"&@CRLF
    $text = $text&@TAB&@TAB&"Case $GUI_EVENT_CLOSE"&@CRLF
    $text = $text&@TAB&@TAB&@TAB&"exit"&@CRLF
    $text = $text&@TAB&"Endswitch"&@CRLF
    $text = $text&"WEnd"&@CRLF
    guictrlsetdata($progress, 100)
    guictrlsetdata($edit, guictrlread($edit)&@CRLF&"Abgeschlossen!")
    guictrlsetdata($progress, 0)
    guictrlsetdata($edit, guictrlread($edit)&@CRLF&"Speichern...")
    guictrlsetdata($aktuelllabel, "Speichere...")
    FileWrite($newfile, $text)
    if not @error Then
    guictrlsetdata($progress, 100)
    guictrlsetdata($edit, guictrlread($edit)&@CRLF&"Datei erfolgreich erstellt!")
    guictrlsetdata($aktuelllabel, "Erfolgreich abgeschlossen!")
    $readybut = guictrlcreatebutton("Fertig", 250, 270, 50, 30)
    GUICtrlSetOnEvent($readybut, "_ready")
    Else
    MsgBox(0, "Error", "Ein Fehler beim Erstellen der Datei ist aufgetreten.")
    guictrlsetdata($aktuelllabel, "Fehlerbedingter Abbruch!")
    guictrlsetdata($edit, guictrlread($edit)&@CRLF&"Ein Fehler ist aufgetreten!")
    $readybut = guictrlcreatebutton("Fertig", 250, 270, 50, 30)
    GUICtrlSetOnEvent($readybut, "_ready")
    EndIf

    Else
    MsgBox(0, "Error", "Ein Fehler beim Erstellen der Datei ist aufgetreten.")
    EndIf

    Else
    guisetstate(@SW_SHOW, $toolsGUI)
    guisetstate(@SW_SHOW, $newGUI)
    EndIf

    Endfunc

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

    Func _ready()
    guidelete($genGUI)
    guisetstate(@SW_SHOW, $toolsGUI)
    guisetstate(@SW_SHOW, $newGUI)
    EndFunc

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

    Func _delwin()
    $del = MsgBox(4, "Altes GUI", "Altes GUI wirklich löschen?")
    if $del = 6 then
    guidelete($newGUI)
    _removevar()
    EndIf
    EndFunc

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

    Func _removevar()
    $winname = ""
    $numbercontrol = 0
    guictrlsetdata($item, " | | | | | ")
    guictrlsetstate($delwinbut, $GUI_DISABLE)
    guictrlsetstate($savebut, $GUI_DISABLE)
    guictrlsetstate($newinputbut, $GUI_DISABLE)
    guictrlsetstate($newlabelbut, $GUI_DISABLE)
    guictrlsetstate($newbutbut, $GUI_DISABLE)
    guictrlsetstate($newradiobut, $GUI_DISABLE)
    EndFunc

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

    Func _exit()
    if $winname <> "" Then
    $close = MsgBox(4, "Wirklich beenden?", "Es existiert noch ein neu erstelltes Fenster. Wirklich beenden?")
    if $close = 6 Then Exit
    Else
    Exit
    EndIf

    EndFunc

    [/autoit]

    MfG, Fresapore

  • Mein Guicreator...

    • Fresapore
    • 8. September 2010 um 17:02

    Thx @all für die positive Kritik,
    Der Inspektor sollte die Eigenschaften des mit der rechten Maustaste angeklickten Controls oder des Guis anzeigen....
    Das mit den Control ist auch nur noch geringer Aufwand, aber ich erstelle die persönlcih eigentlich immer im Sript nachher, das finde ich irgendwie einfacher.....

  • Mein Guicreator...

    • Fresapore
    • 7. September 2010 um 22:40

    Hi Forum!
    Hier wollte ich mal mein kleines Script, einen funktionsbeschränkten Guicreator vorstellen.
    Er wäre problemlos zu erweitern, allerdings ging es mir nur ums Prinzip.
    Ich weiß, dass es (fast) vollwertige Formdesigner wie Koda bereits gibt,
    ich fand nur die Idee ganz witzig, auch mal einen zu erstellen...
    Das Design und die Funktionsart habe ich von einem
    auf Youtube vorgestellten Formdesigner(hier zu sehen) übernommen, das Script allerdings vollständig alleine erstellt...
    Kommentiert habe ich eher wenig, aber ich denke, das Script sollte verständlich sein.. ;)
    Ich würde einfach gerne eure Meinungen/Verbesserungen/Kritik dazu hören ;)

    Spoiler anzeigen
    [autoit]

    #include <Misc.au3>
    #include <WindowsConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <GuiListView.au3>
    #include <File.au3>
    #Include <GuiEdit.au3>
    Opt("GUIOnEventMode", 1)

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

    ;Deklarationsteil---------------
    Global $pathcha = @SCRIPTDIR&"\changeslog.au3"
    Global $toolwidth = 200
    Global $toolheight = 200
    global $inspwidth = 500
    Global $inspheight = 50
    Global $toolname = "Werkzeuge"
    Global $winname
    Global $Winpos[4]
    Global $newGUI
    Global $text
    Global $numbercontrol = 0
    Global $control[99]
    Global $conname[99]
    Global $contype[99]
    Global $conpos[99][4]
    ;-------------------------------

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

    ;GUIteil------------------------
    ;ToolGUI------------------------
    Global $toolsgui = GUICreate($toolname, $toolwidth, $toolheight, @DesktopWidth/2)
    Global $newwinbut = guictrlcreatebutton("Neues Fenster", 0, 0, $toolwidth/2, $toolheight/5)
    Global $delwinbut = guictrlcreatebutton("Fenster löschen", $toolwidth/2, 0, $toolwidth/2, $toolheight/5)
    guictrlsetstate(-1, $GUI_DISABLE)
    Global $newinputbut = guictrlcreatebutton("Neuer Input", 0, $toolheight/5, $toolwidth/2, $toolheight/5)
    guictrlsetstate(-1, $GUI_DISABLE)
    Global $newlabelbut = guictrlcreatebutton("Neuer Label", $toolwidth/2, $toolheight/5, $toolwidth/2, $toolheight/5)
    guictrlsetstate(-1, $GUI_DISABLE)
    Global $newbutbut = guictrlcreatebutton("Neuer Button", 0, $toolheight/5*2, $toolwidth/2, $toolheight/5)
    guictrlsetstate(-1, $GUI_DISABLE)
    Global $newradiobut = guictrlcreatebutton("Neuer Radiobutton", $toolwidth/2, $toolheight/5*2, $toolwidth/2, $toolheight/5)
    guictrlsetstate(-1, $GUI_DISABLE)
    Global $undobut = guictrlcreatebutton("Rückgängig", 0, $toolheight/5*3, $toolwidth/2, $toolheight/5)
    Global $savebut = guictrlcreatebutton("Als *.au3 speichern", $toolwidth/2, $toolheight/5*3, $toolwidth/2, $toolheight/5)
    guictrlsetstate(-1, $GUI_DISABLE)
    Global $infobut = GUICtrlCreateButton("Informationen", 0, $toolheight/5*4, $toolwidth/2, $toolheight/5)
    Global $helpbut = GUICtrlCreateButton("Hilfe", $toolwidth/2, $toolheight/5*4, $toolwidth/2, $toolheight/5)
    guisetstate()
    guisetonevent($GUI_EVENT_CLOSE, "_exit")
    GUICtrlSetOnEvent($newwinbut, "_testwin")
    GUICtrlSetOnEvent($delwinbut, "_delwin")
    GUICtrlSetOnEvent($savebut, "_saveau3")
    GUICtrlSetOnEvent($newinputbut, "_newinput")
    GUICtrlSetOnEvent($newbutbut, "_newbut")
    GUICtrlSetOnEvent($newlabelbut, "_newlabel")
    GUICtrlSetOnEvent($newradiobut, "_newradio")
    GUICtrlSetOnEvent($undobut, "_undo")
    GUICtrlSetOnEvent($infobut, "_getinfo")
    GUICtrlSetOnEvent($helpbut, "_gethelp")
    ;-------------------------------
    global $inspektorgui = guicreate("Inspektor", $inspwidth, $inspheight, @DESKTOPWIDTH/2-$inspwidth)
    Global $changeslist = guictrlcreatelistview("Name|Typ|X-Koord.|Y-Koord.|Breite|Höhe", 0,0, $inspwidth, $inspheight)
    Global $item = guictrlcreatelistviewitem(" | | | | | ", -1)
    ;Global $changebut = GUICtrlCreateButton("Ändern", $inspwidth-100, 0, 100, $inspheight)
    guisetstate()
    guisetonevent($GUI_EVENT_CLOSE, "_exit")

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

    while 1
    if _ispressed(02) then
    $cmsg = GUIGetCursorInfo()
    if not @error and IsArray($cmsg) Then
    if winactive($winname) Then
    if $cmsg[4] = 0 Then
    GUICtrlSetData($item, $Winname&"|"&"GUI"&"|"&$Winpos[0]&"|"&$winpos[1]&"|"&$Winpos[2]&"|"&$Winpos[3])
    EndIf
    For $y = 2 to $numbercontrol
    if $cmsg[0] > $conpos[$y][0] and $cmsg[0] < $conpos[$y][0]+$conpos[$y][2] and $cmsg[1] > $conpos[$y][1] and $cmsg[1] < $conpos[$y][1]+$conpos[$y][3] Then
    GUICtrlSetData($item, $conname[$y]&"|"&$contype[$y]&"|"&$conpos[$y][0]&"|"&$conpos[$y][1]&"|"&$conpos[$y][2]&"|"&$conpos[$y][3])
    EndIf
    Next
    EndIf
    EndIf
    Do
    Until not _ispressed(02)
    sleep(40)
    EndIf
    WEnd
    Func _newinput()
    _newcontrol(0)
    EndFunc
    Func _newbut()
    _newcontrol(1)
    EndFunc
    Func _newlabel()
    _newcontrol(2)
    EndFunc
    Func _newradio()
    _newcontrol(3)
    EndFunc
    Func _checkfocus()

    EndFunc

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

    Func _gethelp()
    MsgBox(0, "Hilfe", "Zum Erstellen eines neuen Fensters einfach auf 'Neues Fenster' drücken."&@CRLF&"Dort den gewünschten Namen eingeben und das Fenster durch Bewegen mit der Maus positionieren. Anschliessend einfach klicken."&@CRLF&@TAB&"ACHTUNG: Nachfolgendes Verschieben hat keinen Effekt mehr auf die festgelegte Position!"&@CRLF&"Die Größe des Fensters durch Bewegen mit der Maus definieren. Anschliessend einfach klicken."&@CRLF&"Erst dann können die vier zur Auswahl stehenden Controls auf die gleiche Weise erstellt werden."&@CRLF&"Mit Rechtsklick auf das jeweilige Control lassen sich die Werte im Inspektor ansehen."&@CRLF&" "&@CRLF&"Wenn das GUI fertig erstellt ist, einfach auf 'Als *.au3 speichern' klicken, und den gewünschten Speicherort/namen eingeben.")
    EndFunc
    Func _getinfo()
    if $winname <> "" Then
    $infotext = ""
    $infotext = $infotext&"Aktueller GUI-Titel: "&$Winname&@CRLF
    $infotext = $infotext&"Anzahl Controls: "&$numbercontrol-1&@CRLF
    $infotext = $infotext&@TAB&"Einzelinformationen: "&@CRLF
    for $z = 2 to $numbercontrol
    $infotext = $infotext&@TAB&@TAB&$z-1&"."&@CRLF
    $infotext = $infotext&@TAB&@TAB&"Name: "&$conname[$z]&@CRLF
    Switch $contype[$z]
    case 0
    $infotext = $infotext&@TAB&@TAB&"Typ: "&"Input"&@CRLF
    Case 1
    $infotext = $infotext&@TAB&@TAB&"Typ: "&"Button"&@CRLF
    Case 2
    $infotext = $infotext&@TAB&@TAB&"Typ: "&"Label"&@CRLF
    Case 3
    $infotext = $infotext&@TAB&@TAB&"Typ: "&"Radiobutton"&@CRLF
    EndSwitch
    $infotext = $infotext&@TAB&@TAB&"Abmessungen: X-Pos.: "&$conpos[$z][0]&" Y-Pos.: "&$conpos[$z][1]&" Länge: "&$conpos[$z][2]&" Höhe: "&$conpos[$z][3]&@CRLF
    $infotext = $infotext&@TAB&@TAB&" "&@CRLF
    Next
    MsgBox(0, "Informationen", $infotext)
    Else
    MsgBox(0, "Informationen", "Noch kein Fenster erstellt.")
    EndIf
    EndFunc

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

    Func _testwin()
    if $winname <> "" Then
    $del = MsgBox(4, "Altes GUI", "Altes GUI überschreiben?")
    if $del = 6 then
    guidelete($newGUI)
    $numbercontrol = 0
    _newwin()
    EndIf
    Else
    _newwin()
    EndIf

    EndFunc

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

    Func _newwin()
    $Winname = inputbox("Neues Fenster", "1. Geben sie den Fenster-Namen ein."&@CRLF&"2. Positionieren sie das Fenster."&@CRLF&"3. Verändern sie die Größe des Fensters.")
    if $Winname <> "" Then
    $newGUI = GUICreate($winname, 150, 150)
    guisetstate()
    while not _ispressed(01)
    $mousepos = mousegetpos()
    $winpos = wingetpos($Winname)
    winmove($winname, "", $mousepos[0]-150, $mousepos[1]-170)
    ToolTip($winpos[0]&"/"&$winpos[1], $mousepos[0], $mousepos[1])
    sleep(40)
    WEnd
    $winpos = wingetpos($Winname)
    while _ispressed(01)
    WEnd
    _MouseTrap($winpos[0]+50, $winpos[1]+10, @Desktopwidth, @Desktopheight)
    while not _ispressed(01)
    $mousepos = mousegetpos()
    $winpos = wingetpos($Winname)
    winmove($winname, "",$winpos[0], $winpos[1] , $mousepos[0]-($winpos[0]-20), $mousepos[1]-($winpos[1]-20))
    ToolTip($winpos[2]&"/"&$winpos[3]-20, $mousepos[0], $mousepos[1])
    sleep(40)
    WEnd
    _mousetrap()
    ToolTip("")
    $numbercontrol = 1
    $winpos = wingetpos($Winname)
    guictrlsetstate($delwinbut, $GUI_ENABLE)
    guictrlsetstate($savebut, $GUI_ENABLE)
    guictrlsetstate($newinputbut, $GUI_ENABLE)
    guictrlsetstate($newlabelbut, $GUI_ENABLE)
    guictrlsetstate($newbutbut, $GUI_ENABLE)
    guictrlsetstate($newradiobut, $GUI_ENABLE)
    Else
    _removevar()
    EndIf
    EndFunc

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

    Func _newcontrol($type)
    $numbercontrol += 1
    $conname[$numbercontrol] = inputbox("Neues Control", "1. Geben sie den Control-Namen ein."&@CRLF&"2. Positionieren sie das Control."&@CRLF&"3. Verändern sie die Größe des Controls.")
    if $conname[$numbercontrol] <> "" Then
    $contype[$numbercontrol] = $type
    while _ispressed(01)
    WEnd
    $actpos = wingetpos($Winname)
    mousemove($actpos[0]+$winpos[2]/2, $actpos[1]+$actpos[3]/2, 0)
    switch $type
    Case 0
    $control[$numbercontrol] = guictrlcreateinput($conname[$numbercontrol], 0, 0, 100, 30)
    Case 1
    $control[$numbercontrol] = guictrlcreatebutton($conname[$numbercontrol], 0, 0, 100, 30)
    Case 2
    $control[$numbercontrol] = guictrlcreatelabel($conname[$numbercontrol], 0, 0, 100, 30)
    Case 3
    $control[$numbercontrol] = GUICtrlCreateRadio($conname[$numbercontrol], 0, 0, 100, 30)
    EndSwitch
    _mousetrap($actpos[0]+1, $actpos[1]+30, $actpos[0]+$actpos[2], $actpos[1]+$actpos[3])
    While not _ispressed(01)
    $mousepos = mousegetpos()
    guictrlsetpos($control[$numbercontrol], $mousepos[0]-$actpos[0]-101, $mousepos[1]-$actpos[1]-51)
    sleep(40)
    WEnd
    $tempconpos = controlgetpos($Winname, "", $control[$numbercontrol])
    $conpos[$numbercontrol][0] = $tempconpos[0]
    $conpos[$numbercontrol][1] = $tempconpos[1]
    while _ispressed(01)
    WEnd
    _mousetrap($conpos[$numbercontrol][0]+$actpos[0]+5, $conpos[$numbercontrol][1]+$actpos[1]+30, $actpos[0]+$actpos[2], $actpos[1]+$actpos[3])
    $actpos = wingetpos($Winname)
    While not _ispressed(01)
    $mousepos = mousegetpos()
    guictrlsetpos($control[$numbercontrol], $conpos[$numbercontrol][0], $conpos[$numbercontrol][1], $mousepos[0]-($actpos[0]+$conpos[$numbercontrol][0]), $mousepos[1]-($actpos[1]+$conpos[$numbercontrol][1]+20))
    sleep(40)
    WEnd
    _mousetrap()
    $tempconpos = controlgetpos($Winname, "", $control[$numbercontrol])
    $conpos[$numbercontrol][2] = $tempconpos[2]
    $conpos[$numbercontrol][3] = $tempconpos[3]
    Else
    $numbercontrol -= 1
    EndIf

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

    EndFunc

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

    Func _undo()
    if $numbercontrol > 1 Then
    guictrldelete($control[$numbercontrol])
    $conpos[$numbercontrol][0] = ""
    $conpos[$numbercontrol][1] = ""
    $conpos[$numbercontrol][2] = ""
    $conpos[$numbercontrol][3] = ""
    $conname[$numbercontrol] = ""
    $contype[$numbercontrol] = ""
    $numbercontrol -= 1
    Else
    MsgBox(0, "Error", "Nichts zu widerrufen!")
    EndIf
    EndFunc

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

    Func _saveau3()
    guisetstate(@SW_HIDE, $toolsGUI)
    guisetstate(@SW_HIDE, $newGUI)
    $fehler = 0
    $path = FileSaveDialog("Speichere *.au3...", @SCRIPTDIR&"\", "Autoit(*.au3)")
    if $path <> "" Then
    if stringright($path, 4) = ".au3" Then
    $newfile = fileopen($path, 10)
    if @error then $fehler = 1
    Else
    $path = $path&".au3"
    $newfile = fileopen($path, 10)
    if @error then $fehler = 1
    EndIf
    if not $fehler = 1 Then
    Global $genGUI = GUICreate("Erstelle Datei...", 300, 300, -1, $WS_EX_TOPMOST)
    $progress = guictrlcreateprogress(0, 20, 300, 50)
    GUICtrlCreateLabel("Aktuell: ", 0, 5, 40, 15)
    $aktuelllabel = guictrlcreatelabel("", 40, 5, 260, 15)
    $edit = guictrlcreateedit("Starte speichern...", 0, 75, 300, 195)
    guisetstate()
    $text = ""
    guictrlsetdata($aktuelllabel, "Erstelle Kopf...")
    guictrlsetdata($edit, guictrlread($edit)&@CRLF&"Erstelle Kopf...")
    $text = $text&"#include <GUIConstantsEx.au3>"&@CRLF
    $text = $text&"#include <WindowsConstants.au3>"&@CRLF
    guictrlsetdata($progress, 1)
    guictrlsetdata($edit, guictrlread($edit)&@CRLF&"Abgeschlossen!")
    guictrlsetdata($aktuelllabel, "Erstelle GUI...")
    guictrlsetdata($edit, guictrlread($edit)&@CRLF&"Erstelle GUI...")
    $text = $text&"$Form = GUICreate('"&$winname&"',"&$winpos[2]&","&$winpos[3]-20&","&$winpos[0]&","&$winpos[1]&")"&@CRLF
    guictrlsetdata($progress, 50)
    guictrlsetdata($edit, guictrlread($edit)&@CRLF&"Abgeschlossen!")
    guictrlsetdata($aktuelllabel, "Lade GUIControls...")
    guictrlsetdata($edit, guictrlread($edit)&@CRLF&"Lade GUIControls...")
    For $x = 2 to $numbercontrol
    switch $contype[$x]
    Case 0
    $text = $text&"guictrlcreateinput('"&$conname[$x]&"', "&$conpos[$x][0]&", "&$conpos[$x][1]&", "&$conpos[$x][2]&", "&$conpos[$x][3]&")"&@CRLF
    Case 1
    $text = $text&"guictrlcreatebutton('"&$conname[$x]&"', "&$conpos[$x][0]&", "&$conpos[$x][1]&", "&$conpos[$x][2]&", "&$conpos[$x][3]&")"&@CRLF
    Case 2
    $text = $text&"guictrlcreatelabel('"&$conname[$x]&"', "&$conpos[$x][0]&", "&$conpos[$x][1]&", "&$conpos[$x][2]&", "&$conpos[$x][3]&")"&@CRLF
    Case 3
    $text = $text&"GUICtrlCreateRadio('"&$conname[$x]&"', "&$conpos[$x][0]&", "&$conpos[$x][1]&", "&$conpos[$x][2]&", "&$conpos[$x][3]&")"&@CRLF
    EndSwitch
    Next
    $text = $text&"GUISetState(@SW_SHOW)"&@CRLF
    $text = $text&" "&@CRLF
    guictrlsetdata($progress, 90)
    guictrlsetdata($edit, guictrlread($edit)&@CRLF&"Abgeschlossen!")
    guictrlsetdata($aktuelllabel, "Erstelle notwendigen Code...")
    guictrlsetdata($edit, guictrlread($edit)&@CRLF&"Erstelle notwendigen Code...")
    $text = $text&"While 1"&@CRLF
    $text = $text&@TAB&"$Msg = guigetmsg()"&@CRLF
    $text = $text&@TAB&"Switch $msg"&@CRLF
    $text = $text&@TAB&@TAB&"Case $GUI_EVENT_CLOSE"&@CRLF
    $text = $text&@TAB&@TAB&@TAB&"exit"&@CRLF
    $text = $text&@TAB&"Endswitch"&@CRLF
    $text = $text&"WEnd"&@CRLF
    guictrlsetdata($progress, 100)
    guictrlsetdata($edit, guictrlread($edit)&@CRLF&"Abgeschlossen!")
    guictrlsetdata($progress, 0)
    guictrlsetdata($edit, guictrlread($edit)&@CRLF&"Speichern...")
    guictrlsetdata($aktuelllabel, "Speichere...")
    FileWrite($newfile, $text)
    if not @error Then
    guictrlsetdata($progress, 100)
    guictrlsetdata($edit, guictrlread($edit)&@CRLF&"Datei erfolgreich erstellt!")
    guictrlsetdata($aktuelllabel, "Erfolgreich abgeschlossen!")
    $readybut = guictrlcreatebutton("Fertig", 250, 270, 50, 30)
    GUICtrlSetOnEvent($readybut, "_ready")
    Else
    MsgBox(0, "Error", "Ein Fehler beim Erstellen der Datei ist aufgetreten.")
    guictrlsetdata($aktuelllabel, "Fehlerbedingter Abbruch!")
    guictrlsetdata($edit, guictrlread($edit)&@CRLF&"Ein Fehler ist aufgetreten!")
    $readybut = guictrlcreatebutton("Fertig", 250, 270, 50, 30)
    GUICtrlSetOnEvent($readybut, "_ready")
    EndIf

    Else
    MsgBox(0, "Error", "Ein Fehler beim Erstellen der Datei ist aufgetreten.")
    EndIf

    Else
    guisetstate(@SW_SHOW, $toolsGUI)
    guisetstate(@SW_SHOW, $newGUI)
    EndIf

    Endfunc

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

    Func _ready()
    guidelete($genGUI)
    guisetstate(@SW_SHOW, $toolsGUI)
    guisetstate(@SW_SHOW, $newGUI)
    EndFunc

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

    Func _delwin()
    $del = MsgBox(4, "Altes GUI", "Altes GUI wirklich löschen?")
    if $del = 6 then
    guidelete($newGUI)
    _removevar()
    EndIf
    EndFunc

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

    Func _removevar()
    $winname = ""
    $numbercontrol = 0
    guictrlsetdata($item, " | | | | | ")
    guictrlsetstate($delwinbut, $GUI_DISABLE)
    guictrlsetstate($savebut, $GUI_DISABLE)
    guictrlsetstate($newinputbut, $GUI_DISABLE)
    guictrlsetstate($newlabelbut, $GUI_DISABLE)
    guictrlsetstate($newbutbut, $GUI_DISABLE)
    guictrlsetstate($newradiobut, $GUI_DISABLE)
    EndFunc

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

    Func _exit()
    if $winname <> "" Then
    $close = MsgBox(4, "Wirklich beenden?", "Es existiert noch ein neu erstelltes Fenster. Wirklich beenden?")
    if $close = 6 Then Exit
    Else
    Exit
    EndIf

    EndFunc

    [/autoit]


    MfG, Fresapore

    P.S. Das Gui, das beim Erstellen den *.au3 Datei zu sehen ist, war mehr so zum Spaß, weil es toller aussieht :D

  • ListView Problem

    • Fresapore
    • 9. Juli 2010 um 16:49

    Aber warum denn so, wo doch, wie oscar gesagt hat, mit

    [autoit]

    _arraysort($array, 1)

    [/autoit]

    in absteigender Reihenfolge sortiert wird?

  • ListView Problem

    • Fresapore
    • 5. Juli 2010 um 23:17

    Ich bin jetzt nicht soo der, der viel Ahnung hat,
    aber kann das nicht daran liegen, dass $LBS_SORT ein Standadstil ist, den du nicht deaktiviert hast?

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™