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

Beiträge von eukalyptus

  • (Nicht vorhandene) Tastatur simulieren

    • eukalyptus
    • 23. September 2010 um 07:18

    Du könntest folgendes probieren:

    Text mit Clipput in die Zwischenablage kopieren und mit Send('^v') einfügen...

    Falls du eine Maus hast und eine Bildschrimtastatur verwenden möchtest:

    [autoit]

    Run(@SystemDir & "\osk.exe")

    [/autoit]

    mfgE

  • _ExchangeVariables_SetVariable

    • eukalyptus
    • 23. September 2010 um 07:11

    Hi

    Schau dir mal die Hilfe zu DllStructCreate an.
    Man muß beim Erstellen angeben, welche Datentypen sich darin befinden, und das steht in $sSize (sollte vielleicht $tagSize heißen ;))

    Man muß natürlich auch Script 2 mitteilen, welche Datentypen dies sind und das macht man mit $sExtended

    mfgE

  • Gezeichnetes bild "Skriptübergleifend" verschicken...

    • eukalyptus
    • 20. September 2010 um 10:53

    Hi

    du musst die Bits des Screenshoots in ein Struct kopieren, dieses dann mit Exchange Variables an das 2 Script senden und dort die Bits wieder zu einem Bild machen:

    Script1.au3

    Spoiler anzeigen
    [autoit]

    #include "ExchangeVariables.au3"
    #include <ScreenCapture.au3>
    #include <WinAPI.au3>

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

    HotKeySet("{ENTER}", "_SendScreenShot")

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

    Global $bDone = False

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

    _ExchangeVariables_Startup(1, 'ExchangeVariables Send Bitmap Example')

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

    While 1
    Sleep(10)
    WEnd

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

    Func _SendScreenShot()
    Local $hBmp = _ScreenCapture_Capture()

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

    Local $hDC = _WinAPI_GetDC(0)

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

    Local $tBitmapInfo = DllStructCreate($tagBITMAPINFO)
    DllStructSetData($tBitmapInfo, "Size", DllStructGetSize($tBitmapInfo))

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

    _WinAPI_GetDIBits($hDC, $hBmp, 0, 0, 0, DllStructGetPtr($tBitmapInfo), 0)

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

    Local $iSize = DllStructGetData($tBitmapInfo, "SizeImage")
    Local $iWidth = DllStructGetData($tBitmapInfo, "Width")
    Local $iHeight = DllStructGetData($tBitmapInfo, "Height")
    DllStructSetData($tBitmapInfo, "Compression", 0); Keine Ahnung, warum man das wieder reseten muß...

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

    Local $sSize = "byte[" & $iSize & "]"
    Local $tBits = DllStructCreate($sSize)
    Local $iLines = _WinAPI_GetDIBits($hDC, $hBmp, 0, $iHeight, DllStructGetPtr($tBits), DllStructGetPtr($tBitmapInfo), 0)

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

    _WinAPI_DeleteObject($hBmp)
    _WinAPI_ReleaseDC(0, $hDC)

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

    _ExchangeVariables_SetVariable(2, "tBitmapInfo", $tBitmapInfo, $tagBITMAPINFO)
    _ExchangeVariables_SetVariable(2, "tBits", $tBits, $sSize)

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

    _ExchangeVariables_SetVariable(2, "bSent", True)

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

    $tBits = 0
    EndFunc ;==>_SendScreenShot

    [/autoit]

    Script2.au3

    Spoiler anzeigen
    [autoit]

    #include "ExchangeVariables.au3"
    #include <GDIPlus.au3>
    #include <WinAPI.au3>

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

    $pID = Run(@ScriptDir & "\Script1.exe")
    HotKeySet("{ESC}", "_Exit")

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

    Global $tBits, $tBitmapInfo, $bSent = False
    _GDIPlus_Startup()
    _ExchangeVariables_Startup(2, 'ExchangeVariables Send Bitmap Example', '_VarMsg')
    Global $hBitmap

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

    While 1
    Sleep(100)
    WEnd

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

    _GDIPlus_Shutdown()

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

    Func _VarMsg($hWnd, $iMsg, $wParam, $lparam)
    If $bSent = True Then
    Local $iWidth = DllStructGetData($tBitmapInfo, "Width")
    Local $iHeight = DllStructGetData($tBitmapInfo, "Height")

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

    Local $hDC = _WinAPI_GetDC(0)
    Local $hBmp = _WinAPI_CreateCompatibleBitmap($hDC, $iWidth, $iHeight)
    _WinAPI_SetDIBits(0, $hBmp, 0, $iHeight, DllStructGetPtr($tBits), DllStructGetPtr($tBitmapInfo), 0)
    $hBitmap = _GDIPlus_BitmapCreateFromHBITMAP($hBmp)
    _GDIPlus_ImageSaveToFile($hBitmap, @ScriptDir & "\Receive.bmp")
    _WinAPI_DeleteObject($hBmp)

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

    _WinAPI_ReleaseDC(0, $hDC)

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

    $tBits = 0
    $tBitmapInfo = 0
    $bSent = False
    MsgBox(0, "Bild erhalten", "Script 2 hat ein Bild erhalten und unter: " & @ScriptDir & "\Receive.bmp gespeichert")
    _Exit()
    EndIf
    EndFunc ;==>_VarMsg

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

    Func _Exit()
    ProcessClose($pID)
    Exit
    EndFunc ;==>_Exit

    [/autoit]

    Script1.au3 zuerst als EXE compilieren
    Script2.au3 ausführen (startet automatisch Script1.exe)
    dann Enter drücken

    mfgE

  • Gibt es eine Möglichkeit die WM_Notify Messages eines LIstviews per DllCallbackRegister auszuwerten?

    • eukalyptus
    • 20. September 2010 um 07:37

    Wird das etwa ein Beitrag zum µIt? ;)

    du kannst eine eigene WinProc-Funktion registrieren, die vor der normalen GuiRegisterMsg-Funktion aufgerufen wird:

    Spoiler anzeigen
    [autoit]

    #include <GuiImageList.au3>
    #include <GuiListView.au3>
    #include <ListViewConstants.au3>
    #include <StructureConstants.au3>
    #include <WinAPI.au3>
    #include <WindowsConstants.au3>

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

    $hGui = GUICreate("Test", 400, 400)
    $hListView = _GUICtrlListView_Create($hGui, "Listview", 10, 10, 380, 380)
    _GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES))

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

    ; Load images
    $hImage = _GUIImageList_Create()
    _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0xFF0000, 16, 16))
    _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x00FF00, 16, 16))
    _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x0000FF, 16, 16))
    _GUICtrlListView_SetImageList($hListView, $hImage, 1)

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

    ; Add columns
    _GUICtrlListView_InsertColumn($hListView, 0, "Column 1", 100)
    _GUICtrlListView_InsertColumn($hListView, 1, "Column 2", 100)
    _GUICtrlListView_InsertColumn($hListView, 2, "Column 3", 100)

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

    ; Add items
    _GUICtrlListView_AddItem($hListView, "Row 1: Col 1", 0)
    _GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 2", 1)
    _GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 3", 2)
    _GUICtrlListView_AddItem($hListView, "Row 2: Col 1", 1)
    _GUICtrlListView_AddSubItem($hListView, 1, "Row 2: Col 2", 1)
    _GUICtrlListView_AddItem($hListView, "Row 3: Col 1", 2)
    GUISetState()

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

    $hProc = DllCallbackRegister('_WinProc', 'ptr', 'hwnd;uint;wparam;lparam')
    $hHook = _WinAPI_SetWindowLong($hGui, -4, DllCallbackGetPtr($hProc))

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

    While GUIGetMsg() <> -3
    Sleep(10)
    WEnd

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

    _WinAPI_SetWindowLong($hGui, -4, $hHook) ; original WinProc wiederherstellen

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

    Func _WinProc($hWnd, $iMsg, $iwParam, $ilParam)
    If $iMsg <> $WM_NOTIFY Then Return _WinAPI_CallWindowProc($hHook, $hWnd, $iMsg, $iwParam, $ilParam)

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

    Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView, $tInfo

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

    $hWndListView = $hListView
    If Not IsHWnd($hListView) Then $hWndListView = GUICtrlGetHandle($hListView)

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

    $tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
    $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
    $iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
    $iCode = DllStructGetData($tNMHDR, "Code")
    Switch $hWndFrom
    Case $hWndListView
    Switch $iCode
    Case $LVN_COLUMNCLICK ; A column was clicked
    $tInfo = DllStructCreate($tagNMLISTVIEW, $ilParam)
    _DebugPrint("$LVN_COLUMNCLICK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
    "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
    "-->Code:" & @TAB & $iCode & @LF & _
    "-->Item:" & @TAB & DllStructGetData($tInfo, "Item") & @LF & _
    "-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
    "-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _
    "-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _
    "-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _
    "-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _
    "-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _
    "-->Param:" & @TAB & DllStructGetData($tInfo, "Param"))
    Case $NM_CLICK ; Sent by a list-view control when the user clicks an item with the left mouse button
    $tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
    _DebugPrint("$NM_CLICK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
    "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
    "-->Code:" & @TAB & $iCode & @LF & _
    "-->Index:" & @TAB & DllStructGetData($tInfo, "Index") & @LF & _
    "-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
    "-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _
    "-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _
    "-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _
    "-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _
    "-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _
    "-->lParam:" & @TAB & DllStructGetData($tInfo, "lParam") & @LF & _
    "-->KeyFlags:" & @TAB & DllStructGetData($tInfo, "KeyFlags"))

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

    EndSwitch
    EndSwitch

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

    Return _WinAPI_CallWindowProc($hHook, $hWnd, $iMsg, $iwParam, $ilParam); hier wird die normale WinProc aufgerufen, die man mit GuiRegisterMsg auswerten kann
    EndFunc ;==>_WinProc

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

    Func _DebugPrint($s_text, $line = @ScriptLineNumber)
    ConsoleWrite( _
    "!===========================================================" & @LF & _
    "+======================================================" & @LF & _
    "-->Line(" & StringFormat("%04d", $line) & "):" & @TAB & $s_text & @LF & _
    "+======================================================" & @LF)
    EndFunc ;==>_DebugPrint

    [/autoit]


    nicht vergessen bei Exit die originale WinProc wieder herzustellen.

    mfgE

  • [Auswertung läuft...] µitLight September/Oktober

    • eukalyptus
    • 6. September 2010 um 18:31

    Das Thema gefällt mir!

    Mal sehn, wenn es die Zeit zulässt, dann bin ich auch dabei.

  • GDIPlus - Image skalieren ohne zu zeichnen

    • eukalyptus
    • 6. September 2010 um 06:38

    Suchst du sowas?:

    Spoiler anzeigen
    [autoit]

    #include <GDIPlus.au3>
    #include <WinAPI.au3>

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

    $iWidth = 640
    $iHeight = 480

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

    _GDIPlus_Startup()
    $hImage = _GDIPlus_ImageLoadFromFile("Input.jpg")

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

    $hGraphicsTemp = _GDIPlus_GraphicsCreateFromHWND(_WinAPI_GetDesktopWindow())
    $hBitmap = _GDIPlus_BitmapCreateFromGraphics($iWidth, $iHeight, $hGraphicsTemp)
    $hGraphics = _GDIPlus_ImageGetGraphicsContext($hBitmap)

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

    _GDIPlus_GraphicsDrawImageRect($hGraphics, $hImage, 0, 0, $iWidth, $iHeight)

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

    _GDIPlus_ImageSaveToFile($hBitmap, "output.bmp")

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

    _GDIPlus_GraphicsDispose($hGraphicsTemp)
    _GDIPlus_GraphicsDispose($hGraphics)
    _GDIPlus_BitmapDispose($hBitmap)

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

    _GDIPlus_Shutdown()

    [/autoit]

    E

  • Icon aus *.exe auslesen und mit GDI+ auf die GUI zeichnen

    • eukalyptus
    • 3. September 2010 um 15:41

    Wie schon gesagt geht die Transparenz beim Umwandeln zu GDI+ verloren

    Zeichne die Icons am besten mit _WinAPI_DrawIconEx:

    Spoiler anzeigen
    [autoit]

    #include <WinAPI.au3>

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

    $hIcon = _WinAPI_PrivateExtractIcon(@SystemDir & "\calc.exe", 0, 256, 256)

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

    $hGui = GUICreate("Test", 256, 256)
    GUISetBkColor(0x00AA00)
    GUISetState()

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

    $hDC = _WinAPI_GetDC($hGui)

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

    _WinAPI_DrawIconEx($hDC, 0, 0, $hIcon, 256, 256)

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

    While GUIGetMsg() <> -3
    Sleep(20)
    WEnd

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

    _WinAPI_DestroyIcon($hIcon)

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

    Func _WinAPI_PrivateExtractIcon($sIcon, $iIndex, $iWidth, $iHeight)

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

    Local $hIcon, $tIcon = DllStructCreate('hwnd'), $tID = DllStructCreate('hwnd')
    Local $Ret = DllCall('user32.dll', 'int', 'PrivateExtractIcons', 'str', $sIcon, 'int', $iIndex, 'int', $iWidth, 'int', $iHeight, 'ptr', DllStructGetPtr($tIcon), 'ptr', DllStructGetPtr($tID), 'int', 1, 'int', 0)

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

    If (@error) Or ($Ret[0] = 0) Then
    Return SetError(1, 0, 0)
    EndIf
    $hIcon = DllStructGetData($tIcon, 1)
    If ($hIcon = Ptr(0)) Or (Not IsPtr($hIcon)) Then
    Return SetError(1, 0, 0)
    EndIf
    Return $hIcon
    EndFunc ;==>_WinAPI_PrivateExtractIcon

    [/autoit]
  • peethebee ist B.Sc.

    • eukalyptus
    • 2. September 2010 um 17:12

    Herzlichen Glückwunsch! :thumbup:

    dein neuer Nick wird nun also: peetheB.Sc. ? 8o

  • Update - Audio Visualizing

    • eukalyptus
    • 31. August 2010 um 19:57

    @Matthias: probier mal diesen Code:

    Spoiler anzeigen
    [autoit]

    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #include <WinApi.au3>
    #include <GDIPlus.au3>

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

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

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

    $hGui = GUICreate("Test", 400, 400, Default, Default, $WS_POPUP, $WS_EX_LAYERED)
    GUISetBkColor(0xABCDEF)
    _WinAPI_SetLayeredWindowAttributes($hGui, 0x00EFCDAB, 0, 0x01, True)
    GUISetState(@SW_SHOW)

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

    _GDIPlus_Startup()
    $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGui)
    $hBmpBuffer = _GDIPlus_BitmapCreateFromGraphics(400, 400, $hGraphics)
    $hGfxBuffer = _GDIPlus_ImageGetGraphicsContext($hBmpBuffer)

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

    $hBrush = _GDIPlus_BrushCreateSolid(0xFFABCDEF)
    $hPen = _GDIPlus_PenCreate(0xFFABCDEF, 5)

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

    While 1
    _GDIPlus_GraphicsClear($hGfxBuffer, 0xFF000000)
    $iW = Random(50, 200, 1)
    $iH = Random(50, 200, 1)
    $iX = Random(0, 400, 1)
    $iY = Random(0, 400, 1)
    _GDIPlus_GraphicsFillEllipse($hGfxBuffer, $iX - $iW / 2, $iY - $iH / 2, $iW, $iH, $hBrush)

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

    $iW = Random(50, 200, 1)
    $iH = Random(50, 200, 1)
    $iX = Random(0, 400, 1)
    $iY = Random(0, 400, 1)
    _GDIPlus_GraphicsFillRect($hGfxBuffer, $iX - ($iW * 0.7) / 2, $iY - ($iH * 0.7) / 2, $iW * 0.7, $iH * 0.7, $hBrush)
    _GDIPlus_GraphicsDrawRect($hGfxBuffer, $iX - $iW / 2, $iY - $iH / 2, $iW, $iH, $hPen)

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

    _GDIPlus_GraphicsDrawImage($hGraphics, $hBmpBuffer, 0, 0)
    Sleep(1000)
    WEnd

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

    Func _Exit()
    _GDIPlus_BrushDispose($hBrush)
    _GDIPlus_PenDispose($hPen)
    _GDIPlus_GraphicsDispose($hGfxBuffer)
    _GDIPlus_BitmapDispose($hBmpBuffer)
    _GDIPlus_GraphicsDispose($hGraphics)
    _GDIPlus_Shutdown()
    Exit
    EndFunc ;==>_Exit

    [/autoit]

    Sind die Ellipse und das Rechteck transparent?

  • Update - Audio Visualizing

    • eukalyptus
    • 31. August 2010 um 19:54

    erstmal Danke fürs Feedback!

    Die blauen Balken zeigen das Frequenzspektrum von 20Hz - 20000Hz

    Eine MP3 schneidet meistens alles über ca. 15000Hz ab - deshalb kein Ausschlag ganz rechts
    Mit einer Wav-Datei (Samplingfrequenz 44100Hz => Abspielfrequenz 22050Hz) bewegen sich dann auch diese Balken...

    Ach ja: Was Interessantes:
    Damit man mit _WinAPI_SetLayeredWindowAttributes eine Farbe als Transparent einstellt und diese auch mit GDI+ angenommen wird muss man folgendes machen:
    Farbe in GDI+ z.B.: 0xFFABCDEF
    _WinAPI_SetLayeredWindowAttributes($hWnd, 0x00EFCDAB,0,0x01, True)

    Es gab schon einige Threads, wo das jemand gebraucht hätte.

    E

  • Update - Audio Visualizing

    • eukalyptus
    • 31. August 2010 um 19:13

    Edit: Da mich UEZ gestern mit diesem Script: GDI+ Zoomer
    inspiriert hat, hab ich ein paar weiter Beispiele in "Vizualizing.zip" gepackt...


    Eine Spielerei von mir

    Ich weiß gar nicht, wie ich das Script beschreiben soll...
    Eine Wellenform und Spektrum Anzeige eines Liedes auf dem Bildschirm ^^

    Spoiler anzeigen
    [autoit]

    #AutoIt3Wrapper_UseX64=n
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #include <WINAPI.au3>
    #include "Bass.au3"
    #include "BassExt.au3"
    #include <GDIPlus.au3>
    #include "GDIP.au3"

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

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

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

    Global $iWidth = @DesktopWidth * 0.7
    Global $iHeight = @DesktopHeight * 0.7
    Global $iPerspL = Round($iWidth * 0.3)
    Global $iPerspR = Round($iWidth * 0.1)
    Global $iWaveH = $iHeight / 10

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

    Global $aP_Flip[5][2] = [[4, 0],[0, $iHeight],[$iWidth, $iHeight],[0, 0],[$iWidth, 0]]
    Local $aP_Warp[5][2] = [[4, 0],[$iPerspL, 0],[$iWidth - $iPerspR, 0],[0, $iHeight],[$iWidth, $iHeight]]

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

    Global $sFile = FileOpenDialog("Open...", "", "playable formats (*.MP3;*.MP2;*.MP1;*.OGG;*.WAV;*.AIFF;*.AIF)")

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

    Global $hGui = GUICreate("FFT", $iWidth, $iHeight, -1, -1, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TRANSPARENT, $WS_EX_TOPMOST))
    GUISetBkColor(0x000000)
    _WinAPI_SetLayeredWindowAttributes($hGui, 0x00000000, 0xFF, 0x01, True)
    GUISetState()

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

    _GDIPlus_Startup()
    Global $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGui)
    Global $hBmpBuffer = _GDIPlus_BitmapCreateFromGraphics($iWidth, $iHeight, $hGraphics)
    Global $hGfxBuffer = _GDIPlus_ImageGetGraphicsContext($hBmpBuffer)
    Global $hBrush_FFT = _GDIPlus_BrushCreateSolid(0xFF0000AA)
    Global $hPen_FFT = _GDIPlus_PenCreate(0xFF0000FF)

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

    Global $hBrush_WL = _GDIPlus_BrushCreateSolid(0x8800FF00)
    Global $hPen_WL = _GDIPlus_PenCreate(0xEE00FF00)
    Global $hBrush_WR = _GDIPlus_BrushCreateSolid(0x88FF0000)
    Global $hPen_WR = _GDIPlus_PenCreate(0xEEFF0000)

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

    Global $hBrush_Pos = _GDIPlus_BrushCreateSolid(0x44FFFFFF)
    Global $hPen_Pos = _GDIPlus_PenCreate(0x88FFFFFF)

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

    _BASS_Startup(@ScriptDir & "\bass.dll")
    _BASS_EXT_Startup(@ScriptDir & "\bassExt.dll")

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

    _BASS_Init(0, -1, 44100, 0, "")

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

    Global $hStream = _BASS_StreamCreateFile(False, $sFile, 0, 0, $BASS_SAMPLE_FLOAT)

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

    Global $aWave = _CreateWaveForm($sFile)
    Global $aFFT = _BASS_EXT_CreateFFT(50, 0, 0, $iWidth, $iHeight / 2, $iWidth / 100, True)
    _BASS_ChannelPlay($hStream, True)

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

    GUIRegisterMsg(0x000F, "WM_PAINT")
    GUIRegisterMsg(0x0014, "WM_ERASEBKGND")

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

    Global $iTimer = TimerInit()
    While _BASS_ChannelIsActive($hStream)
    If TimerDiff($iTimer) > 25 Then
    ConsoleWrite(TimerDiff($iTimer) & @CRLF)
    $iTimer = TimerInit()
    _GDIPlus_GraphicsClear($hGfxBuffer, 0xFF000000)

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

    _BASS_EXT_ChannelGetFFT($hStream, $aFFT, 6)
    If Not @error Then _DrawFFT($hGfxBuffer, $aFFT, $hBrush_FFT, $hPen_FFT)

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

    _DrawWave($hGfxBuffer, $aWave[0], $aWave[2], 0, $hBrush_WL, $hPen_WL)
    _DrawWave($hGfxBuffer, $aWave[1], $aWave[2], $iWaveH / 2, $hBrush_WR, $hPen_WR)
    _DrawPos($hGfxBuffer, $iWaveH, $hBrush_Pos, $hPen_Pos)
    _GDIPlus_GraphicsDrawImage($hGraphics, $hBmpBuffer, 0, 0)
    EndIf
    WEnd
    _Exit()

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

    Func _CreateWaveForm($sFile)
    Local $hStream = _BASS_StreamCreateFile(False, $sFile, 0, 0, $BASS_STREAM_DECODE)
    Local $iBytes = _BASS_ChannelGetLength($hStream, $BASS_POS_BYTE)
    Local $iLength = _BASS_ChannelBytes2Seconds($hStream, $iBytes)
    Local $iRes = 88
    Local $iWidth = $iLength * $iRes
    Local $aWave = _BASS_EXT_ChannelGetWaveformDecode($hStream, $iWidth, $iWaveH, 0, $iLength, $iRes, "_WaveformGetProc")
    ToolTip("")
    _BASS_StreamFree($hStream)
    Return $aWave
    EndFunc ;==>_CreateWaveForm

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

    Func _WaveformGetProc($handle, $percent)
    ToolTip("Get Waveform: " & $percent & "%")
    EndFunc ;==>_WaveformGetProc

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

    Func _DrawPos($hGraphics, $iH, $hBrush, $hPen)
    Local $hPath = _GDIPlus_PathCreate($FillModeAlternate)
    _GDIPlus_PathAddRectangle($hPath, $iWidth / 2 - 2, 0, 4, $iHeight)
    _GDIPlus_PathWarp($hPath, 0, $aP_Warp, 0, 0, $iWidth, $iHeight)
    _GDIPlus_GraphicsFillPath($hGraphics, $hPath, $hBrush)
    _GDIPlus_GraphicsDrawPath($hGraphics, $hPath, $hPen)
    _GDIPlus_PathDispose($hPath)
    EndFunc ;==>_DrawPos

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

    Func _DrawWave($hGraphics, $pWave, $iCnt, $iYOffset, $hBrush, $hPen)
    Local $hPath_O = _GDIPlus_PathCreate($FillModeAlternate)
    Local $hPath_U = _GDIPlus_PathCreate($FillModeAlternate)
    Local $hPath = _GDIPlus_PathCreate($FillModeAlternate)
    Local $iPos = _BASS_ChannelGetPosition($hStream, $BASS_POS_BYTE)
    Local $iSec = _BASS_ChannelBytes2Seconds($hStream, $iPos)
    Local $iOffset = 88 * $iSec
    Local $iXOffset = 0
    Switch $iOffset
    Case 0 To $iWidth / 2
    $iXOffset = $iOffset
    $iOffset = 0
    Case Else
    $iOffset -= $iWidth / 2
    EndSwitch
    Local $iSegments = $iCnt / $aWave[5] * $iWidth
    If $iXOffset Then $iSegments -= $iWidth / 2 - $iXOffset
    If $iOffset + $iSegments > $iCnt Then $iSegments = $iCnt - $iOffset
    Local $fTension = 0.9
    DllCall($ghGDIPDll, "uint", "GdipAddPathCurve3", "hwnd", $hPath_O, "ptr", $pWave, "int", $iCnt, "int", $iOffset, "int", $iSegments, "float", $fTension)
    Local $aP_Flip[5][2] = [[4, 0],[0, $iWaveH / 4],[$iWidth, $iWaveH / 4],[0, 0],[$iWidth, 0]]
    _GDIPlus_PathWarp($hPath_O, 0, $aP_Flip, 0, 0, $iWidth, $iWaveH / 4) ; flip
    _GDIPlus_PathReverse($hPath_O)
    DllCall($ghGDIPDll, "uint", "GdipAddPathCurve3", "hwnd", $hPath_U, "ptr", $pWave, "int", $iCnt, "int", $iOffset, "int", $iSegments, "float", $fTension)
    Local $aP_Off[5][2] = [[4, 0],[0, 0],[$iWidth, 0],[0, $iWaveH / 4],[$iWidth, $iWaveH / 4]]
    _GDIPlus_PathWarp($hPath_U, 0, $aP_Off, 0, -$iWaveH / 4, $iWidth, $iWaveH / 4) ; Y-Offset
    _GDIPlus_PathAddPath($hPath, $hPath_U)
    _GDIPlus_PathAddPath($hPath, $hPath_O)
    _GDIPlus_PathCloseFigure($hPath)
    Local $aP_YOff[5][2] = [[4, 0],[0, 0],[$iWidth, 0],[0, $iWaveH / 2],[$iWidth, $iWaveH / 2]]
    _GDIPlus_PathWarp($hPath, 0, $aP_YOff, $iOffset, -$iYOffset, $iWidth, $iWaveH / 2) ; Y-Offset
    If $iXOffset Then _GDIPlus_PathWarp($hPath, 0, $aP_YOff, -$iWidth / 2 + $iXOffset, 0, $iWidth, $iWaveH / 2) ; Y-Offset
    _GDIPlus_PathWarp($hPath, 0, $aP_Warp, 0, 0, $iWidth, $iWaveH)
    _GDIPlus_GraphicsFillPath($hGraphics, $hPath, $hBrush)
    _GDIPlus_GraphicsDrawPath($hGraphics, $hPath, $hPen)
    _GDIPlus_PathDispose($hPath_O)
    _GDIPlus_PathDispose($hPath_U)
    _GDIPlus_PathDispose($hPath)
    EndFunc ;==>_DrawWave

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

    Func _DrawFFT($hGraphics, $aFFT, $hBrush, $hPen)
    Local $hPath = _GDIPlus_PathCreate($FillModeAlternate)
    DllCall($ghGDIPDll, "uint", "GdipAddPathPolygon", "hwnd", $hPath, "ptr", $aFFT[0], "int", $aFFT[1])
    _GDIPlus_PathWarp($hPath, 0, $aP_Flip, 0, 0, $iWidth, $iHeight) ; flip
    DllCall($ghGDIPDll, "uint", "GdipAddPathPolygon", "hwnd", $hPath, "ptr", $aFFT[0], "int", $aFFT[1])
    _GDIPlus_PathWarp($hPath, 0, $aP_Warp, 0, 0, $iWidth, $iHeight) ; warp
    _GDIPlus_GraphicsFillPath($hGraphics, $hPath, $hBrush)
    _GDIPlus_GraphicsDrawPath($hGraphics, $hPath, $hPen)
    _GDIPlus_PathDispose($hPath)
    EndFunc ;==>_DrawFFT

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

    Func _Exit()
    _BASS_StreamFree($hStream)
    _BASS_Free()
    _GDIPlus_BrushDispose($hBrush_FFT)
    _GDIPlus_BrushDispose($hBrush_WL)
    _GDIPlus_BrushDispose($hBrush_WR)
    _GDIPlus_BrushDispose($hBrush_Pos)
    _GDIPlus_PenDispose($hPen_FFT)
    _GDIPlus_PenDispose($hPen_WL)
    _GDIPlus_PenDispose($hPen_WR)
    _GDIPlus_PenDispose($hPen_Pos)
    _GDIPlus_GraphicsDispose($hGfxBuffer)
    _GDIPlus_BitmapDispose($hBmpBuffer)
    _GDIPlus_GraphicsDispose($hGraphics)
    _GDIPlus_Shutdown()
    Exit
    EndFunc ;==>_Exit

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

    Func WM_PAINT($hWnd, $uMsgm, $wParam, $lParam)
    _GDIPlus_GraphicsDrawImage($hGraphics, $hBmpBuffer, 0, 0)
    Return 'GUI_RUNDEFMSG'
    EndFunc ;==>WM_PAINT

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

    Func WM_ERASEBKGND($hWnd, $uMsgm, $wParam, $lParam)
    _GDIPlus_GraphicsDrawImage($hGraphics, $hBmpBuffer, 0, 0)
    Return True
    EndFunc ;==>WM_ERASEBKGND

    [/autoit]

    Der Hintergrund sollte transparent sein - hab das Script bisher nur auf WinXP getestet...

    Alle benötigten Dateien sind im Anhang enthalten
    Viel Spaß...

    E

    Dateien

    Wave_FFT.zip 260,76 kB – 414 Downloads Vizualizing.zip 263,23 kB – 422 Downloads
  • GDI+ Zoomer

    • eukalyptus
    • 31. August 2010 um 11:05

    OMG wie geil!

    mir fehlen die Worte :thumbup:

  • If und Then

    • eukalyptus
    • 30. August 2010 um 06:37

    Die Errorabfrage direkt hinter FileRead:

    [autoit]

    $sText = FileRead(@ScriptDir & '\notice.txt')
    If @error Or Not $sText Then
    MsgBox(0, "Error", "Konnte Datei nicht öffnen.")
    Exit
    EndIf

    [/autoit]
  • Dreieck mit GDI+ Farbverlauf füllen

    • eukalyptus
    • 14. August 2010 um 19:14

    In der GDIp.au3 findest du die Funktion _GDIPlus_LineBrushCreate.
    Damit kannst du einen Brush mit Farbverlauf erstellen;
    und mit _GDIPlus_GraphicsFillPolygon zeichnest du dann das Dreieck.

    Um das Dreieck in mehrere Farbverläufe zu unterteilen musst du einfach das Dreieck in mehrere Abschnitte teilen...

    mfgE

  • GDI+ Problem

    • eukalyptus
    • 13. August 2010 um 18:31

    Ich verwende immer diese zwei:

    [autoit]

    GUIRegisterMsg($WM_PAINT, "WM_PAINT")
    GUIRegisterMsg($WM_ERASEBKGND, "WM_ERASEBKGND")

    [/autoit][autoit]

    Func WM_PAINT($hWnd, $uMsgm, $wParam, $lParam)
    _GDIPlus_GraphicsDrawImage($hGraphics, $hBmpBuffer, 0, 0)
    Return $GUI_RUNDEFMSG
    EndFunc ;==>WM_PAINT

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

    Func WM_ERASEBKGND($hWnd, $uMsgm, $wParam, $lParam)
    _GDIPlus_GraphicsDrawImage($hGraphics, $hBmpBuffer, 0, 0)
    Return True
    EndFunc ;==>WM_ERASEBKGND

    [/autoit]

    wobei ich mir nicht mal sicher bin, welche der beiden wann zum Einsatz kommt ;)

    mfgE

  • Ablaufende SLEEP Time in einem Tooltip anzeigen - Möglich ?

    • eukalyptus
    • 11. August 2010 um 18:51

    Du kannst mit TimerInit und TimerDiff abeiten...

  • _WinAPI_SetLayeredWindowAttributes

    • eukalyptus
    • 11. August 2010 um 18:40

    Ich glaub, das musst du mit 2 GUIs machen:

    Spoiler anzeigen
    [autoit]

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

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

    $hGui = GUICreate("Main", 195, 195, Default, Default, $WS_POPUP)
    WinSetTrans($hGui, "", 100)
    $hChild = GUICreate("Child", 200, 200, 0, 0, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD), $hGui)
    GUISetBkColor(0xFFFFFF)
    GUICtrlCreateButton("Test", 10, 10)
    _WinAPI_SetLayeredWindowAttributes($hChild, 0xFFFFFF)
    GUISetState(@SW_SHOW, $hChild)
    GUISetState(@SW_SHOW, $hGui)

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

    _GDIPlus_Startup()
    $Graphics = _GDIPlus_GraphicsCreateFromHWND($hChild)
    $PenRect = _GDIPlus_PenCreate(0xFFFFAA00, 10)
    _GDIPlus_GraphicsDrawRect($Graphics, 0, 0, 199, 199, $PenRect)

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

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case -3
    Exit

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

    EndSwitch
    WEnd

    [/autoit]

    mfgE

  • Fehler in meinem Script (Bass.dll)

    • eukalyptus
    • 9. August 2010 um 11:12

    Alle Streams, welche nicht direkt abgespielt werden, müssen Decodingstreams sein; Nur der letzte in der Kette soll ein "normaler" abspielbarer Stream sein.
    File -> Tempo -> Mixer
    Also musst du auch bei Tempocreate $BASS_STREAM_DECODE angeben.

    mfgE

  • Sound erstellen mit Bass.dll

    • eukalyptus
    • 7. August 2010 um 18:01

    Hi

    Ich hab leider grad zuwenig Zeit um ein Beispiel zu erstellen...

    Im Prinzip musst du nur 2 oder mehrere Streams zu einem Mixer-Stream zusammenfassen (BassMix.au3)
    und auf diesen dann einen Encoder setzen:

    $hEncoder = _BASS_Encode_Start($hMixer, @ScriptDir & "\Test.wav", $BASS_ENCODE_PCM) ; erzeugt eine wav-datei
    $hEncoder = _BASS_Encode_Start($hMixer, 'lame -r -x -b128 -h - "' & @ScriptDir & '\Test.mp3"', 0) ; erzeugt eine mp3-datei

    mfgE

  • Bass.dll funktioniert auf Win7 x64 nicht??

    • eukalyptus
    • 2. August 2010 um 08:34

    Hier ist die 64bit Version von BassExt.dll: Der Inhalt kann nicht angezeigt werden, da er nicht mehr verfügbar ist.

    mfgE

    Dateien

    BassExt_64.zip 21,02 kB – 412 Downloads

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™