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

Beiträge von funkey

  • MsgBox bereits offen

    • funkey
    • 10. April 2009 um 18:22

    Mit Parameter aufrufen ;)

    Spoiler anzeigen
    [autoit]

    Global $Restart = 0
    If $CmdLine[0] > 0 Then
    $Restart = 1
    EndIf

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

    If FileExists(@ScriptDir & "\alt.exe") Then
    _1delete()
    _restart()
    Else
    FileCopy("H:\br.exe", @ScriptDir & "\neu.exe")
    EndIf

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

    ; Deletefunktion
    Func _1delete()
    FileDelete(@ScriptDir & "\alt.exe")
    EndFunc ;==>_1delete

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

    ; Restartfunktion
    Func _restart()
    If @Compiled = 1 Then
    MsgBox(0, "Hinweis", "Erfolgreicher Abschluss.")
    Run(FileGetShortName(@ScriptFullPath) & ' Parameter')
    Else
    MsgBox(0, "Hinweis", "Erfolgreicher Abschluss.")
    Run(FileGetShortName(@AutoItExe) & " " & FileGetShortName(@ScriptFullPath) & ' Parameter')
    EndIf
    Exit
    EndFunc ;==>_restart

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

    ; Exitfunktion
    Func OnAutoItExit()
    If $Restart = 0 Then MsgBox(0, "Hinweis", "Ich soll nur einmal aufgerufen werden, nicht aber beim RESTART.")
    EndFunc ;==>OnAutoItExit

    [/autoit]
  • Aktuelles Volume auch unter Vista abfragen

    • funkey
    • 10. April 2009 um 18:06

    Tastenkombination :D

    [autoit]

    Send('{VOLUME_MUTE}')

    [/autoit]


    :P

  • Style für Fensterrahmen

    • funkey
    • 10. April 2009 um 11:55

    Hier wieder mal von mir ein paar Style-Demos ;)

    Spoiler anzeigen
    [autoit]

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

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

    Opt("GUIOnEventMode", 1)
    $titel = "Funkey's Style-Test Example 1"
    $Form1 = GUICreate($titel, 400, 600, -1, -1, $WS_POPUP, $WS_EX_LAYERED)
    GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
    GUISetBkColor(0xffffff)

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

    _GuiRoundCorners($Form1, 0, 0, 30, 30)
    _GuiMakeTransitionBorder($Form1, 55, 0xaa00ff, 0xffffff)
    _WinAPI_SetLayeredWindowAttributes($Form1, 0xffffff, 200)

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

    GUISetState(@SW_SHOW, $Form1)
    Sleep(3000)
    GUIDelete($Form1)

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

    $titel = "Funkey's Style-Test Example 2"
    $Form1 = GUICreate($titel, 400, 600, -1, -1, $WS_POPUP)
    GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
    ;~ GUISetBkColor(0xffffff)

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

    $Close_Label = GUICtrlCreateLabel("×", 350, 15, 20, 20, 0x1201, $WS_EX_CLIENTEDGE)
    GUICtrlSetFont(-1, 14, 0)
    GUICtrlSetBkColor(-1, 0xFFFFFF)
    GUICtrlSetTip(-1, 'Schließen')
    GUICtrlSetOnEvent(-1, '_Exit')

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

    $Titel_Label = GUICtrlCreateLabel($titel, 0, 0, 400, 50, 0x4000201, $GUI_WS_EX_PARENTDRAG)
    GUICtrlSetFont(-1, 12, 1000)
    GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
    GUICtrlSetColor(-1, 0xffffff)

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

    _GuiRoundCorners($Form1, 0, 0, 30, 30)
    _CreateColorTransition(0, 0, 400, 50, 0xFFFFFF, 0x0000FF, 0, 2)

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

    $Button1 = _GuiCreateRoundPicButton($Form1, 170, 100, 60, 150, '_Button', @DocumentsCommonDir & '\Eigene Bilder\Beispielbilder\Winter.jpg')
    $Button2 = _GuiCreateRoundButton($Form1, 120, 300, 160, 50, '_Button', 0xFFFF00, 'Testbutton', 20)
    $Button3 = _GuiCreateRoundPicButton($Form1, 150, 400, 100, 100, '_Button', @DocumentsCommonDir & '\Eigene Bilder\Beispielbilder\Sonnenuntergang.jpg', 'bla')

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

    GUICtrlCreatePic(@DocumentsCommonDir & '\Eigene Bilder\Beispielbilder\Blaue Berge.jpg', 0, 50, 400, 550, 0x04000000)

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

    GUISetState(@SW_SHOW, $Form1)

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

    While 1
    Sleep(10000)
    WEnd

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

    Func _Button()
    Switch @GUI_WinHandle
    Case $Button1[0]
    MsgBox(0, "Runder Button", "Button 1 wurde gedrückt")
    Case $Button2[0]
    MsgBox(0, "Runder Button", "Button 2 wurde gedrückt")
    Case $Button3[0]
    MsgBox(0, "Runder Button", "Button 3 wurde gedrückt")
    EndSwitch
    EndFunc ;==>_Button

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

    Func _GuiCreateRoundPicButton($hWndParent, $iPosx, $iPosy, $iWidth, $iHeight, $sFunc, $sFileBg, $sText = "", $iTextSize = -1)
    Return _GuiCreateRoundButton($hWndParent, $iPosx, $iPosy, $iWidth, $iHeight, $sFunc, -1, $sText, $iTextSize, 1, -1, $sFileBg)
    EndFunc

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

    Func _GuiMakeTransitionBorder($hwnd, $iSize, $nColor_out, $nColor_in)
    ; funkey
    Local $Width, $Height, $aPos, $hGraphic
    Local $startRot, $startGruen, $startBlau, $endRot, $endGruen, $endBlau, $Color
    Local $ColorOffsetRot, $ColorOffsetGruen, $ColorOffsetBlau
    $aPos = WinGetPos($hwnd)
    $Width = $aPos[2]
    $Height = $aPos[3]
    $startRot = _ColorGetRed($nColor_out)
    $startGruen = _ColorGetGreen($nColor_out)
    $startBlau = _ColorGetBlue($nColor_out)
    $endRot = _ColorGetRed($nColor_in)
    $endGruen = _ColorGetGreen($nColor_in)
    $endBlau = _ColorGetBlue($nColor_in)
    $ColorOffsetRot = ($endRot - $startRot) / $iSize
    $ColorOffsetGruen = ($endGruen - $startGruen) / $iSize
    $ColorOffsetBlau = ($endBlau - $startBlau) / $iSize

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

    $hGraphic = GUICtrlCreateGraphic(0, 0, $Width, $Height, 0)
    For $i = 0 To $iSize - 1
    $Color = '0x' & Hex($startRot + $ColorOffsetRot * ($i + 1), 2) & Hex($startGruen + $ColorOffsetGruen * ($i + 1), 2) & Hex($startBlau + $ColorOffsetBlau * ($i + 1), 2)
    GUICtrlSetGraphic(-1, $GUI_GR_COLOR, $Color)
    GUICtrlSetGraphic(-1, $GUI_GR_MOVE, 0 + $i, $i)
    GUICtrlSetGraphic(-1, $GUI_GR_LINE, $Width - $i, $i)
    GUICtrlSetGraphic(-1, $GUI_GR_COLOR, $Color)
    GUICtrlSetGraphic(-1, $GUI_GR_MOVE, 0 + $i, $Height - $i - 1)
    GUICtrlSetGraphic(-1, $GUI_GR_LINE, $Width - $i, $Height - $i - 1)
    GUICtrlSetGraphic(-1, $GUI_GR_COLOR, $Color)
    GUICtrlSetGraphic(-1, $GUI_GR_MOVE, $i, 0 + $i)
    GUICtrlSetGraphic(-1, $GUI_GR_LINE, $i, $Height - $i)
    GUICtrlSetGraphic(-1, $GUI_GR_COLOR, $Color)
    GUICtrlSetGraphic(-1, $GUI_GR_MOVE, $Width - $i - 1, 0 + $i)
    GUICtrlSetGraphic(-1, $GUI_GR_LINE, $Width - $i - 1, $Height - $i)
    Next
    EndFunc ;==>_GuiMakeTransitionBorder

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

    Func _CreateColorTransition($iPosx, $iPosy, $iWidth, $iHeight, $nColorStart, $nColorEnd, $iAlignment = 0, $iWaveFaktor = 1)
    ; funkey
    Local $startRot, $startGruen, $startBlau, $endRot, $endGruen, $endBlau, $Color
    Local $ColorOffsetRot, $ColorOffsetGruen, $ColorOffsetBlau, $Grafik
    $startRot = _ColorGetRed($nColorStart)
    $startGruen = _ColorGetGreen($nColorStart)
    $startBlau = _ColorGetBlue($nColorStart)
    $endRot = _ColorGetRed($nColorEnd)
    $endGruen = _ColorGetGreen($nColorEnd)
    $endBlau = _ColorGetBlue($nColorEnd)
    $Grafik = GUICtrlCreateGraphic($iPosx, $iPosy, $iWidth, $iHeight, 0)
    GUICtrlSetState(-1, $GUI_DISABLE)
    $iHeight += $iWaveFaktor - Mod($iHeight, $iWaveFaktor)
    Switch $iAlignment
    Case 0
    $ColorOffsetRot = ($endRot - $startRot) / ($iHeight / $iWaveFaktor)
    $ColorOffsetGruen = ($endGruen - $startGruen) / ($iHeight / $iWaveFaktor)
    $ColorOffsetBlau = ($endBlau - $startBlau) / ($iHeight / $iWaveFaktor)
    Switch Mod($iWaveFaktor, 2)
    Case 0
    For $w = 1 To $iWaveFaktor - 1 Step 2
    For $i = ($w - 1) * ($iHeight / $iWaveFaktor) To ($w) * ($iHeight / $iWaveFaktor) - 1
    $Color = '0x' & Hex($startRot + $ColorOffsetRot * ($i + 1 - (($w - 1) * $iHeight / $iWaveFaktor)), 2) & _
    Hex($startGruen + $ColorOffsetGruen * ($i + 1 - (($w - 1) * $iHeight / $iWaveFaktor)), 2) & _
    Hex($startBlau + $ColorOffsetBlau * ($i + 1 - (($w - 1) * $iHeight / $iWaveFaktor)), 2)
    GUICtrlSetGraphic(-1, $GUI_GR_COLOR, $Color)
    GUICtrlSetGraphic(-1, $GUI_GR_MOVE, 0, $i)
    GUICtrlSetGraphic(-1, $GUI_GR_LINE, $iWidth, $i)
    Next
    For $i = $w * ($iHeight / $iWaveFaktor) To ($w + 1) * ($iHeight / $iWaveFaktor) - 1
    $Color = '0x' & Hex($endRot - $ColorOffsetRot * ($i - ($w * $iHeight / $iWaveFaktor) + 1), 2) & _
    Hex($endGruen - $ColorOffsetGruen * ($i - ($w * $iHeight / $iWaveFaktor) + 1), 2) & _
    Hex($endBlau - $ColorOffsetBlau * ($i - ($w * $iHeight / $iWaveFaktor) + 1), 2)
    GUICtrlSetGraphic(-1, $GUI_GR_COLOR, $Color)
    GUICtrlSetGraphic(-1, $GUI_GR_MOVE, 0, $i)
    GUICtrlSetGraphic(-1, $GUI_GR_LINE, $iWidth, $i)
    Next
    Next
    Case 1
    For $i = 0 To $iHeight - 1
    $Color = '0x' & Hex($startRot + $ColorOffsetRot * ($i + 1), 2) & _
    Hex($startGruen + $ColorOffsetGruen * ($i + 1), 2) & _
    Hex($startBlau + $ColorOffsetBlau * ($i + 1), 2)
    GUICtrlSetGraphic(-1, $GUI_GR_COLOR, $Color)
    GUICtrlSetGraphic(-1, $GUI_GR_MOVE, 0, $i)
    GUICtrlSetGraphic(-1, $GUI_GR_LINE, $iWidth, $i)
    Next
    EndSwitch
    Case Else
    $ColorOffsetRot = ($endRot - $startRot) / ($iWidth / $iWaveFaktor)
    $ColorOffsetGruen = ($endGruen - $startGruen) / ($iWidth / $iWaveFaktor)
    $ColorOffsetBlau = ($endBlau - $startBlau) / ($iWidth / $iWaveFaktor)
    Switch Mod($iWaveFaktor, 2)
    Case 0
    For $w = 1 To $iWaveFaktor - 1 Step 2
    For $i = ($w - 1) * ($iWidth / $iWaveFaktor) To ($w) * ($iWidth / $iWaveFaktor) - 1
    $Color = '0x' & Hex($startRot + $ColorOffsetRot * ($i + 1 - (($w - 1) * $iWidth / $iWaveFaktor)), 2) & _
    Hex($startGruen + $ColorOffsetGruen * ($i + 1 - (($w - 1) * $iWidth / $iWaveFaktor)), 2) & _
    Hex($startBlau + $ColorOffsetBlau * ($i + 1 - (($w - 1) * $iWidth / $iWaveFaktor)), 2)
    GUICtrlSetGraphic(-1, $GUI_GR_COLOR, $Color)
    GUICtrlSetGraphic(-1, $GUI_GR_MOVE, $i, 0)
    GUICtrlSetGraphic(-1, $GUI_GR_LINE, $i, $iHeight)
    Next
    For $i = $w * ($iWidth / $iWaveFaktor) To ($w + 1) * ($iWidth / $iWaveFaktor) - 1
    $Color = '0x' & Hex($endRot - $ColorOffsetRot * ($i - ($w * $iWidth / $iWaveFaktor) + 1), 2) & _
    Hex($endGruen - $ColorOffsetGruen * ($i - ($w * $iWidth / $iWaveFaktor) + 1), 2) & _
    Hex($endBlau - $ColorOffsetBlau * ($i - ($w * $iWidth / $iWaveFaktor) + 1), 2)
    GUICtrlSetGraphic(-1, $GUI_GR_COLOR, $Color)
    GUICtrlSetGraphic(-1, $GUI_GR_MOVE, $i, 0)
    GUICtrlSetGraphic(-1, $GUI_GR_LINE, $i, $iHeight)
    Next
    Next
    Case 1
    For $i = 0 To $iHeight - 1
    $Color = '0x' & Hex($startRot + $ColorOffsetRot * ($i + 1), 2) & _
    Hex($startGruen + $ColorOffsetGruen * ($i + 1), 2) & _
    Hex($startBlau + $ColorOffsetBlau * ($i + 1), 2)
    GUICtrlSetGraphic(-1, $GUI_GR_COLOR, $Color)
    GUICtrlSetGraphic(-1, $GUI_GR_MOVE, 0, $i)
    GUICtrlSetGraphic(-1, $GUI_GR_LINE, $iWidth, $i)
    Next
    EndSwitch
    EndSwitch
    Return $Grafik
    EndFunc ;==>_CreateColorTransition

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

    Func _GuiCreateRoundButton($hWndParent, $iPosx, $iPosy, $iWidth, $iHeight, $sFunc, $iColor = -1, $sText = "", $iTextSize = -1, $iAlignment = 1, $iWaveFaktor = -1, $sFileBg = "")
    ; funkey
    Local $ret, $ret2, $Button[3]
    If $iColor = -1 Then $iColor = 0x000000
    If $iTextSize = -1 Then $iTextSize = 10
    If $iWaveFaktor = -1 Or (Mod($iWaveFaktor, 2) = 1 And $iWaveFaktor <> 1) Or $iWaveFaktor > 40 Then $iWaveFaktor = 2
    $Button[0] = GUICreate("", $iWidth, $iHeight, $iPosx, $iPosy, 0x41000000, -1, $hWndParent)
    WinMove($Button[0], "", $iPosx, $iPosy)
    GUISetCursor(0, 1)
    If $sFileBg <> "" Then
    $Button[2] = GUICtrlCreatePic($sFileBg, 0, 0, $iWidth, $iHeight, 0)
    Else
    If $iWaveFaktor = 0 Then
    GUISetBkColor($iColor)
    $Button[2] = GUICtrlCreateGraphic(0, 0, $iWidth, $iHeight, 0)
    GUICtrlSetGraphic(-1, $GUI_GR_PENSIZE, 3)
    GUICtrlSetGraphic(-1, $GUI_GR_COLOR, 0x0)
    GUICtrlSetGraphic(-1, $GUI_GR_ELLIPSE, 0, 0, $iWidth-1, $iHeight-1)
    Else
    $Button[2] = _CreateColorTransition(0, 0, $iWidth, $iHeight, $iColor, 0xFFFFFF, $iAlignment, $iWaveFaktor)
    EndIf
    EndIf
    $Button[1] = GUICtrlCreateLabel($sText, 0, 0, $iWidth, $iHeight, 0x00000301, 0x00000008)
    GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
    GUICtrlSetColor(-1, 0x0)
    GUICtrlSetFont(-1, $iTextSize, 1000)
    GUICtrlSetOnEvent(-1, $sFunc)
    $ret = DllCall('gdi32.dll', 'long', 'CreateRoundRectRgn', 'long', 0, 'long', 0, 'long', $iWidth, 'long', $iHeight, 'long', $iHeight, 'long', $iWidth)
    If $ret[0] Then
    $ret2 = DllCall('user32.dll', 'long', 'SetWindowRgn', 'hwnd', $Button[0], 'long', $ret[0], 'int', 1)
    If $ret2[0] Then
    Else
    SetError(1)
    EndIf
    Else
    SetError(2)
    EndIf
    GUISetState()
    GUISwitch($hWndParent)
    Return $Button
    EndFunc ;==>_GuiCreateRoundButton

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

    Func _GuiRoundCorners($hwnd, $x1, $y1, $x3, $y3)
    Local $pos, $ret, $ret2
    $pos = WinGetPos($hwnd)
    $ret = DllCall('gdi32.dll', 'long', 'CreateRoundRectRgn', 'long', $x1, 'long', $y1, 'long', $pos[2], 'long', $pos[3], 'long', $x3, 'long', $y3)
    If $ret[0] Then
    $ret2 = DllCall('user32.dll', 'long', 'SetWindowRgn', 'hwnd', $hwnd, 'long', $ret[0], 'int', 1)
    If $ret2[0] Then
    Return 1
    Else
    Return 0
    EndIf
    Else
    Return 0
    EndIf
    EndFunc ;==>_GuiRoundCorners

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

    Func _WinAPI_SetLayeredWindowAttributes($hwnd, $i_transcolor, $Transparency = 255, $dwFlages = 0x03, $isColorRef = False)
    ; progandy
    If $dwFlages = Default Or $dwFlages = "" Or $dwFlages < 0 Then $dwFlages = 0x03
    If Not $isColorRef Then
    $i_transcolor = Hex(String($i_transcolor), 6)
    $i_transcolor = Execute('0x00' & StringMid($i_transcolor, 5, 2) & StringMid($i_transcolor, 3, 2) & StringMid($i_transcolor, 1, 2))
    EndIf
    Local $Ret = DllCall("user32.dll", "int", "SetLayeredWindowAttributes", "hwnd", $hwnd, "long", $i_transcolor, "byte", $Transparency, "long", $dwFlages)
    Select
    Case @error
    Return SetError(@error, 0, 0)
    Case $Ret[0] = 0
    Return SetError(4);, _WinAPI_GetLastError(), 0) ;modified by funkey
    Case Else
    Return 1
    EndSelect
    EndFunc ;==>_WinAPI_SetLayeredWindowAttributes

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

    Func _Exit()
    Exit
    EndFunc ;==>_Exit

    [/autoit]
  • Icon dynamisch erstellen

    • funkey
    • 9. April 2009 um 19:40

    Jetzt habe ich es nochmal verändert. So bleibt das Icon immer an erster Stelle.

    Spoiler anzeigen
    [autoit]

    #include <WindowsConstants.au3>
    #include 'systray.au3'

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

    TraySetIcon("Shell32.dll", -50)
    Opt('TrayIconHide', 0)
    Opt('GUIOnEventMode', 1)

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

    HotKeySet('{ESC}', '_Ende')

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

    Global $aPos, $iIconIndex, $Titel = 'Icon-Fake', $sProcess = 'Autoit3.exe'
    If @Compiled Then $sProcess = @ScriptName

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

    $iIconIndex = _SysTrayIconIndex($sProcess)
    $aPos = _SysTrayIconPosSize($iIconIndex)

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

    Global $IconGui = GUICreate($Titel, $aPos[2], $aPos[3], 0, 0, $WS_POPUP)
    GUISetOnEvent(-3, '_Ende')
    GUISetBkColor(0x00FF00)
    DllCall("user32.dll", "int", "SetParent", "hwnd", $IconGui, "hwnd", _FindTrayToolbarWindow())

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

    Global $Label = GUICtrlCreateLabel(@SEC, 0, 0, 17, 18, 0x201)
    GUICtrlSetTip(-1, 'Sekunden')

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

    GUISetState()

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

    AdlibEnable('_Zyklus', 1000)

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

    While 1
    Sleep(10000)
    WEnd

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

    Func _Zyklus()
    Local $iIconIndexNew = _SysTrayIconIndex($sProcess)
    If $iIconIndex <> $iIconIndexNew Then
    _SysTrayIconMove($iIconIndexNew, 0)
    EndIf
    $iIconIndex = $iIconIndexNew
    GUICtrlSetData($Label, @SEC)
    EndFunc ;==>_Zyklus

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

    Func _Ende()
    Exit
    EndFunc ;==>_Ende

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

    ;===============================================================================
    ;
    ; Function Name: _SysTrayIconPosSize($iIndex=0)
    ; Description: Gets x & y position of systray icon,
    ; You get also width and height
    ; Parameter(s): $iIndex = icon index (Note: starting from 0)
    ;
    ; Requirement(s): AutoIt3 Beta
    ; Return Value(s): On Success - Returns x [0] and y [1] position of icon
    ; [2] for width and [3] for height
    ; On Failure - Returns -1 if icon is hidden (Autohide on XP etc.)
    ; Sets error to 1 if some internal error happens
    ;
    ; Author(s): Tuape
    ; Modified: funkey, just width and height
    ;
    ;===============================================================================
    Func _SysTrayIconPosSize($iIndex = 0)
    ;=========================================================
    ; Create the struct _TBBUTTON
    ; struct {
    ; int iBitmap;
    ; int idCommand;
    ; BYTE fsState;
    ; BYTE fsStyle;
    ;
    ; #ifdef _WIN64
    ; BYTE bReserved[6] // padding for alignment
    ; #elif defined(_WIN32)
    ; BYTE bReserved[2] // padding for alignment
    ; #endif
    ; DWORD_PTR dwData;
    ; INT_PTR iString;

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

    ; }
    ;=========================================================
    Local $str = "int;int;byte;byte;byte[2];dword;int"
    Dim $TBBUTTON = DllStructCreate($str)
    Dim $TBBUTTON2 = DllStructCreate($str)
    Dim $ExtraData = DllStructCreate("dword[2]")
    Dim $lpData
    Dim $RECT

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

    Local $pId
    Local $text
    Local $procHandle
    Local $index = $iIndex
    Local $bytesRead
    Local $info
    Local $pos[4]
    Local $hidden = 0
    Local $trayHwnd
    Local $ret

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

    $trayHwnd = _FindTrayToolbarWindow()
    If $trayHwnd = -1 Then
    $TBBUTTON = 0
    $TBBUTTON2 = 0
    $ExtraData = 0
    SetError(1)
    Return -1
    EndIf

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

    $ret = DllCall("user32.dll", "int", "GetWindowThreadProcessId", "hwnd", $trayHwnd, "int*", -1)
    If Not @error Then
    $pId = $ret[2]
    Else
    ConsoleWrite("Error: Could not find toolbar process id, " & @error & @LF)
    $TBBUTTON = 0
    $TBBUTTON2 = 0
    $ExtraData = 0
    SetError(1)
    Return -1
    EndIf
    $procHandle = DllCall("kernel32.dll", 'int', 'OpenProcess', 'int', $PROCESS_ALL_ACCESS, 'int', False, 'int', $pId)
    If @error Then
    ConsoleWrite("Error: Could not read toolbar process memory, " & @error & @LF)
    $TBBUTTON = 0
    $TBBUTTON2 = 0
    $ExtraData = 0
    SetError(1)
    Return -1
    EndIf

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

    $lpData = DllCall("kernel32.dll", "int", "VirtualAllocEx", "int", $procHandle[0], "int", 0, "int", DllStructGetSize($TBBUTTON), "int", 0x1000, "int", 0x04)
    If @error Then
    ConsoleWrite(@CRLF & "VirtualAllocEx Error" & @LF)
    $TBBUTTON = 0
    $TBBUTTON2 = 0
    $ExtraData = 0
    SetError(1)
    Return -1
    Else
    DllCall("user32.dll", "int", "SendMessage", "hwnd", $trayHwnd, "int", $TB_GETBUTTON, "int", $index, "ptr", $lpData[0])
    DllCall('kernel32.dll', 'int', 'ReadProcessMemory', 'int', $procHandle[0], 'int', $lpData[0], 'ptr', DllStructGetPtr($TBBUTTON2), 'int', DllStructGetSize($TBBUTTON), 'int', $bytesRead)
    DllCall('kernel32.dll', 'int', 'ReadProcessMemory', 'int', $procHandle[0], 'int', DllStructGetData($TBBUTTON2, 6), 'int', DllStructGetPtr($ExtraData), 'int', DllStructGetSize($ExtraData), 'int', $bytesRead)

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

    $info = DllStructGetData($ExtraData, 1, 1)
    If Not BitAND(DllStructGetData($TBBUTTON2, 3), 8) Then ; 8 = TBHIDDEN

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

    $str = "int;int;int;int"
    $RECT = DllStructCreate($str)

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

    DllCall("user32.dll", "int", "SendMessage", "hwnd", $trayHwnd, "int", $TB_GETITEMRECT, "int", $index, "ptr", $lpData[0])
    DllCall('kernel32.dll', 'int', 'ReadProcessMemory', 'int', $procHandle[0], 'int', $lpData[0], 'ptr', DllStructGetPtr($RECT), 'int', DllStructGetSize($RECT), 'int', $bytesRead)

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

    $ret = DllCall("user32.dll", "int", "MapWindowPoints", "hwnd", $trayHwnd, "int", 0, 'ptr', DllStructGetPtr($RECT), "int", 2)
    ;~ ConsoleWrite("Info: " & $info & "RECT[0](left): " & DllStructGetData($RECT, 1) & "RECT[1](top): " & DllStructGetData($RECT, 2) & "RECT[2](right): " & DllStructGetData($RECT, 3) & "RECT[3](bottom): " & DllStructGetData($RECT, 4) & @LF)

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

    $pos[0] = DllStructGetData($RECT, 1)
    $pos[1] = DllStructGetData($RECT, 2)
    $pos[2] = DllStructGetData($RECT, 3) - $pos[0]
    $pos[3] = DllStructGetData($RECT, 4) - $pos[1]
    $RECT = 0
    Else
    $hidden = 1
    EndIf

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

    DllCall("kernel32.dll", "int", "VirtualFreeEx", "int", $procHandle[0], "ptr", $lpData[0], "int", 0, "int", 0x8000) ;DllStructGetSize ( $TBBUTTON ), "int", 0x8000)
    EndIf

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

    DllCall('kernel32.dll', 'int', 'CloseHandle', 'int', $procHandle[0])
    $TBBUTTON = 0
    $TBBUTTON2 = 0
    $ExtraData = 0

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

    If $hidden <> 1 Then
    Return $pos
    Else
    Return -1
    EndIf
    EndFunc ;==>_SysTrayIconPosSize

    [/autoit]
  • Icon dynamisch erstellen

    • funkey
    • 9. April 2009 um 18:27

    Hab es mal mit einem Trick versucht :D

    Spoiler anzeigen
    [autoit]

    #include <WindowsConstants.au3>

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

    TraySetIcon("Shell32.dll", -50)
    Opt('TrayIconHide', 0)
    Opt('GUIOnEventMode', 1)

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

    HotKeySet('{ESC}', '_Ende')

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

    Global $Titel = 'Icon-Fake'

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

    Global $IconGui = GUICreate($Titel, 17, 18, 0, 0, $WS_POPUP)
    GUISetOnEvent(-3, '_Ende')
    GUISetBkColor(0x00FF00)
    DllCall("user32.dll", "int", "SetParent", "hwnd", $IconGui, "hwnd", _FindTrayToolbarWindow())
    WinMove($IconGui, "", 0, 0)

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

    Global $Label = GUICtrlCreateLabel(@SEC, 0, 0, 17, 18, 0x201)
    GUICtrlSetTip(-1, 'Sekunden')

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

    GUISetState()

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

    AdlibEnable('_Zyklus', 1000)

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

    While 1
    Sleep(10000)
    WEnd

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

    Func _Zyklus()
    GUICtrlSetData($Label, @SEC)
    EndFunc ;==>_Zyklus

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

    Func _Ende()
    Exit
    EndFunc ;==>_Ende

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

    ;===============================================================================
    ;
    ; Function Name: _FindTrayToolbarWindow
    ; Description: Utility function for finding Toolbar window hwnd
    ; Parameter(s): None
    ;
    ; Requirement(s): AutoIt3 Beta
    ; Return Value(s): On Success - Returns Toolbar window hwnd
    ; On Failure - returns -1
    ;
    ; Author(s): Tuape
    ;
    ;===============================================================================
    Func _FindTrayToolbarWindow()
    Local $hWnd = DLLCall("user32.dll","hwnd","FindWindow", "str", "Shell_TrayWnd", "int", 0)

    if @error Then return -1
    $hWnd = DLLCall("user32.dll","hwnd","FindWindowEx", "hwnd", $hWnd[0], "int", 0, "str", "TrayNotifyWnd", "int", 0);FindWindowEx(hWnd,NULL,_T("TrayNotifyWnd"), NULL);
    if @error Then return -1
    If @OSVersion <> "WIN_2000" Then
    $hWnd = DLLCall("user32.dll","hwnd","FindWindowEx", "hwnd", $hWnd[0], "int", 0, "str", "SysPager", "int", 0);FindWindowEx(hWnd,NULL,_T("TrayNotifyWnd"), NULL);
    if @error Then return -1
    EndIf
    $hWnd = DLLCall("user32.dll","hwnd","FindWindowEx", "hwnd", $hWnd[0], "int", 0, "str", "ToolbarWindow32", "int", 0);FindWindowEx(hWnd,NULL,_T("TrayNotifyWnd"), NULL);
    if @error Then return -1

    Return $hWnd[0]
    EndFunc

    [/autoit]
  • Text per Drag&Dop verschieben

    • funkey
    • 8. April 2009 um 19:18

    Meinst du so?

    Spoiler anzeigen
    [autoit]

    #Include <Misc.au3>

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

    Opt('GUIOnEventMode', 1)
    Global $title = "Drag & Drop"

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

    GUICreate($title)
    GUISetOnEvent(-3, '_Ende')

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

    GUICtrlCreateLabel("Drag Me", 100, 100)
    GUICtrlSetOnEvent(-1, '_DragMe')
    GUICtrlSetCursor(-1, 0)

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

    GUISetState()

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

    While 1
    Sleep(10000)
    WEnd

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

    Func _Ende()
    Exit
    EndFunc

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

    Func _DragMe()
    Local $Pos_C, $Pos_M, $Opt_old, $x_Offset, $y_Offset
    Local $dll = DllOpen("user32.dll")

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

    $Opt_old = Opt('MouseCoordMode', 0)
    $Pos_C = ControlGetPos($title, "", @GUI_CtrlId)
    $Pos_M = MouseGetPos()
    $x_Offset = $Pos_M[0] - $Pos_C[0]
    $y_Offset = $Pos_M[1] - $Pos_C[1]
    While _IsPressed('01', $dll)
    $Pos_M = MouseGetPos()
    GUICtrlSetPos(@GUI_CtrlId, $Pos_M[0] - $x_Offset, $Pos_M[1] - $y_Offset)
    Sleep(10)
    WEnd
    DllClose($dll)
    Opt('MouseCoordMode', $Opt_old)
    EndFunc

    [/autoit]
  • Abfrage - Wenn Task nicht exestiert...

    • funkey
    • 8. April 2009 um 19:03
    So?
    [autoit]

    If Not ProcessExists('process.exe') Then
    ;~ ....
    Else
    ;~ ....
    EndIf

    [/autoit] [autoit][/autoit] [autoit][/autoit]
  • Doppelte aussortieren

    • funkey
    • 8. April 2009 um 18:17
    Spoiler anzeigen
    [autoit]

    #include <array.au3>
    #include <file.au3>

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

    Local $file = @ScriptDir & "\Neu Textdokument.txt"
    Local $array, $arrayNew

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

    _FileReadToArray($file, $array)
    _ArrayDisplay($array, 'Datei')
    $arrayNew = _ArrayUnique($array, 1, 1)
    _ArrayDisplay($arrayNew, 'Unique')

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

    _ArrayDelete($array, 0)

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

    For $i = 1 To $arrayNew[0]
    _ArrayDelete($array, _ArraySearch($array, $arrayNew[$i]))
    Next

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

    _ArrayDisplay($array, 'Doppelte')

    [/autoit]
  • Doppelte aussortieren

    • funkey
    • 8. April 2009 um 17:44
    Spoiler anzeigen
    [autoit]

    #include <array.au3>
    #include <file.au3>

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

    Local $file = @ScriptDir & "\Neu Textdokument.txt"
    Local $array, $arrayNew

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

    _FileReadToArray($file, $array)
    _ArrayDisplay($array)
    _ArrayDelete($array, 0)
    $arrayNew = _ArrayUnique($array)
    _ArrayDisplay($arrayNew)

    [/autoit] [autoit][/autoit] [autoit][/autoit]
  • Forum als gelesen markieren

    • funkey
    • 8. April 2009 um 16:59

    Ich habe es schon oft probiert, alle Foren gleichzeitig als gelesen zu markieren, aber es funktioniert nicht.
    Dieser Link funktioniert bei mir nicht mit dem IE7 und mit K-Meleon.

  • Forum als gelesen markieren

    • funkey
    • 7. April 2009 um 20:28

    Ich weiß nicht wieso man das ganze Forum nicht als gelesen markieren kann (einen Link, der nicht funktioniert, gibt es aber), ich habe mir deswegen ein Skript gemacht, dass das für mich erledigt.

    Spoiler anzeigen
    [autoit]

    #include <IE.au3>

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

    Local $aForenID[33] = [ _
    2, _ ;Autoit 3 - Hilfe und Unterstützung
    39, _ ;Autoit 3 - Hilfe und Unterstützung - Datenbanken
    34, _ ;Autoit 3 - Hilfe und Unterstützung - Bot-Coding
    3, _ ;Autoit 3 - Skripte
    36, _ ;Autoit 3 - Skripte - Wettbewerbe
    7, _ ;Autoit 3 - Projekte
    18, _ ;Autoit 3 - Projekte - Galenda
    24, _ ;Autoit 3 - Projekte - n00b-Projekt
    31, _ ;Autoit 3 - Projekte - IDEs
    32, _ ;Autoit 3 - Projekte - Firefox-Automatisierung
    8, _ ;Autoit 3 - Filebase
    23, _ ;Autoit 3 - Entwickler
    38, _ ;Autoit 3 - Entwickler - Datenbankzugriff
    35, _ ;Autoit 3 - Jobbörse
    22, _ ;Übersetzung der Hilfe-Datei ins Deutsche - Allgemeines
    41, _ ;Install-O-Matic - IOM 4
    42, _ ;Install-O-Matic - IOM 4 - Bugs
    44, _ ;Install-O-Matic - IOM 4 - Installationsskripte
    43, _ ;Install-O-Matic - IOM 4 - Vorschläge
    29, _ ;Install-O-Matic - IOM 3 - Installationsskripte
    30, _ ;Install-O-Matic - IOM 3 - Fragen & Kritik
    13, _ ;Install-O-Matic - IOM 2 - Bug-Report
    14, _ ;Install-O-Matic - IOM 2 - Kritik
    15, _ ;Install-O-Matic - IOM 2 - Installationsskripte
    5, _ ;Sonstiges - News
    11, _ ;Sonstiges - News - News Archiv
    6, _ ;Sonstiges - Testforum
    9, _ ;Sonstiges - Uservorstellung
    16, _ ;Sonstiges - Filebasefreischaltung
    17, _ ;Sonstiges - Hangman
    25, _ ;Sonstiges - Talk
    10, _ ;Sonstiges - Off-Topic
    33] ;Sonstiges - Off-Topic - Java

    Local $url1 = 'http://www.autoit.de/index.php?page=Board&boardID=', $url2 = '&action=markAsRead'
    Local $oIE = _IECreate("about:blank", 0, 0)

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

    For $i = 0 To UBound($aForenID) -1
    TrayTip('Bitte warten', 'Forum '&$aForenID[$i]&' wird als gelesen gekennzeichnet!', 5, 1)
    _IENavigate($oIE, $url1 & $aForenID[$i] & $url2)
    Next

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

    _IEQuit($oIE)

    [/autoit]

    Sollte der 'Gesamt-Link' wieder gehen, oder gibt es andere schnellere Möglichkeiten, dann bitte hier posten. ;)

  • Msg Editor

    • funkey
    • 7. April 2009 um 18:42

    Bug: #include <GUI.au3> sollte #include <GUIConstantsEx.au3> heißen

    Anmerkungen: kann nützlich sein

    Hinweis: Wenn man Scite4Autoit installiert hat, kann man das selbe mit dem CodeWizard machen und noch ein bischen mehr ;)

  • Schleifen-Problem

    • funkey
    • 7. April 2009 um 18:13

    Bei Switch und Select gibt es immer nur einen Zweig, der ausgeführt wird, der erste, der passt. Deswegen:

    [autoit]

    $DeleteUselessFiles = 2

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

    Select
    Case $DeleteUselessFiles = 1 ; ;)
    FileDelete($Ordner & "\XXXX.xxx")
    FileDelete($Ordner & "\XXXX.xxx")
    FileDelete($Ordner & "\XXXX.xxx")
    FileDelete($Ordner & "\XXXX.xxx")
    FileDelete($Ordner & "\XXXX.xxx")
    Case $DeleteUselessFiles >= 2
    FileDelete($Ordner & "\XXXX.xxx")
    EndSelect

    [/autoit]

    Edit: Hab ja ganz 'ContinueCase' vergessen, damit kann man natürlich mehrere Cases auf einmal durchmachen.

  • AutoIt und MsiExec.exe mehrere instanzen

    • funkey
    • 7. April 2009 um 18:09

    zu 1.: Braucht man bei Einzeilern wirklich nicht.

    zu 2.: Jedes RegRead schreibt das Makro @error neu

    zu 3.: z.B. Spoiler automatisch auslesen :D

  • AutoIt und MsiExec.exe mehrere instanzen

    • funkey
    • 7. April 2009 um 17:48

    Hab keinen Fehler gesehen, außer diesem

    Zitat von fis4test

    Aber mein Grund funzt aus irgendeinem Code nicht immer?!?!

    :rofl:

    Hab das jetzt aber mal abgekürtzt für dich zum testen.

    Spoiler anzeigen
    [autoit]

    RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{1509BFC3-CA03-4871-B406-094840928}", "UninstallString")
    If Not @error Then RunWait("MsiExec.exe /X{1509BFC3-CA03-4871-B406-094840928} /QN /NORESTART")

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

    RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{25E5949A-EF9F-406F-BAAC-092483483}", "UninstallString")
    If Not @error Then RunWait("MsiExec.exe /X{25E5949A-EF9F-406F-BAAC-092483483} /QN /NORESTART")

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

    RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{5CA1FC78-1829-4431-A384-98740938029809}", "UninstallString")
    If Not @error Then RunWait("MsiExec.exe /X{5CA1FC78-1829-4431-A384-98740938029809} /QN /NORESTART")

    [/autoit]
  • Multi Core CPU Auslast

    • funkey
    • 7. April 2009 um 17:27

    Bitboy: Ich finde deine Funktion '_GetCPUUsage()' super. Hab sie jetzt auf einem SingleCore- und einem DualCore-Rechner getestet und das Ergebnis sieht sehr gut aus! :thumbup:

  • _IsPressed() will nicht...

    • funkey
    • 6. April 2009 um 19:12

    @progandy: Wusste ich gar nicht. Wo steht das?

  • _IsPressed() will nicht...

    • funkey
    • 6. April 2009 um 18:52

    Ich glaube dein Problem liegt in dem relativ langen Sleep, da wenn du während des Sleeps klickst, das nachfolgende _IsPressed das nicht mitbekommt. Verkürze mal die Zeit auf 1 Millisekunde zum testen.

  • Hotkeys nur wenn Fenster im vordergrund ist?

    • funkey
    • 6. April 2009 um 18:44

    Dann schau dir GUISetAccelerators an.

  • Mit GDI+ auf einzelnes Control zeichnen

    • funkey
    • 6. April 2009 um 17:03

    Mit GDI+ dürfte das kein Problem sein, da man dann beim Registerwechsel einfach ein neues Bild zeichnen lassen kann.
    Herkömmlich würde es auch gehen, wenn man pro Register eine Childgui mit dem entsprechenden Hintergrundbild anlegt. Diese muss man dann je nachdem welches Register angewählt ist, sichtbar oder unsichtbar schalten.

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™