Valuater Posted September 21, 2005 Share Posted September 21, 2005 Isn't this kind of a neater solution? idle_time.au3Mapping every key and do the test with _IsPressed seems a bit messy to me. Ex. Would it cacth my activity,on a laptop, only using the fn+ keys?RegardsUtenwow from 2004nice clean find Uten.... thats exactly how i would write it too8) Link to comment Share on other sites More sharing options...
seandisanti Posted September 22, 2005 Share Posted September 22, 2005 Isn't this kind of a neater solution? idle_time.au3Mapping every key and do the test with _IsPressed seems a bit messy to me. Ex. Would it cacth my activity,on a laptop, only using the fn+ keys?RegardsUtenthat one only watches the mouse. mine watches the mouse and the keyboard. and cleaner??? cleaner how? unnecessary Call()'s, extra lines? i'll concede that his has better documentation, but other than that i don't see any advantage to his code over the code i posted, even if you ignore that it is just watching the mouse. i'm not trying to say anything about the other coder's ability or anything, back then there weren't dll calls, or IsPressed() (i don't think) for his script to have all of the same functionality. Sorry, i'm just not seeing how that would be a better solution to this issue. or cleaner. Link to comment Share on other sites More sharing options...
seanhart Posted September 22, 2005 Author Share Posted September 22, 2005 that one only watches the mouse. mine watches the mouse and the keyboard. and cleaner??? cleaner how? unnecessary Call()'s, extra lines? i'll concede that his has better documentation, but other than that i don't see any advantage to his code over the code i posted, even if you ignore that it is just watching the mouse. i'm not trying to say anything about the other coder's ability or anything, back then there weren't dll calls, or IsPressed() (i don't think) for his script to have all of the same functionality. Sorry, i'm just not seeing how that would be a better solution to this issue. or cleaner.It's definitely simpler and it doesn't technically watch the keyboard although it does watch for cursor movement which will work most of the time, but it's not as comprehensive as cameronsdad's one. Link to comment Share on other sites More sharing options...
seandisanti Posted September 22, 2005 Share Posted September 22, 2005 It's definitely simpler and it doesn't technically watch the keyboard although it does watch for cursor movement which will work most of the time, but it's not as comprehensive as cameronsdad's one.sorry, didn't mean to get so defensive there, but my code contains a shorter version of code that does the same thing as the linked script as one of the activities it watches for, so i was kind of taken aback as to how that could be considered a better solution. i'm over it Link to comment Share on other sites More sharing options...
ioliver Posted September 22, 2005 Share Posted September 22, 2005 I was just about to post my code for 'idle_time.au3', then I followed Valuater's link. I didn't try Camron's code, but I know that mine doesn't check for Key Presses, so it is limited. Anyway, I'm just glad to see someone posting a link to my code. Thanks, Ian "Blessed be the name of the Lord" - Job 1:21Check out Search IMF Link to comment Share on other sites More sharing options...
Uten Posted September 22, 2005 Share Posted September 22, 2005 It does monitor keyboard activity with the code. Normal keyboard activity will move the caret from time to time. $CPos2 = WinGetCaretPos() I gues the cleaner part is a matter of taste. Doing 117 calls to _IsPressed just to se if there is a user pressent is..., hmm overkill?. But by all means, camronsdad's sample does work. And I have to add it will work in special cases where idle_time.au3 does not. Hitting PgUp And PgDn reading the same page for a while while browsing would be one of those occations. A mix of the two methodes would probably be the best solution? Regards Uten Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling Link to comment Share on other sites More sharing options...
Uten Posted September 23, 2005 Share Posted September 23, 2005 Out of curiosity I took a look at the code behind _IsPressed.It's a DllCall wrapper around GetAsyncKeyState.Now the thing that puzzles me is what I read about GetAsyncKeyState at MSDN.Windows NT/2000/XP: The return value is zero for the following cases: * The current desktop is not the active desktop * The foreground thread belongs to another process and the desktop does not allow the hook or the journal record.Do I misunderstand something or would there be (more and more as MS locks down the OS) cases (users) where the _IsPressed will not work as described in the autoit help file?I assume the function WinGetCaretPos is a wrapper around the API function GetCaretPos whom, as I understand it, does not have the same limitations.RegardsUten Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling Link to comment Share on other sites More sharing options...
jefhal Posted September 23, 2005 Share Posted September 23, 2005 (edited) Here's a link to getkeystate with VB6: GetKeyboardState in VB6 Edited September 23, 2005 by jefhal ...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format 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