metjumper Posted February 24, 2009 Share Posted February 24, 2009 (edited) HotKeySet("{F3}","Di") func Di() opt ("SendKeyDelay",50) send("{Enter}") Send("blabla") send("{Enter}") EndFunc how can i add usage limit for func ? exam: its might be allow 3 times press then it connot use for 30 min or smth like that. Regards. Edited February 24, 2009 by metjumper Link to comment Share on other sites More sharing options...
furrycow Posted February 24, 2009 Share Posted February 24, 2009 HotKeySet("{F3}","Di") func Di() opt ("SendKeyDelay",50) send("{Enter}") Send("blabla") send("{Enter}") EndFunc how can i add usage limit for func ? exam: its might be allow 3 times press then it connot use for 30 min or smth like that. Regards. I havent tried it or anything, and its not the prettiest coding ever but...might work: $x=0 HotKeySet("{F3}","Di") func Di() If $x<3 Then opt ("SendKeyDelay",50) send("{Enter}") Send("blabla") send("{Enter}") $x+=1 $Timer=TimerInit() Else If TimerDiff($Timer)<1800000 Msgbox(0,"","Please Wait "&((TimerDiff($Timer)/1000)/60)&" Minutes") Else $x=0 EndIf EndIf EndFunc Instant Lockerz Invite - www.instantlockerzinvite.co.uk Link to comment Share on other sites More sharing options...
metjumper Posted February 24, 2009 Author Share Posted February 24, 2009 nope its not working. gives me an error "if timeriff... variable used without being declard. when i press f3 at 4 time. thanks for reply Link to comment Share on other sites More sharing options...
furrycow Posted February 24, 2009 Share Posted February 24, 2009 (edited) nope its not working. gives me an error "if timeriff... variable used without being declard. when i press f3 at 4 time. thanks for reply Umm, just noticed i missed a "Then" at the end of that line: If TimerDiff($Timer)<1800000 Then Edited February 24, 2009 by furrycow Instant Lockerz Invite - www.instantlockerzinvite.co.uk Link to comment Share on other sites More sharing options...
metjumper Posted February 24, 2009 Author Share Posted February 24, 2009 i recognize it i did put then. its give me error as i said before... Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 24, 2009 Moderators Share Posted February 24, 2009 metjumper,This should do what you want - 3 presses and then a time-out:HotKeySet("{SPACE}", "My_Function") Global $iBegin = 0 Global $iCount = 0 While 1 Sleep(100) WEnd Func My_Function() If $iCount = 3 Then If TimerDiff($iBegin) < 10000 Then; 10 secs for example ConsoleWrite("Returning " & Int(TimerDiff($iBegin) / 1000) & " secs elapsed" & @CRLF) Return Else $iCount = 0 EndIf EndIf $iCount += 1 ConsoleWrite("Function call " & $iCount & @CRLF) If $iCount = 3 Then $iBegin = TimerInit() EndFunc ;==>My_FunctionKeep pressing Space and you will see the 3 function calls and then the timer running.M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
metjumper Posted February 24, 2009 Author Share Posted February 24, 2009 M23 whit your code space key wont work even 1 time like disable space key i tryed to make smthg but i could not able. Link to comment Share on other sites More sharing options...
furrycow Posted February 24, 2009 Share Posted February 24, 2009 M23 whit your code space key wont work even 1 time like disable space key i tryed to make smthg but i could not able. If M23's doesnt work, you could put Global $Timer in mine, as i think that is what the prob with mine was Global $Timer $x=0 HotKeySet("{F3}","Di") func Di() If $x<3 Then opt ("SendKeyDelay",50) send("{Enter}") Send("blabla") send("{Enter}") $x+=1 $Timer=TimerInit() Else If TimerDiff($Timer)<1800000 Then Msgbox(0,"","Please Wait "&((TimerDiff($Timer)/1000)/60)&" Minutes") Else $x=0 EndIf EndIf EndFunc Instant Lockerz Invite - www.instantlockerzinvite.co.uk Link to comment Share on other sites More sharing options...
youknowwho4eva Posted February 24, 2009 Share Posted February 24, 2009 (edited) HotKeySet("{F3}","Di") $i = 0 func Di() If $i < 3 then opt ("SendKeyDelay",50) send("{Enter}") Send("blabla") send("{Enter}") EndFunc $i += 1 else msgbox(0,"","no more worky") endif endfunc Edits: Forgot the endif and endfunc Edited February 24, 2009 by youknowwho4eva Giggity Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 24, 2009 Moderators Share Posted February 24, 2009 metjumper,So replace SPACE with another key - the script works!M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
metjumper Posted February 24, 2009 Author Share Posted February 24, 2009 furrycow Tnx for second code its working very well. M23 i know u are one of the best coder autoit,i didnt mean your code is not workin but i changed key but it wont work probably my bad, Thanks for all reply i appreciated. Best Regards. Link to comment Share on other sites More sharing options...
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