Wiederholung mit Tastendruck Und Anzeigefenster

  • Hi Leute :)

    Ich bin noch ziemlich neu auf dem Gebiet .. Kann mir jemand helfen?

    Ich bräuchte ein Skript, was aller halben Stunde die Taste F8 drückt + ein Anzeigefenster, in dem steht wie lang es noch dauert bis die halbe Stunde rum ist.
    Ist ja eigentlich nicht viel dabei denke ich mal .. kann mir da jemand helfen?

    Das endgültige Ergebnis sollte ein Fenster sein, was einen Countdown anzeigt bis zur nächsten Aktion, eine Textzeile und wenn möglich noch einen Start, Stop und sofort ausführen Button.


    Danke & Gruß
    Sebastian

    Edit i2c: Es geht um das automatische starten von "GhostMouse".

    Einmal editiert, zuletzt von Confixx (12. April 2014 um 15:47)

  • so etwa? oder ein anderes fenster? lol:D

    Spoiler anzeigen
    [autoit]


    #include <GUIConstants.au3>

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

    main()
    Func main()
    Global $ms = 1800000
    GUICreate("Timer", 200, 60, @DesktopWidth-200, 0, $WS_POPUP, $WS_EX_TOOLWINDOW)
    GUISetBkColor(0x808080)
    $temp = GUICtrlCreateLabel("", 10, 10, 180, 40, BitOR($ES_CENTER, $SS_CENTERIMAGE))
    GUICtrlSetFont(-1, 25, 400, 1, "Century Gothic")
    GUICtrlSetColor(-1, 0xFFFFFF)
    GUISetState()

    $start = TimerInit()

    While 1
    $diff = TimerDiff($start)/1000 - ($ms/1000)
    $minutes = Int($diff / 60)
    $secondsRem = $diff - ($minutes * 60)
    $minutes = $minutes * -1
    $secondsRem = $secondsRem * -1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then
    Exit
    ElseIf GUICtrlRead($temp) <> StringFormat("%02d", $minutes) & " : " & StringFormat("%02d", $secondsRem) Then
    GUICtrlSetData($temp, StringFormat("%02d", $minutes) & " : " & StringFormat("%02d", $secondsRem))
    ElseIf GUICtrlRead($temp) = "00 : 00" Then
    Send("{F8}")
    $ms = 1800000
    $start = TimerInit()
    EndIf
    WEnd
    EndFunc

    [/autoit]
  • Hier einmal eine vielleicht etwas schönere variante mit mehr Möglichkeiten :) (allerdings keine Fehlerbehebung, was das Inputfeld angeht ;). Also schön die beiden ":" stehen lassen :D)

    Spoiler anzeigen
    [autoit]

    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #include <DateTimeConstants.au3>
    Opt("GUIOnEventMode", 1)

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

    $Form1_Color=0x000000 ;Hintergrundfarbe
    $Form1_Color_Text=0xFFFFFF ;Textfarbe
    $transCount=255 ;transperenz 0=nicht sichtbar 255=voll sichtbar
    $CountDownGuiOnTop=1 ;wenn dieser wert 0 ist, ist das fenster nicht im vordergrund
    $run=false
    global $Form3,$Time3,$Label3,$Button2,$Button3
    countDown()
    GUIRegisterMsg($WM_LBUTTONUP, "MY_WM_COMMAND_UP")
    GUIRegisterMsg($WM_LBUTTONDOWN, "MY_WM_COMMAND_DOWN")
    while sleep(100)
    WEnd

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

    Func countDown()
    #Region ### START Koda GUI section ### Form=
    $Form3 = GUICreate("CountDown", 140,70,@DesktopWidth-135,20,bitor($WS_EX_TOPMOST,$WS_POPUP),bitor(0,$WS_EX_TOOLWINDOW));style=$WS_EX_CLIENTEDGE ;,$WS_EX_CLIENTEDGE,-1
    MouseGetPos()
    GUISetBkColor($Form1_Color)
    local $min,$sec
    if @Sec=0 then
    $min=@MIN-1
    $sec=59
    else
    $min=@Min
    $sec=@Sec-1
    endif
    $Time3 = GUICtrlCreateInput("00:30:00", 8, 8, 73, 21);GUICtrlCreateDate("00:30:00", 8, 8, 73, 21,$DTS_TIMEFORMAT)
    ;DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle(-1), "wstr", "Explorer", "wstr", 0)
    GUICtrlSetBkColor(-1,$Form1_Color)
    GUICtrlSetColor(-1,$Form1_Color_Text)
    $Label3 = GUICtrlCreateLabel("Dein Text", 8, 40, 50)
    GUICtrlSetBkColor(-1,$Form1_Color)
    GUICtrlSetColor(-1,$Form1_Color_Text)
    $Button2 = GUICtrlCreateButton("Start", 88, 35,43)
    GUICtrlSetBkColor(-1,$Form1_Color)
    GUICtrlSetColor(-1,$Form1_Color_Text)
    GUICtrlSetOnEvent($Button2,"_StartStop")
    $Button3 = GUICtrlCreateButton("BG/VG", 88, 8,43)
    GUICtrlSetBkColor(-1,$Form1_Color)
    GUICtrlSetColor(-1,$Form1_Color_Text)
    GUICtrlSetOnEvent($Button3,"CDInBG")
    GUISetOnEvent($GUI_EVENT_CLOSE, "_GuiClose",$Form3)
    $dummy = GUICtrlCreateDummy()
    GUICtrlSetOnEvent($dummy, "_GuiClose")
    Global $AccelKeys[1][2]=[["{ESC}", $dummy]]
    GUISetAccelerators($AccelKeys,$Form3)
    GUISetState(@SW_SHOW,$Form3)
    WinSetTrans($Form3,"",$transCount)
    if $CountDownGuiOnTop=1 then
    WinSetOnTop($Form3,"",1)
    endif
    #EndRegion ### END Koda GUI section ###
    EndFunc

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

    Func _StartStop()
    if $run then
    AdlibUnRegister("countDownWhile")
    GUICtrlSetData($Button2,"Start")
    $run=false
    else
    AdlibRegister("countDownWhile",1000)
    GUICtrlSetData($Button2,"Stop")
    $run=true
    endif
    EndFunc

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

    Func CDInBG()
    if $CountDownGuiOnTop=0 then
    WinSetOnTop($Form3,"",1)
    $CountDownGuiOnTop=1
    else
    WinSetOnTop($Form3,"",0)
    $CountDownGuiOnTop=0
    endif
    EndFunc

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

    Func countDownWhile()
    $ar=StringSplit(GUICtrlRead($Time3),":",2)
    $ar[2]=$ar[2]-1
    if $ar[2]<0 then
    $ar[2]=59
    $ar[1]=$ar[1]-1
    endif
    if $ar[1]<0 then
    $ar[0]=$ar[0]-1
    $ar[1]=59
    endif
    if $ar[0]<0 then
    Send("{F8}")
    $ar[0]=0
    $ar[1]=30
    $ar[2]=0
    endif
    if $ar[0]<10 then
    $ar[0]="0"&String(int($ar[0]))
    endif
    if $ar[1]<10 then
    $ar[1]="0"&String(int($ar[1]))
    endif
    if $ar[2]<10 then
    $ar[2]="0"&String(int($ar[2]))
    endif
    GUICtrlSetData($Time3,$ar[0]&":"&$ar[1]&":"&$ar[2])
    EndFunc

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

    Func _GuiClose()
    exit
    EndFunc

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

    Func MY_WM_COMMAND_DOWN($hwnd,$msg,$wparam,$lparam)
    Switch $hwnd
    Case $Form3
    if $msg>0 then
    AdlibRegister("move",10)
    endif
    EndSwitch
    EndFunc

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

    Func MY_WM_COMMAND_UP($hwnd,$msg,$wparam,$lparam)
    Switch $hwnd
    Case $Form3
    if $msg>0 or $msg=$Label3 then
    AdlibUnRegister("move")
    endif
    EndSwitch
    EndFunc

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

    Func move()
    $cur=MouseGetPos()
    WinMove($Form3,"",$cur[0]-39,$cur[1]-30)
    EndFunc

    [/autoit]