mesale0077 Posted February 13, 2012 Posted February 13, 2012 (edited) hi demo.au3 working but timer.au3 dont work #include <HotString.au3> Func Close_skin() HotStringSet("close", "exitfunc") ;dont work HotString.au3 expandcollapse popup; Authors: Manadar, GaryFrost ; Contributor: WideBoyDixon, KaFu, Malkey #include <WinAPI.au3> #include <WindowsConstants.au3> #include <Array.au3> #include-once Local $_hotString_hStub_KeyProc = DllCallbackRegister("_HotString_KeyProc", "long", "int;wparam;lparam") Local $_hotString_hmod = _WinAPI_GetModuleHandle(0) Local $_hotString_hHook = _WinAPI_SetWindowsHookEx($WH_KEYBOARD_LL, DllCallbackGetPtr($_hotString_hStub_KeyProc), $_hotString_hmod) Local $_hotString_buffer = "" Local $_hotString_User32 = DllOpen("user32.dll") Local $_hotString_hotkeys[1] Local $_hotString_hotfuncs[1] Local $_hotString_hWnd = GUICreate("") GUIRegisterMsg($WM_COMMAND, "_HotString_GUIKeyProc") OnAutoItExitRegister("_HotString_OnAutoItExit") Func HotStringSet($hotstring, $func = "") If $func = "" Then $i = _ArraySearch($_hotString_hotkeys, $hotstring) If $i = -1 Then Return _ArrayDelete($_hotString_hotkeys, $i) _ArrayDelete($_hotString_hotfuncs, $i) Else _ArrayAdd($_hotString_hotkeys, $hotstring) _ArrayAdd($_hotString_hotfuncs, $func) EndIf EndFunc Func _HotString_EvaluateKey($key) If StringLen($key) > 1 Then $_hotString_buffer &= "{" & $key & "}" Else $_hotString_buffer &= $key EndIf $_hotString_buffer = StringRight($_hotString_buffer, 250) _HotString_CheckHotkeys($_hotString_buffer) EndFunc Func _HotString_CheckHotkeys($current) For $i = 0 to UBound($_hotString_hotkeys)-1 if _HotString_Match($_hotString_hotkeys[$i], $current) Then Call($_hotString_hotfuncs[$i]) EndIf Next EndFunc Func _HotString_Match($hotkey, $current) Return StringRight($current, StringLen($hotkey)) = $hotkey EndFunc Func _HotString_GUIKeyProc($hWnd, $Msg, $wParam, $lParam) $aRet = DllCall('user32.dll', 'int', 'GetKeyNameText', 'int', $lParam, 'str', "", 'int', 256) $sKeyName = $aRet[2] If $sKeyName Then _HotString_EvaluateKey($sKeyName) EndIf Return 0 ; dont run autoit internal handler, not sure what it is, but message = handled so do nothing EndFunc Func _HotString_KeyProc($nCode, $wParam, $lParam) Local $tKEYHOOKS = DllStructCreate($tagKBDLLHOOKSTRUCT, $lParam) If $nCode < 0 Then Return _WinAPI_CallNextHookEx($_hotString_hHook, $nCode, $wParam, $lParam) EndIf If $wParam = $WM_KEYDOWN Then $vkKey = DllStructGetData($tKEYHOOKS, "vkCode") ; http://msdn.microsoft.com/en-us/library/ms646300(v=vs.85).aspx ; create $lParam as described, above $lParam or $tKEYHOOKS is derp $scanCode = DllStructGetData($tKEYHOOKS, "scanCode") $flags = DllStructGetData($tKEYHOOKS, "flags") $lWantParam = BitShift($scanCode, -16) $lWantParam = BitOR($lWantParam, BitShift($flags, -24)) ; post message to our local GUI ; $WM_COMMAND instead of $WM_KEYDOWN/UP because $WM_KEYDOWN automagically consumed some chars such as up, down, enter _WinAPI_PostMessage($_hotString_hWnd, $WM_COMMAND, $vkKey, $lWantParam) EndIf Return _WinAPI_CallNextHookEx($_hotString_hHook, $nCode, $wParam, $lParam) EndFunc Func _HotString_OnAutoItExit() _WinAPI_UnhookWindowsHookEx($_hotString_hHook) DllCallbackFree($_hotString_hStub_KeyProc) DllClose($_hotString_User32) EndFunc timer.au3 expandcollapse popup#include <Date.au3> #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> Opt("WinWaitDelay",100) Opt("WinTitleMatchMode",4) Opt("WinDetectHiddenText",1) Opt("MouseCoordMode",0) opt("TrayIconDebug", 1) Opt("TrayOnEventMode",1) Opt("TrayMenuMode", 3) Opt("WinWaitDelay",100) Opt("WinTitleMatchMode",4) Opt("WinDetectHiddenText",1) Opt("MouseCoordMode",0) #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("[#]Time start[#]",334, 118, -1, -1, BitXOR($GUI_SS_DEFAULT_GUI, $WS_MINIMIZEBOX)) GUISetBkColor(0xA6CAF0) $Label1 = GUICtrlCreateLabel("Hold MINUTES :", 8, 16, 175, 17) $Label2 = GUICtrlCreateLabel("EXAM TIME MINUTES :", 8, 56, 178, 17) $Input1 = GUICtrlCreateInput("1", 192, 16, 57, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_NUMBER)) GUICtrlSetLimit(-1, 2) $Input2 = GUICtrlCreateInput("1", 192, 56, 57, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_NUMBER)) GUICtrlSetLimit(-1, 2) $Button1 = GUICtrlCreateButton("START", 256, 24, 57, 41, $WS_GROUP) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### $exititem = TrayCreateItem("Close") TrayItemSetOnEvent(-1, "Close") TraySetState() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit CASE $Button1 GUISetState(@SW_hide) r1() EndSwitch WEnd func r1() $start_1 = @HOUR & ":" & @MIN + GUICtrlRead($Input1) While 1 $start2 = @HOUR & ":" & @MIN ToolTip(" " ,@DesktopWidth - 220, @DesktopHeight - 120,"info: " &GUICtrlRead($Input1)& " minutes after the start", 1) If $start_1 = $start2 then Beep(300,500) rr1() endif WEnd endfunc func rr1() Beep(300,500) r2() endfunc func r2() $start = @HOUR & ":" & @MIN $Minutes = GUICtrlRead($Input2) Local $60Count = 0, $begin = TimerInit() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch if $Minutes > $60Count then $dif = TimerDiff($begin) $dif2 = StringLeft($dif, StringInStr($dif, ".") -1) $Count = int($dif/1000) $60Count = Int($Count / 60) ToolTip("Starting time = " & $start& @CRLF & "Past time = " &@HOUR & ":" & @MIN& @CRLF & "last minute = " & $60Count ,@DesktopWidth - 220, @DesktopHeight - 120,"nfo: " &GUICtrlRead($Input2)& " minutes after the end", 1) else rr2() endif WEnd endfunc func rr2() Beep(300,500) GUIDELETE() ToolTip("") Close_skin() endfunc Func Close() Select Case @TRAY_ID = $exititem exit EndSelect EndFunc #include <HotString.au3> Func Close_skin() HotStringSet("close", "exitfunc") ;dont work $g_aBsy_Info = GUICreate("", @DesktopWidth, @DesktopHeight, 0, 0, BitOR($WS_POPUP, $WS_DISABLED), BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW)) GUISetBkColor(9) WinSetTrans($g_aBsy_Info, "", 180) GUISetState(@SW_SHOW, $g_aBsy_Info) while 1 sleep(10) wend EndFunc Func exitfunc() rr2222() EndFunc func rr2222() #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("[#]Time start[#]",334, 118, -1, -1, BitXOR($GUI_SS_DEFAULT_GUI, $WS_MINIMIZEBOX)) GUISetBkColor(0xA6CAF0) $Label1 = GUICtrlCreateLabel("Hold MINUTES :", 8, 16, 175, 17) $Label2 = GUICtrlCreateLabel("EXAM TIME MINUTES :", 8, 56, 178, 17) $Input1 = GUICtrlCreateInput("1", 192, 16, 57, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_NUMBER)) GUICtrlSetLimit(-1, 2) $Input2 = GUICtrlCreateInput("1", 192, 56, 57, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_NUMBER)) GUICtrlSetLimit(-1, 2) $Button1 = GUICtrlCreateButton("START", 256, 24, 57, 41, $WS_GROUP) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### TraySetState() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit CASE $Button1 GUISetState(@SW_hide) r1() EndSwitch WEnd endfunc or timer_2.au3 expandcollapse popup#include <EditConstants.au3> #include <Date.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> Opt("GUIOnEventMode", 1) Opt("MouseCoordMode",0) opt("TrayIconDebug", 1) Opt("TrayOnEventMode",1) Opt("TrayMenuMode", 3) #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("[#]Time start[#]",334, 118, -1, -1, BitXOR($GUI_SS_DEFAULT_GUI, $WS_MINIMIZEBOX)) GUISetBkColor(0xA6CAF0) GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked") $Label1 = GUICtrlCreateLabel("Hold MINUTES :", 8, 16, 175, 17) $Label2 = GUICtrlCreateLabel("EXAM TIME MINUTES :", 8, 56, 178, 17) $Input1 = GUICtrlCreateInput("1", 192, 16, 57, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_NUMBER)) GUICtrlSetLimit(-1, 2) $Input2 = GUICtrlCreateInput("1", 192, 56, 57, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_NUMBER)) GUICtrlSetLimit(-1, 2) $Button1 = GUICtrlCreateButton("START", 256, 24, 57, 41, $WS_GROUP) GUICtrlSetOnEvent($Button1 , "OKButton") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### $exititem = TrayCreateItem("Close") TrayItemSetOnEvent(-1, "Close") TraySetState() While 1 Sleep(1000) ; Idle around WEnd func r1() $start_1 = @HOUR & ":" & @MIN + GUICtrlRead($Input1) While 1 $start2 = @HOUR & ":" & @MIN ToolTip(" " ,@DesktopWidth - 220, @DesktopHeight - 120,"info: " &GUICtrlRead($Input1)& " minutes after the start", 1) If $start_1 = $start2 then Beep(300,500) rr1() endif WEnd endfunc func rr1() Beep(300,500) r2() endfunc func r2() $start = @HOUR & ":" & @MIN $Minutes = GUICtrlRead($Input2) Local $60Count = 0, $begin = TimerInit() While 1 if $Minutes > $60Count then $dif = TimerDiff($begin) $dif2 = StringLeft($dif, StringInStr($dif, ".") -1) $Count = int($dif/1000) $60Count = Int($Count / 60) ToolTip("Starting time = " & $start& @CRLF & "Past time = " &@HOUR & ":" & @MIN& @CRLF & "last minute = " & $60Count ,@DesktopWidth - 220, @DesktopHeight - 120,"nfo: " &GUICtrlRead($Input2)& " minutes after the end", 1) else rr2() endif WEnd endfunc func rr2() Beep(300,500) GUIDELETE() ToolTip("") Close_skin() endfunc Func Close() Select Case @TRAY_ID = $exititem exit EndSelect EndFunc Func OKButton() GUISetState(@SW_hide) r1() EndFunc Func CLOSEClicked() Exit EndFunc func rr2222() #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("[#]Time start[#]",334, 118, -1, -1, BitXOR($GUI_SS_DEFAULT_GUI, $WS_MINIMIZEBOX)) GUISetBkColor(0xA6CAF0) GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked") $Label1 = GUICtrlCreateLabel("Hold MINUTES :", 8, 16, 175, 17) $Label2 = GUICtrlCreateLabel("EXAM TIME MINUTES :", 8, 56, 178, 17) $Input1 = GUICtrlCreateInput("1", 192, 16, 57, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_NUMBER)) GUICtrlSetLimit(-1, 2) $Input2 = GUICtrlCreateInput("1", 192, 56, 57, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_NUMBER)) GUICtrlSetLimit(-1, 2) $Button1 = GUICtrlCreateButton("START", 256, 24, 57, 41, $WS_GROUP) GUICtrlSetOnEvent($Button1 , "OKButton") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 Sleep(1000) ; Idle around WEnd EndFunc #include <HotString.au3> Func Close_skin() HotStringSet("close", "exitfunc") $g_aBsy_Info = GUICreate("", @DesktopWidth, @DesktopHeight, 0, 0, BitOR($WS_POPUP, $WS_DISABLED), BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW)) GUISetBkColor(9) WinSetTrans($g_aBsy_Info, "", 180) GUISetState(@SW_SHOW, $g_aBsy_Info) while 1 sleep(10) wend EndFunc demo.au3 #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <HotString.au3> Close_skin() Func Close_skin() HotStringSet("close", "exitfunc") $g_aBsy_Info = GUICreate("", @DesktopWidth, @DesktopHeight, 0, 0, BitOR($WS_POPUP, $WS_DISABLED), BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW)) GUISetBkColor(9) WinSetTrans($g_aBsy_Info, "", 180) GUISetState(@SW_SHOW, $g_aBsy_Info) while 1 sleep(10) wend EndFunc Func exitfunc() exit EndFunc thank you now Edited February 13, 2012 by mesale0077
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now