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

Beiträge von Nestos

  • Nervig aber wahr :D

    • Nestos
    • 16. Mai 2010 um 11:49

    Müsst ihr reden.
    Ihr spammt alles voll und dann meint ihr, EM ist ein Spamer?
    Es gibt so komische Leute mit ihren Vorstellungen. :rolleyes:

  • GDI+ Partikelexplosion

    • Nestos
    • 16. Mai 2010 um 00:04

    Ersetz Zeile 21 mal so:

    [autoit]

    $hWnd = GUICreate("Particles", $iGUIWidth, $iGUIHeight, 0, 0, $WS_POPUP, $WS_EX_TOPMOST)

    [/autoit]

    Ansonsten ist sie nicht im Vordergrund, und füllt nicht die ganze Fläche aus. ;)

  • Datei aus Inputfeld erzeugen

    • Nestos
    • 15. Mai 2010 um 21:19

    Und was ist mit mir? :rofl:
    Ich bin auch nicht viel älter und hab die OwnStyle UDF geschrieben.

    *Werbung mach*

  • GDI+ Domino-Zelda

    • Nestos
    • 15. Mai 2010 um 17:11

    Ich schreib dir mal die Münzen in GDI+. ;)

    Edit: Gesagt, getahn:

    Spoiler anzeigen
    [autoit]

    #include <GDIPlus.au3>
    #include <Misc.au3>

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

    Global $hWnd, $hGraphic, $hBitmap, $backbuffer
    Global $ScreenDc, $dc, $tSize, $pSize, $tSource, $pSource, $tBlend, $pBlend, $tPoint, $pPoint, $gdibitmap
    Global $hFormat, $hFamily, $hFont, $tLayout, $aInfo
    Global $brush1, $brush2, $brush3
    Global $title = "GDI+ Münze", _
    $user32 = DllOpen("user32.dll"), _
    $width = 25, _
    $height = 25
    Global $MousePos

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

    _Startup()
    _Draw()
    _Update()

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

    While 1
    $MousePos = MouseGetPos()
    WinMove($title, "", $MousePos[0], $MousePos[1])
    If _IsPressed("1B", $user32) And _IsPressed("A2", $user32) Then _Close()
    Sleep(10)
    WEnd

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

    Func _Draw()
    _GDIPlus_GraphicsFillEllipse($backbuffer, 0, 0, 24, 24, $brush2)
    _GDIPlus_GraphicsFillEllipse($backbuffer, 1, 1, 21, 21, $brush1)
    _GDIPlus_GraphicsDrawStringEx($backbuffer, "$", $hFont, $aInfo[0], $hFormat, $brush3)
    _GDIPlus_BrushDispose($brush1)
    _GDIPlus_BrushDispose($brush2)
    _GDIPlus_BrushDispose($brush3)
    EndFunc

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

    Func _Update()
    $gdibitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap)
    _WinAPI_SelectObject($dc, $gdibitmap)
    _WinAPI_UpdateLayeredWindow($hWnd, $ScreenDc, 0, $pSize, $dc, $pSource, 0, $pBlend, 2)
    _WinAPI_DeleteObject($gdibitmap)
    EndFunc

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

    Func _StartUp()
    _GDIPlus_Startup()
    $hWnd = GUICreate($title, $width, $height, -1, -1, 0x80000000, BitOR(0x00000080, 0x00080000, 0x00000008))
    $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hWnd)
    $hBitmap = _GDIPlus_BitmapCreateFromGraphics($width, $height, $hGraphic)
    $backbuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap)
    _GDIPlus_GraphicsSetSmoothingMode($backbuffer, 4)

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

    $hFormat = _GDIPlus_StringFormatCreate(0x1000)
    _GDIPlus_StringFormatSetAlign($hFormat, 1)
    $hFamily = _GDIPlus_FontFamilyCreate("Book Antiqua")
    $hFont = _GDIPlus_FontCreate($hFamily, 22, 1, 2)
    $tLayout = _GDIPlus_RectFCreate(1, -1, 25, 25)
    $aInfo = _GDIPlus_GraphicsMeasureString($backbuffer, "$", $hFont, $tLayout, $hFormat)

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

    $brush1 = _GDIPlus_BrushCreateLinear(0, 0, 24, 24, 0xFFCE9900, 0xFFF8D114)
    $brush2 = _GDIPlus_BrushCreateLinear(0, 0, 24, 24, 0xFFF8D114, 0xFFCE9900)
    $brush3 = _GDIPlus_BrushCreateLinear(0, 0, 24, 24, 0xAFFFFFFF, 0x40FFFFFF)

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

    $ScreenDc = _WinAPI_GetDC($hWnd)
    $dc = _WinAPI_CreateCompatibleDC($ScreenDc)

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

    $tSize = DllStructCreate($tagSIZE)
    $pSize = DllStructGetPtr($tSize)
    DllStructSetData($tSize, "X", $width)
    DllStructSetData($tSize, "Y", $height)
    $tSource = DllStructCreate($tagPOINT)
    $pSource = DllStructGetPtr($tSource)
    $tBlend = DllStructCreate($tagBLENDFUNCTION)
    $pBlend = DllStructGetPtr($tBlend)
    DllStructSetData($tBlend, "Alpha", 255)
    DllStructSetData($tBlend, "Format", 1)
    $tPoint = DllStructCreate($tagPOINT)
    $pPoint = DllStructGetPtr($tPoint)
    DllStructSetData($tPoint, "X", 0)
    DllStructSetData($tPoint, "Y", 0)

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

    _GDIPlus_GraphicsClear($backbuffer, 0x00000000)
    GUISetState()
    EndFunc

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

    Func _GDIClose()
    _GDIPlus_GraphicsDispose($backbuffer)
    _GDIPlus_BitmapDispose($hBitmap)
    _GDIPlus_GraphicsDispose($hGraphic)
    _GDIPlus_Shutdown()
    EndFunc

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

    Func _Close()
    DllClose($user32)
    GUISetState(@SW_MINIMIZE, $hWnd)
    Exit
    EndFunc

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

    Func _GDIPlus_BrushCreateLinear($iX1, $iY1, $iX2, $iY2, $iARGB1 = 0xFF000000, $iARGB2 = 0xFFFFFFFF)
    Local $aResult, $start, $end, $sPoint, $ePoint

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

    $start = DllStructCreate("int X;int Y")
    DllStructSetData($start, "X", $iX1)
    DllStructSetData($start, "Y", $iY1)
    $sPoint = DllStructGetPtr($start)

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

    $end = DllStructCreate("int X;int Y")
    DllStructSetData($end, "X", $iX2)
    DllStructSetData($end, "Y", $iY2)
    $ePoint = DllStructGetPtr($end)

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

    $aResult = DllCall($ghGDIPDll, "int", "GdipCreateLineBrushI", "ptr", $sPoint, "ptr", $ePoint, "int", $iARGB1, "int", $iARGB2, "int", 0, "int*", 0)
    If @error Then Return SetError(@error, @extended, 0)

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

    Return SetError(0, $aResult[0], $aResult[6])
    EndFunc ;==>_GDIPlus_BrushCreateLinear

    [/autoit]
  • GDI+ Domino-Zelda

    • Nestos
    • 15. Mai 2010 um 16:09

    Ich versteh nicht, warum du so viele Bilder machst. ^^

    Man könnte das locker mit GDI+ machen. ;)

  • Letzte Erinnerung - Die Rache der verlorenen Seelen [2D-RPG]

    • Nestos
    • 15. Mai 2010 um 11:25

    Ich hätte dich in Skype schon geaddet, bekomm aber keine Antwort. ;)

    Hast ne PN.

  • Letzte Erinnerung - Die Rache der verlorenen Seelen [2D-RPG]

    • Nestos
    • 15. Mai 2010 um 10:57

    Brauchst du meine Hilfe überhaupt noch? ^^

  • (kleine) Konsole

    • Nestos
    • 14. Mai 2010 um 21:48

    Ich bin gerade dabei, dei HELP Funktion so umzuschreiben, damit man die Befehle so: FILE MOVE, FILE CREATE strukturieren kann. ;)

  • (kleine) Konsole

    • Nestos
    • 14. Mai 2010 um 15:13

    Ich habe ein File Move schon eingebaut. ;)

    Und wie ich bereits gesagt habe, solltest du die File Befehle so anordnen:
    File Move "test.txt" "test\"

    So ist es viel übersichtlicher, und du hast nicht soviele Befehle. ^^

    Edit: Und natürlich darfst du die Funktionen übernehmen, für was hab ich sie denn sonst gemacht? ^^

  • Wie unterlege ich Button mit einer Funktion?

    • Nestos
    • 14. Mai 2010 um 11:41

    Dann hättest du ein anderes Beispiel nehmen sollen.

    Nun ich bin mal nicht so:

    [autoit]

    GUICtrlCreateCheckbox()

    [/autoit]

    Ich glaube, dass ist was du suchst. ^^

  • Wie unterlege ich Button mit einer Funktion?

    • Nestos
    • 14. Mai 2010 um 11:35

    Forenregeln

    Hacks für Spiele werden hier nicht unterstüzt.

  • GDI+ Domino-Zelda

    • Nestos
    • 14. Mai 2010 um 11:03

    Das würde dann aber ausschauen, als ob man da raus gehen könnte. ;)
    Einfacher wärs abe gewesen, wenn du nur ein kleines Bild vom Baum genommen hättest, und damit dann einfach den Rand gezeichnet hättest.

  • GDI+ Domino-Zelda

    • Nestos
    • 14. Mai 2010 um 10:39

    Gute Idee, gute Umsetzung. ^^

    Mir sind ein paar Sachen aufgefallen:

    Man kann Diagonal gehen, hat aber keine Sprites dafür.
    Wenn man über die Münzen geht, blinken die bereits eingesammelten wieder auf.
    Du hast die Münzenanzahl mit Bilder gemacht, warum nicht einfach mit

    [autoit]

    _GDIPlus_GraphicsDrawString()
    ;oder
    _GDIPlus_GraphicsDrawStringEx()

    [/autoit]

    ?

  • Kriege einfachen Script nicht nicht hin :(

    • Nestos
    • 14. Mai 2010 um 02:59
    [autoit]

    WinClose( "title")
    Sleep(100)
    Send("{LEFT}{ENTER}"

    [/autoit]

    Müsste seinen Zweck erfüllen. :)

  • Kriege einfachen Script nicht nicht hin :(

    • Nestos
    • 14. Mai 2010 um 02:51

    Du musst den gesamten Pfad angeben
    zB:

    [autoit]

    Run("C:\Programme\sea_nulled_1.0.3.exe")

    [/autoit]

    Für das andere beschäftig dich mal mit

    [autoit]

    MouseClick()

    [/autoit]

    Forenregeln - Nur mal vorsichtshalber

  • (kleine) Konsole

    • Nestos
    • 14. Mai 2010 um 01:02

    Ich würd die Befehle wie CREATE_FILE eher nur mit dem Befehl FILE machen und den ersten Parameter für CREATE oder MOVE verwenden.
    Außerdem ist beim FileCreate keine richtige Error Abfrage. ;)

    Aber ansonsten zwei nette Funktionen.

    Edit:
    $WS_EX_Composited sorgt dafür, dass die GUI nicht flackert. ;)

    Edit2:
    So hab die Konsole nochmal überarbeitet und eine neue Funktion CD hinzugefügt.

    Spoiler anzeigen
    [autoit]

    #include <Misc.au3>
    #include <Array.au3>
    #include <WindowsConstants.au3>
    #include <EditConstants.au3>
    #include <File.au3>

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

    Opt("GUIOnEventMode", 1)

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

    Global $Console, $CurCommand, $Read, $Commands[8], $CommandsDis[8], $Right, $CurCommandParameters, $CurCommandString, $CurPath = @ScriptDir
    Global $dll = DllOpen("user32.dll")
    Global $title = "Console"

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

    $Commands[0] = "HELP"
    $Commands[1] = "EXIT"
    $Commands[2] = "MSGBOX"
    $Commands[3] = "CLEAR"
    $Commands[4] = "COLOUR"
    $Commands[5] = "HIDE"
    $Commands[6] = "FILE"
    $Commands[7] = "CD"

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

    $CommandsDis[0] = "Shows a List of all commands/E/tParameter 1 = Command (optional)"
    $CommandsDis[1] = "Exit the console"
    $CommandsDis[2] = "Shows a massage/E/tParameter 1 = Flag/E/tParameter 2 = Title (string)/E/tParameter 3 = Text (string)"
    $CommandsDis[3] = "Clears the Console"
    $CommandsDis[4] = "Changes the font and background colour/E/tParameter 1 = font colour (HEX)/E/tParameter 2 = background colour (HEX) (optional)"
    $CommandsDis[5] = "Hides the Console until its activated again/E/tParameter 1 = Sleeptime in ms"
    $CommandsDis[6] = "CREATE/tCreates a file or overwrites a existing File/E/t/tParameter 1 = Filepath (string)/E/tMOVE/tMoves a File/E/t/tParameter 1 = Filepath (string)/E/t/tParameter 2 = Movepath (string)"
    $CommandsDis[7] = "Changes the directory/E/tParameter 1 = New directory"

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

    $Console = _ConsoleCreate($title)
    _ConsoleWrite($Console, "Welcome/EThis is a Console example from http://www.AutoIt.de/E")

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

    While 1
    If _IsPressed("0D", $dll) And WinActive($title) Then
    $array = StringSplit(GUICtrlRead($Console[1]), @CRLF)
    $CurCommand = $array[Ubound($array) - 1]
    $CurCommandParameters = StringSplit($CurCommand, " ")
    $CurCommandString = StringSplit($CurCommand, '"')
    For $i = 1 To $array[0] - 1 Step 2
    $Read &= $array[$i] & @CRLF
    Next
    GUICtrlSetData($Console[1], $Read & $CurPath & "> " & $CurCommand & @CRLF)
    For $i = 0 To UBound($Commands) - 1
    If $CurCommandParameters[1] = $Commands[$i] Then
    Call("_ConsoleCommand_" & $Commands[$i])
    $Right = True
    ExitLoop
    Else
    $Right = False
    EndIf
    Next
    If Not $Right Then
    _ConsoleWrite($Console, "unknown Command/EType HELP to list all commands")
    EndIf
    While _IsPressed("0D", $dll) And WinActive($title)
    Sleep(100)
    WEnd
    $Read = ""
    EndIf
    Sleep(30)
    WEnd

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

    Func _ConsoleCommand_CD()
    If UBound($CurCommandString) > 3 Then
    $CurPath = $CurCommandString[2]
    Else
    _ConsoleWrite($Console, "Parameter Error")
    EndIf
    EndFunc

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

    Func _ConsoleCommand_FILE()
    If UBound($CurCommandParameters) < 2 Then _ConsoleWrite($Console, "Parameter Error")
    If $CurCommandParameters[2] = "CREATE" Then
    If UBound($CurCommandString) > 3 Then
    If Not _FileCreate($CurPath & "\" & $CurCommandString[2]) Then _ConsoleWrite($Console, "Error")
    Else
    _ConsoleWrite($Console, "Parameter Error")
    EndIf
    ElseIf $CurCommandParameters[2] = "MOVE" Then
    If UBound($CurCommandString) > 5 Then
    FileMove($CurPath & "\" & $CurCommandString[2], $CurPath & "\" & $CurCommandString[4], 8)
    Else
    _ConsoleWrite($Console, "Parameter Error")
    EndIf
    Else
    _ConsoleWrite($Console, "Parameter Error")
    EndIf
    EndFunc

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

    Func _ConsoleCommand_HIDE()
    Local $timer
    _WinSetSize($Console[0],660, 0, 10, 4)
    GUISetState(@SW_MINIMIZE)
    If UBound($CurCommandParameters) > 3 Then
    $timer = TimerInit()
    While 1
    If TimerDiff($timer) > Number($CurCommandParameters[2]) Or WinActive($Title) Then ExitLoop
    Sleep(20)
    WEnd
    ElseIf UBound($CurCommandParameters) = 2 Then
    While 1
    If WinActive($Title) Then ExitLoop
    Sleep(20)
    WEnd
    EndIf
    GUISetState(@SW_RESTORE)
    _WinSetSize($Console[0], 660, 329, 10, 5)
    EndFunc

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

    Func _ConsoleCommand_COLOUR()
    If UBound($CurCommandParameters) = 3 Then
    GUICtrlSetColor($Console[1], "0x" & $CurCommandParameters[2])
    ElseIf UBound($CurCommandParameters) = 4 Then
    GUICtrlSetColor($Console[1], "0x" & $CurCommandParameters[2])
    GUICtrlSetBkColor($Console[1], "0x" & $CurCommandParameters[3])
    Else
    _ConsoleWrite($Console, "Parameter Error")
    EndIf
    EndFunc

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

    Func _ConsoleCommand_CLEAR()
    GUICtrlSetData($Console[1], "")
    EndFunc

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

    Func _ConsoleCommand_MSGBOX()
    If Not UBound($CurCommandParameters) < 5 And UBound($CurCommandString) = 6 Then
    MsgBox(Number($CurCommandParameters[2]), $CurCommandString[2], $CurCommandString[4])
    Else
    _ConsoleWrite($Console, "Parameter Error")
    EndIf
    EndFunc

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

    Func _ConsoleCommand_EXIT()
    _WinSetSize($Console[0], 660, 0, 10, 5)
    Sleep(100)
    Exit
    EndFunc

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

    Func _ConsoleCommand_HELP()
    If UBound($CurCommandParameters) = 2 Then
    For $i = 0 To UBound($Commands) - 1
    _ConsoleWrite($Console, $Commands[$i])
    Next
    _ConsoleWrite($Console, 'Type "help command" for more inforamtion')
    ElseIf UBound($CurCommandParameters) = 3 Then
    For $i = 0 To UBound($Commands) - 1
    If $CurCommandParameters[2] = $Commands[$i] Then
    _ConsoleWrite($Console, $Commands[$i] & "/t" & $CommandsDis[$i])
    ExitLoop
    EndIf
    Next
    Else
    _ConsoleWrite($Console, "Parameter Error")
    EndIf
    EndFunc

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

    Func _SM_SetVisualStyle($b_Enable)
    Return DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "int", $b_Enable)
    EndFunc

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

    Func _ConsoleCreate($Title)
    Local $Console[2]
    _SM_SetVisualStyle(False)
    $Console[0] = GUICreate($Title, 654, 0, -1, @DesktopHeight/2 - 164, Default, $WS_EX_Composited)
    GUISetOnEvent(-3, "_ConsoleCommand_EXIT")
    GUISetBkColor(0x000000)
    $Console[1] = GUICtrlCreateEdit("", 0, 0, 657, 297, BitOR($ES_AUTOVSCROLL, $WS_VSCROLL))
    GUICtrlSetBkColor($Console[1], 0x000000)
    GUICtrlSetColor($Console[1], 0xC0C0C0)
    GUICtrlSetFont($Console[1], 10, Default, Default, "Lucida Console")
    GUISetState(@SW_SHOW)
    _WinSetSize($Console[0], 660, 329, 10, 5)
    Return $Console
    Endfunc

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

    Func _ConsoleWrite($Console, $String)
    Local $timer, $split
    $String = StringReplace($String, "/E", @CRLF)
    $String = StringReplace($String, "/t", @TAB)
    $split = StringSplit($String, "")
    $timer = TimerInit()
    For $i = 1 To $split[0]
    Sleep(20)
    GUICtrlSetData($Console[1], GUICtrlRead($Console[1]) & $split[$i])
    Next
    GUICtrlSetData($Console[1], GUICtrlRead($Console[1]) & @CRLF)
    EndFunc

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

    Func _WinSetSize($hWnd, $iWidth, $iHeigth, $iSleep = -1,$iStep = 4);by Gta Spider
    If $iSleep < 0 Then Return WinMove($hWnd,"",Default,Default,$iWidth,$iHeigth)
    Local $i, $iStepW = $iStep, $iStepH = $iStep,$iSin,$i2,$iLastI
    Local $aWinPos = WinGetPos($hWnd)
    If $iWidth < $aWinPos[2] Then $iStepW *= -1
    If $iHeigth < $aWinPos[3] Then $iStepH *= -1
    Local $iDegToRad = 3.14159265358979/180
    Local $iSinMulW = ($iWidth - $aWinPos[2]) / 2.5
    Local $iSinMulH = ($iHeigth - $aWinPos[3]) / 2.5
    If $iSinMulW < 0 Then $iSinMulW *= -1
    If $iSinMulH < 0 Then $iSinMulH *= -1
    If $iWidth <> $aWinPos[2] Then
    For $i = $aWinPos[2] To $iWidth Step $iStepW
    $iLastI = $i
    $iSin = $i - $aWinPos[2]
    $iSin = Sin($iDegToRad * (180*$iSin/($iWidth - $aWinPos[2])))
    WinMove($hWnd,"",Default,Default,$i + ($iSin * $iSinMulW),Default)
    Sleep($iSleep)
    Next
    If Mod($iWidth - $aWinPos[2],$iStep) Then
    If $iStepW < 0 Then
    $iStepW = -1
    Else
    $iStepW = 1
    EndIf
    For $i = $iLastI -1 To $iWidth Step $iStepW
    WinMove($hWnd,"",Default,Default,$i,Default)
    Next
    EndIf
    EndIf
    If $iHeigth <> $aWinPos[3] Then
    For $i = $aWinPos[3] To $iHeigth Step $iStepH
    $iLastI = $i
    $iSin = $i - $aWinPos[3]
    $iSin = Sin($iDegToRad*(180*$iSin/($iHeigth - $aWinPos[3])))
    WinMove($hWnd,"",Default,Default,Default,$i + ($iSin * $iSinMulH))
    Sleep($iSleep)
    Next
    If Mod($iHeigth - $aWinPos[3],$iStep) Then
    If $iStepH < 0 Then
    $iStepH = -1
    Else
    $iStepH = 1
    EndIf
    For $i = $iLastI -1 To $iHeigth Step $iStepH
    WinMove($hWnd,"",Default,Default,Default,$i)
    Next
    EndIf
    EndIf
    EndFunc

    [/autoit]

    Und ja, das Teil macht mich süchtig. 8)

  • Update

    • Nestos
    • 13. Mai 2010 um 18:30

    Einfach drüberinstallieren müsste gehen. ^^

  • (kleine) Konsole

    • Nestos
    • 13. Mai 2010 um 18:20

    Ich hab mich mal ein bisschen damit gespielt und dein Script stark umgeschrieben. :)
    Jetzt hat die Console ein paar Funktionen mit Beschreibungen.

    Sei mir nicht böse, aber ich hatte gerade Langeweile. :D

    Kannst den ganzen Code übernehmen wenn du willst.

    Console
    [autoit]

    #include <Misc.au3>
    #include <Array.au3>
    #include <WindowsConstants.au3>
    #include <EditConstants.au3>

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

    Opt("GUIOnEventMode", 1)

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

    Global $Console, $CurCommand, $Read, $Commands[5], $CommandsDis[5], $Right, $CurCommandParameters, $CurCommandString
    Global $dll = DllOpen("user32.dll")
    Global $title = "Console"

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

    $Commands[0] = "HELP"
    $Commands[1] = "EXIT"
    $Commands[2] = "MSGBOX"
    $Commands[3] = "CLEAR"
    $Commands[4] = "COLOUR"

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

    $CommandsDis[0] = "Shows a List of all commands/E/tParameter 1 = Command (optional)"
    $CommandsDis[1] = "Exit the console"
    $CommandsDis[2] = "Shows a massage/E/tParameter 1 = Flag/E/tParameter 2 = Title (string)/E/tParameter 3 = Text (string)"
    $CommandsDis[3] = "Clears the Console"
    $CommandsDis[4] = "Changes the font and background colour/E/tParameter 1 = font colour (HEX)/E/tParameter 2 = background colour (HEX) (optional)"

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

    $Console = _ConsoleCreate($title)
    _ConsoleWrite($Console, "Welcome/EThis is a Console example from http://www.AutoIt.de/E")

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

    While 1
    If _IsPressed("0D", $dll) And WinActive($title) Then
    $array = StringSplit(GUICtrlRead($Console[1]), @CRLF)
    $CurCommand = $array[Ubound($array) - 1]
    $CurCommandParameters = StringSplit($CurCommand, " ")
    $CurCommandString = StringSplit($CurCommand, '"')
    For $i = 1 To $array[0] - 1 Step 2
    $Read &= $array[$i] & @CRLF
    Next
    GUICtrlSetData($Console[1], $Read & "> " & $CurCommand & @CRLF)
    For $i = 0 To UBound($Commands) - 1
    If $CurCommandParameters[1] = $Commands[$i] Then
    Call("_ConsoleCommand_" & $Commands[$i])
    $Right = True
    ExitLoop
    Else
    $Right = False
    EndIf
    Next
    If Not $Right Then
    _ConsoleWrite($Console, "unknown Command/EType HELP to list all commands")
    EndIf
    While _IsPressed("0D", $dll) And WinActive($title)
    Sleep(100)
    WEnd
    $Read = ""
    EndIf
    Sleep(30)
    WEnd

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

    Func _ConsoleCommand_COLOUR()
    If UBound($CurCommandParameters) = 3 Then
    GUICtrlSetColor($Console[1], "0x" & $CurCommandParameters[2])
    ElseIf UBound($CurCommandParameters) = 4 Then
    GUICtrlSetColor($Console[1], "0x" & $CurCommandParameters[2])
    GUICtrlSetBkColor($Console[1], "0x" & $CurCommandParameters[3])
    Else
    _ConsoleWrite($Console, "Parameter Error")
    EndIf
    EndFunc

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

    Func _ConsoleCommand_CLEAR()
    GUICtrlSetData($Console[1], "")
    EndFunc

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

    Func _ConsoleCommand_MSGBOX()
    If Not UBound($CurCommandParameters) < 5 And UBound($CurCommandString) = 6 Then
    MsgBox(Number($CurCommandParameters[2]), $CurCommandString[2], $CurCommandString[4])
    Else
    _ConsoleWrite($Console, "Parameter Error")
    EndIf
    EndFunc

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

    Func _ConsoleCommand_Exit()
    _WinSetSize($Console[0], 660, 0, 10, 5)
    Exit
    EndFunc

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

    Func _ConsoleCommand_HELP()
    If UBound($CurCommandParameters) = 2 Then
    For $i = 0 To UBound($Commands) - 1
    _ConsoleWrite($Console, $Commands[$i])
    Next
    ElseIf UBound($CurCommandParameters) = 3 Then
    For $i = 0 To UBound($Commands) - 1
    If $CurCommandParameters[2] = $Commands[$i] Then
    _ConsoleWrite($Console, $Commands[$i] & "/t" & $CommandsDis[$i])
    ExitLoop
    EndIf
    Next
    Else
    _ConsoleWrite($Console, "Parameter Error")
    EndIf
    EndFunc

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

    Func _SM_SetVisualStyle($b_Enable)
    Return DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "int", $b_Enable)
    EndFunc

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

    Func _ConsoleCreate($Title)
    Local $Console[2]
    _SM_SetVisualStyle(False)
    $Console[0] = GUICreate($Title, 654, 0, -1, @DesktopHeight/2 - 164, Default, $WS_EX_Composited)
    GUISetOnEvent(-3, "_ConsoleCommand_Exit")
    GUISetBkColor(0x000000)
    $Console[1] = GUICtrlCreateEdit("", 0, 0, 657, 297, BitOR($ES_AUTOVSCROLL, $WS_VSCROLL))
    GUICtrlSetBkColor($Console[1], 0x000000)
    GUICtrlSetColor($Console[1], 0xC0C0C0)
    GUICtrlSetFont($Console[1], 10, Default, Default, "Lucida Console")
    GUISetState(@SW_SHOW)
    _WinSetSize($Console[0], 660, 329, 10, 5)
    Return $Console
    Endfunc

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

    Func _ConsoleWrite($Console, $String)
    Local $timer, $split
    $String = StringReplace($String, "/E", @CRLF)
    $String = StringReplace($String, "/t", @TAB)
    $split = StringSplit($String, "")
    $timer = TimerInit()
    For $i = 1 To $split[0]
    Sleep(20)
    GUICtrlSetData($Console[1], GUICtrlRead($Console[1]) & $split[$i])
    Next
    GUICtrlSetData($Console[1], GUICtrlRead($Console[1]) & @CRLF)
    EndFunc

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

    Func _WinSetSize($hWnd, $iWidth, $iHeigth, $iSleep = -1,$iStep = 4);by Gta Spider
    If $iSleep < 0 Then Return WinMove($hWnd,"",Default,Default,$iWidth,$iHeigth)
    Local $i, $iStepW = $iStep, $iStepH = $iStep,$iSin,$i2,$iLastI
    Local $aWinPos = WinGetPos($hWnd)
    If $iWidth < $aWinPos[2] Then $iStepW *= -1
    If $iHeigth < $aWinPos[3] Then $iStepH *= -1
    Local $iDegToRad = 3.14159265358979/180
    Local $iSinMulW = ($iWidth - $aWinPos[2]) / 2.5
    Local $iSinMulH = ($iHeigth - $aWinPos[3]) / 2.5
    If $iSinMulW < 0 Then $iSinMulW *= -1
    If $iSinMulH < 0 Then $iSinMulH *= -1
    If $iWidth <> $aWinPos[2] Then
    For $i = $aWinPos[2] To $iWidth Step $iStepW
    $iLastI = $i
    $iSin = $i - $aWinPos[2]
    $iSin = Sin($iDegToRad * (180*$iSin/($iWidth - $aWinPos[2])))
    WinMove($hWnd,"",Default,Default,$i + ($iSin * $iSinMulW),Default)
    Sleep($iSleep)
    Next
    If Mod($iWidth - $aWinPos[2],$iStep) Then
    If $iStepW < 0 Then
    $iStepW = -1
    Else
    $iStepW = 1
    EndIf
    For $i = $iLastI -1 To $iWidth Step $iStepW
    WinMove($hWnd,"",Default,Default,$i,Default)
    Next
    EndIf
    EndIf
    If $iHeigth <> $aWinPos[3] Then
    For $i = $aWinPos[3] To $iHeigth Step $iStepH
    $iLastI = $i
    $iSin = $i - $aWinPos[3]
    $iSin = Sin($iDegToRad*(180*$iSin/($iHeigth - $aWinPos[3])))
    WinMove($hWnd,"",Default,Default,Default,$i + ($iSin * $iSinMulH))
    Sleep($iSleep)
    Next
    If Mod($iHeigth - $aWinPos[3],$iStep) Then
    If $iStepH < 0 Then
    $iStepH = -1
    Else
    $iStepH = 1
    EndIf
    For $i = $iLastI -1 To $iHeigth Step $iStepH
    WinMove($hWnd,"",Default,Default,Default,$i)
    Next
    EndIf
    EndIf
    EndFunc

    [/autoit]
  • (kleine) Konsole

    • Nestos
    • 13. Mai 2010 um 15:14

    Wirklich sehr gut umgesetzt! :thumbup:

    Ich hab den Code mal ein bisschen abgeändert, und die originale CMD Schritart eingefügt. ;)

    Spoiler anzeigen
    [autoit]

    #include <Misc.au3>
    #include <WindowsConstants.au3>
    #include <EditConstants.au3>

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

    Global $edit, $Console, $BEF
    Global $dll = DllOpen("user32.dll")

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

    HotKeySet("^m","MoveOut")

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

    $Console = _ConsoleCreate("Konsole")
    _ConsoleWrite($Console, "Welcome")

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

    While 1
    $msg = GUIGetMsg($Console[0])
    Switch $msg
    Case -3
    Exit
    EndSwitch
    If _IsPressed("0D", $dll) And WinActive("Konsole") Then
    $read = GUICtrlRead($Console[1])
    $array = StringSplit($read, @CR)
    $arrayNum = Ubound($array)
    $BEF = $array[$arrayNum - 1]
    GUICtrlSetData($Console[1], GUICtrlRead($Console[1]) & @CRLF)
    If $BEF = @LF & "lol" Then
    _ConsoleWrite($Console, "roffl")
    Else
    _ConsoleWrite($Console, "unknown Command")
    EndIf
    While _IsPressed("0D", $dll) And WinActive("Konsole")
    Sleep(100)
    WEnd
    EndIf
    Sleep(30)
    WEnd

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

    Func _SM_SetVisualStyle($b_Enable)
    Return DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "int", $b_Enable * 7)
    EndFunc

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

    Func _ConsoleCreate($Title)
    Local $Console[2]
    _SM_SetVisualStyle(0)
    $Console[0] = GUICreate($Title, 654, 0, -1, -1, Default)
    GUISetBkColor(0x000000)
    $Console[1] = GUICtrlCreateEdit("", 0, 0, 657, 297, BitOR($ES_AUTOVSCROLL, $WS_VSCROLL))
    GUICtrlSetBkColor($Console[1], 0x000000)
    GUICtrlSetColor ($Console[1], 0xC0C0C0)
    GUICtrlSetFont($Console[1], 10, Default, Default, "Lucida Console")
    GUISetState(@SW_SHOW)
    Return $Console
    Endfunc

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

    Func _ConsoleWrite($Console, $String)
    GUICtrlSetData($Console[1], GUICtrlRead($Console[1]) & $String & @CRLF)
    EndFunc

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

    Func MoveOut()
    WinActivate("Konsole")
    _WinSetSize($Console[0],660, 329, 10,5)
    EndFunc

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

    Func _WinSetSize($hWnd, $iWidth, $iHeigth, $iSleep = -1,$iStep = 4);by Gta Spider
    If $iSleep < 0 Then Return WinMove($hWnd,"",Default,Default,$iWidth,$iHeigth)
    Local $i, $iStepW = $iStep, $iStepH = $iStep,$iSin,$i2,$iLastI
    Local $aWinPos = WinGetPos($hWnd)
    If $iWidth < $aWinPos[2] Then $iStepW *= -1
    If $iHeigth < $aWinPos[3] Then $iStepH *= -1
    Local $iDegToRad = 3.14159265358979/180
    Local $iSinMulW = ($iWidth - $aWinPos[2]) / 2.5
    Local $iSinMulH = ($iHeigth - $aWinPos[3]) / 2.5
    If $iSinMulW < 0 Then $iSinMulW *= -1
    If $iSinMulH < 0 Then $iSinMulH *= -1
    If $iWidth <> $aWinPos[2] Then
    For $i = $aWinPos[2] To $iWidth Step $iStepW
    $iLastI = $i
    $iSin = $i - $aWinPos[2]
    $iSin = Sin($iDegToRad * (180*$iSin/($iWidth - $aWinPos[2])))
    WinMove($hWnd,"",Default,Default,$i + ($iSin * $iSinMulW),Default)
    Sleep($iSleep)
    Next
    If Mod($iWidth - $aWinPos[2],$iStep) Then
    If $iStepW < 0 Then
    $iStepW = -1
    Else
    $iStepW = 1
    EndIf
    For $i = $iLastI -1 To $iWidth Step $iStepW
    WinMove($hWnd,"",Default,Default,$i,Default)
    Next
    EndIf
    EndIf
    If $iHeigth <> $aWinPos[3] Then
    For $i = $aWinPos[3] To $iHeigth Step $iStepH
    $iLastI = $i
    $iSin = $i - $aWinPos[3]
    $iSin = Sin($iDegToRad*(180*$iSin/($iHeigth - $aWinPos[3])))
    WinMove($hWnd,"",Default,Default,Default,$i + ($iSin * $iSinMulH))
    Sleep($iSleep)
    Next
    If Mod($iHeigth - $aWinPos[3],$iStep) Then
    If $iStepH < 0 Then
    $iStepH = -1
    Else
    $iStepH = 1
    EndIf
    For $i = $iLastI -1 To $iHeigth Step $iStepH
    WinMove($hWnd,"",Default,Default,Default,$i)
    Next
    EndIf
    EndIf
    EndFunc

    [/autoit]
  • WinMove

    • Nestos
    • 13. Mai 2010 um 11:23

    Du musst die Hälfe der Fensterbreite und Höhe subtrahieren.

    Wenn das Fenster 500 hoch und breit ist, musst du 250 subtrahieren.

    Ansonsten wird das Fenster nicht ganz in der Mitte angezeigt, weil ja von der linken oberen Ecke der GUI gesetzt wird.

    [autoit]

    Global $Height = 500, $Width = 500, $hWnd

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

    $hWnd = GUICreate("Form1", $Width, $Height)

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

    WinMove("Form1","",(@desktopwidth - $Width/2)/2, (@desktopheight - $Height/2)/2)]

    [/autoit]

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™