help how to make a timer w addtime per click in an assigned h

5

Click here to load reader

Upload: leo-dalencon-r

Post on 07-Dec-2015

4 views

Category:

Documents


1 download

DESCRIPTION

TRANSCRIPT

Page 1: Help How to Make a Timer w Addtime Per Click in an Assigned h

Sign In Create Account

AutoHotkey Ask for Help View New Content

help, how to make a timer w/ addtime per click in an assigned hotkey for a coinslot machine Started by jxclarynx , May 09 2015 09:30 AM

help" i want to make a timer with an assigned key or hotkey to add timeexample: countdown 30min to lock mouse and keyboard i want a program or a script that when i click an assigned key e.g{ F12} is my assigned key when i click F12 it will automatically add time from 30min to 60min to 90min per click. countdown to lock keyboard and mouse is there some one here that can do this.thanks

hello

Can you give an attempt at code? Is this kind of what you're looking to do in a countdown?

F12::var+=1800SetTimer, countDown, 1000return

countDown:var--Tooltip %var% seconds until locking If var<=0{MsgBox Time has run out}return

no i want something like this it locks inputs,i want to insert this a timer can u help me connect this 2 script my problem is the locking script is only quit iwant to change it to a hotkeythanks for your reply.

;Timer 1

Page 2: Help How to Make a Timer w Addtime Per Click in an Assigned h

Sign In Create Account

#SingleInstance,Force #Persistent #NoTrayIcon

CustomColor = EEAA99 Gui +LastFound -Caption +ToolWindow Gui, Color, %CustomColor% Gui, Font, s50 ; Set a large font size (32-point). Gui, Add, Text, vMyText w300 cred Center,Internet Station WinSet, TransColor, %CustomColor% 190 Gui, Show, x700 y-10 ,Timer CountDown= 30 ; seconds SomeDate = 16010101 SomeDate += %CountDown%,S SetTimer NextSecond, 1000 Return

Nextsecond: SomeDate += -1, seconds FormatTime formattedTime, %SomeDate%, mm:ss GuiControl,, MyText, %formattedTime% Return

;;;;this locks keyboard and mouse;

QUIT_HOTKEY=^Esc; ______________________________________________________________________________;#NoEnv ; Avoids checking empty variables to see if they are environment variablesMenu,Tray,Icon,shell32.dll,48 ; systray icon is a padlock; install the quit hotkeyHotkey,%QUIT_HOTKEY%,ExitSub; AFTER the quit hotkey is installed, block inputsBlockKeyboardInputs("On") BlockMouseClicks("On")BlockInput MouseMovereturn; ______________________________________________________________________________;ExitSub:ExitApp ; The only way for an OnExit script to terminate itself is to use ExitApp in the OnExit subroutine.

; ******************************************************************************; Function:; BlockKeyboardInputs(state="On") disables all keyboard key presses,; but Control, Shift, Alt (thus a hotkey based on these keys can be used to unblock the keyboard)

Page 3: Help How to Make a Timer w Addtime Per Click in an Assigned h

Sign In Create Account

;; Param; state [in]: On or Off;BlockKeyboardInputs(state = "On"){static keyskeys=Space,Enter,Tab,Esc,BackSpace,Del,Ins,Home,End,PgDn,PgUp,Up,Down,Left,Right,CtrlBreak,ScrollLock,PrintScreen,CapsLock,Pause,AppsKey,LWin,LWin,NumLock,Numpad0,Numpad1,Numpad2,Numpad3,Numpad4,Numpad5,Numpad6,Numpad7,Numpad8,Numpad9,NumpadDot,NumpadDiv,NumpadMult,NumpadAdd,NumpadSub,NumpadEnter,NumpadIns,NumpadEnd,NumpadDown,NumpadPgDn,NumpadLeft,NumpadClear,NumpadRight,NumpadHome,NumpadUp,NumpadPgUp,NumpadDel,Media_Next,Media_Play_Pause,Media_Prev,Media_Stop,Volume_Down,Volume_Up,Volume_Mute,Browser_Back,Browser_Favorites,Browser_Home,Browser_Refresh,Browser_Search,Browser_Stop,Launch_App1,Launch_App2,Launch_Mail,Launch_Media,F1,F2,F3,F4,F5,F6,F7,F8,F9,F10,F11,F12,F13,F14,F15,F16,F17,F18,F19,F20,F21,F22,1,2,3,4,5,6,7,8,9,0,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,²,&,é,",',(,-,è,_,ç,à,),=,$,£,ù,*,~,#,{,[,|,``,\,^,@,],},;,:,!,?,.,/,§,<,>,vkBCLoop,Parse,keys, `,Hotkey, *%A_LoopField%, KeyboardDummyLabel, %state% UseErrorLevelReturn; hotkeys need a label, so give them one that do nothingKeyboardDummyLabel:Return}

; ******************************************************************************; Function:; BlockMouseClicks(state="On") disables all mouse clicks;; Param; state [in]: On or Off;BlockMouseClicks(state = "On"){static keys="RButton,LButton,MButton,WheelUp,WheelDown"Loop,Parse,keys, `,Hotkey, *%A_LoopField%, MouseDummyLabel, %state% UseErrorLevelReturn; hotkeys need a label, so give them one that do nothingMouseDummyLabel:Return}

iwant the timer to execute mouse and keyboard lock when the countdown ends and assigned a hotkey e.g {F12} when pressedthat will automatically add time from 30min to 60min per press

This code is untested and may accidentally disable your computer. You should be able to regain control going through Ctrl+Alt+Del, but that may just leave you with an option of restarting your computer.

#SingleInstance,Force #Persistent #NoTrayIcon 

Page 4: Help How to Make a Timer w Addtime Per Click in an Assigned h

Sign In Create Account

CustomColor = EEAA99 Gui +LastFound -Caption +ToolWindowGui, Color, %CustomColor%Gui, Font, s50 ; Set a large font size (32-point).Gui, Add, Text, vMyText w300 cred Center,Internet StationWinSet, TransColor, %CustomColor% 190Gui, Show, x700 y-10 ,TimerCountDown= 30 ; seconds SomeDate = 16010101SomeDate += %CountDown%,S SetTimer NextSecond, 1000Return

Nextsecond:SomeDate += -1, seconds FormatTime formattedTime, %SomeDate%, mm:ss GuiControl,, MyText, %formattedTime%If SomeDate<=0{

BlockKeyboardInputs("On")BlockMouseClicks("On")BlockInput MouseMove}

Return

F12::SomeDate += 1800, seconds ; I guess you could use SomeDate += 30, minutes

^Esc::

BlockKeyboardInputs("Off")BlockMouseClicks("Off")BlockInput MouseMoveOffreturn

; ******************************************************************************; Function:; BlockKeyboardInputs(state="On") disables all keyboard key presses,; but Control, Shift, Alt (thus a hotkey based on these keys can be used to unblock the keyboard);; Param; state [in]: On or Off;BlockKeyboardInputs(state = "On"){static keys keys=Space,Enter,Tab,Esc,BackSpace,Del,Ins,Home,End,PgDn,PgUp,Up,Down,Left,Right,CtrlBreak,ScrollLock,PrintScreen,CapsLock,Pause,AppsKey,LWin,LWin,NumLock,Numpad0,Numpad1,Numpad2,Numpad3,Numpad4,Numpad5,Numpad6,Numpad7,Numpad8,Numpad9,NumpadDot,NumpadDiv,NumpadMult,NumpadAdd,NumpadSub,NumpadEnter,NumpadIns,NumpadEnd,NumpadDown,NumpadPgDn,NumpadLeft,NumpadClear,NumpadRight,NumpadHome,NumpadUp,NumpadPgUp,NumpadDel,Media_Next,Media_Play_Pause,Media_Prev,Media_Stop,Volume_Down,Volume_Up,Volume_Mute,Browser_Back,Browser_Favorites,Browser_Home,Browser_Refresh,Browser_Search,Browser_Stop,Launch_App1,Launch_App2,Launch_Mail,Launch_Media,F1,F2,F3,F4,F5,F6,F7,F8,F9,F10,F11,F12,F13,F14,F15,F16,F17,F18,F19,F20,F21,F22 ,1,2,3,4,5,6,7,8,9,0,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z ,²,&,é,",',(,-,è,_,ç,à,),=,$,£,ù,*,~,#,{,[,|,``,\,^,@,],},;,:,!,?,.,/,§,<,>,vkBC Loop,Parse,keys, `, Hotkey, *%A_LoopField%, KeyboardDummyLabel, %state% UseErrorLevel Return ; hotkeys need a label, so give them one that do nothing KeyboardDummyLabel: Return }

; ****************************************************************************** ; Function: ; BlockMouseClicks(state="On") disables all mouse clicks ; ; Param ; state [in]: On or Off ; BlockMouseClicks(state = "On") { static keys="RButton,LButton,MButton,WheelUp,WheelDown" Loop,Parse,keys, `,

Page 5: Help How to Make a Timer w Addtime Per Click in an Assigned h

Sign In Create Account

Back to Ask for Help

AutoHotkey Community → AutoHotkey → Ask for Help

Hotkey, *%A_LoopField%, MouseDummyLabel, %state% UseErrorLevel Return ; hotkeys need a label, so give them one that do nothing MouseDummyLabel: Return }

thanks for the reply there some problem coz when i run the script and press f12 it adds time 30min to 60min but when i press again the f12 comes back to 30min iwant some thing like adding time like pressing the hotkey f12 it adds 30min to 60min to 90min to 120min so on .timer countdown to lock inputs is there a way to do it??thank you again

theres another problem coz when the countdown ends it doesnt lock inputs thank you again for your concern.hoping for your reply to solve my problem.

What is your exact F12 hotkey code?

Also, I think I see my problem with getting the input to be blocked. You start out setting SomeDate as 16010101 which is YYYYMMDD. Let's try using in the timer If SomeDate<=16010101000000 , which has the HHmmSS included, instead of asking for it to be less than zero.