AutoHotkey Community

It is currently May 27th, 2012, 12:54 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 10 posts ] 
Author Message
PostPosted: August 23rd, 2011, 10:14 pm 
Offline

Joined: August 23rd, 2011, 10:05 pm
Posts: 5
OK, I have searched quite a bit. But not coming up with what I need.

And apologies in advance, but no programming experience.

I am actually a therapist working with a child who is using a button switch to interact with the computer. He tends to double push the switch. Our most common activity is to watch a cartoon on youtube, so when he double hits the switch, the video starts, but then stops again. Getting him to not double push the switch is not an option at this point, given his disability. What I would like is a script that takes the first mouse click but then ignores further mouseclicks for an adjustable length of time. “Sleep” does not seem to do it… Not sure why.

Initially I would like this to work with mouse clicks, but I would also like it to work with keyboard commands. So for example, I have the switch programmed to send an alt-shift tab to cycle through multiple video windows that I have already opened. He again tends to push the switch double times and goes past the one he wanted…

Any help is appreciated, Ed


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 23rd, 2011, 10:20 pm 
Yes you can create a hotkey and detect if it was pressed x milisecons before that and ignore it, see this ctrl example http://www.autohotkey.com/forum/topic15537.html instead of the msgbox you would simple Return


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: August 23rd, 2011, 10:26 pm 
Offline

Joined: August 23rd, 2011, 10:05 pm
Posts: 5
I should add, I looked through this topic which is along the lines of what I need, but the file for buggy mouse does not seem to work.

I do not see how to adjust the timing in buggy mouse…

And this is a user issue, not the actual mouse.


http://www.autohotkey.com/forum/viewtop ... lick+sleep


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 23rd, 2011, 10:37 pm 
Offline

Joined: August 23rd, 2011, 10:05 pm
Posts: 5
OK, so I am probably misreading the ctrl topic but it seems to say that it is getting a double hit of ctrl key? I am trying to ignore a double press not make it easier...

Can a hotkey send a mouse click?

And if anyone has time, example of the actual code would be awesome...

again, not a programmer, just trying to work with a kid with a disability.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 24th, 2011, 8:21 am 
Try this, just replace Ctrl with Lbutton and MsgBox with Return
Code:
~Lbutton::
;400 is the maximum allowed delay (in milliseconds) between presses.
if (A_PriorHotKey = "~Lbutton" AND A_TimeSincePriorHotkey < 400)
   Return
Sleep 0
KeyWait, Lbutton
return
This should ignore a double click if they happen within 400 ms, you can experiment with the time, just change 400 to 1000 (1000 = 1 second)

Let us know if it works for you.

To consider: you could also think about remapping another key to send a mouse click, it might for example be easier to press the space bar as it is a nice big button.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: August 24th, 2011, 8:31 am 
You might want to check few posts by evandevon who is developing applications for people with disabilities, he made a mousetrainer for example but if you contact him he might be able to give you some tips as well.
Mouse trainer:
http://www.autohotkey.com/forum/viewtop ... setrainer/


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: August 24th, 2011, 10:07 pm 
Offline

Joined: August 23rd, 2011, 10:05 pm
Posts: 5
Anonymous wrote:
Try this, just replace Ctrl with Lbutton and MsgBox with Return
Code:
~Lbutton::
;400 is the maximum allowed delay (in milliseconds) between presses.
if (A_PriorHotKey = "~Lbutton" AND A_TimeSincePriorHotkey < 400)
   Return
Sleep 0
KeyWait, Lbutton
return
This should ignore a double click if they happen within 400 ms, you can experiment with the time, just change 400 to 1000 (1000 = 1 second)

Let us know if it works for you.

To consider: you could also think about remapping another key to send a mouse click, it might for example be easier to press the space bar as it is a nice big button.


Thanks for the help, but I cannot get this to work.

When I copy into notepad, I lose the color; IIRC, the macros should ignore the green. Since it is black I tried deleting the whole line but still no go.

Did not work if I copied as is, or with any of my edits.

In reference to using space bar; I am actually using a button switch like this http://www.synapsestore.com/shop/produc ... WITCH.html. Thanks muchly!


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 24th, 2011, 10:11 pm 
Offline

Joined: August 23rd, 2011, 10:05 pm
Posts: 5
Anonymous wrote:
You might want to check few posts by evandevon who is developing applications for people with disabilities, he made a mousetrainer for example but if you contact him he might be able to give you some tips as well.
Mouse trainer:
http://www.autohotkey.com/forum/viewtop ... setrainer/


Thanks a bunch. The mouse trainer actually worked for the mouse click with one of the features.

Overall probably too complicated for my needs, but I can still use it.

Evandevon if you do wind up looking at this, I would ultimately need to adjust the ignore double click finer than 1 second at a time…

And I will ultimately need to figure out how to do the same with a hotkey to activate my alt shift tab key.

I am going to try to contact evandevon to see if he has any input!

Sorry I did not have time today to try a lot more experimenting, I will kepp working with it...

Regards, Ed


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 24th, 2011, 10:17 pm 
ed hit wrote:
When I copy into notepad, I lose the color; IIRC, the macros should ignore the green. Since it is black I tried deleting the whole line but still no go.

1) Regular notepad does not have syntax highlighting so the "green line" which is just a comment by the way because it starts with a ; isn't actually green in notepad, you can indeed safely remove it. You can use http://www.autohotkey.net/~fincs/SciTE4 ... key_3/web/
2) Be sure to save your script in the correct encoding for your version of autohotkey (you may have the ansi or the unicode version)
3) Also be sure to save the script with the correct extenstion file.ahk and also be sure to actually run it or add it to an existing script and reload it.

You should try the http://www.autohotkey.com/wiki/index.ph ... #Tutorials to get the basics of hotstrings, hotkeys, editing etc.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: August 26th, 2011, 3:30 pm 
Offline

Joined: April 22nd, 2008, 7:13 pm
Posts: 82
Hi Ed!

EDIT:I've made a little program with a slider that sits above the clock
It increments a click delay in 0.2 second chunks with the buttons:
Enter / Space / Left Click / Middle Click / Right Click
(This way a mispressed Right click still left clicks)

Image
Note:The delay doesn't apply when your changing the slider
You can download the code or the compiled-for-windows program

Download the improved .ahk file here
OR
Download the improved executable file here
Continue down if you want to look at the original simpler code
END EDIT

Firstly, you deserve a bit of praise for doing some research and ending up onto Autohotkey! Same reasons drove me here too. I'm happy you gave MouseTrainer a go. I really just coded it for myself so it's not very user friendly (but is flexible) - when I finish some other projects I'm working on I'll re-write it I think.

I can understand your situation - sometimes a student does things so quickly they can't link causes and effects, and if it's purely a physical issue then they will be distressed at their lack of control.

There are two VERY different solutions which you can work on.
1. If you are pretty techy you can actually make your own version of the switch using something called an "Arduino" which will be able to be used in switch adapted toys and such (I'm working on something similar). If you are interested (and have time to learn) I'm happy to share what I know about setting one up. The possibilities are endless with this!

2. Purely software (and "almost" purely Windows based) which is easier and free (although the switches are crazily expensive).
Here's some simple code that I whipped up to meet a few of your needs:
just change the sleep bit from 5000 (5 seconds) to e.g. 2000(2 seconds) to meet your needs.
Basically I just made hotkeys for all the keys I though you might like to use as a switch-click, when pressed they call up "Click_And_Wait" which just clicks and waits a time period - not allowing other clicks until that period expires. (Press escape to exit it)


Code:
esc::Exitapp

Space::
{
   Goto,Click_And_Wait
   return
}

Enter::
{
   Goto,Click_And_Wait
   return
}

Lbutton::
{
   Goto,Click_And_Wait
   Return
}

Mbutton::
{
   Goto,Click_And_Wait
   Return
}

Rbutton::
{
   Goto,Click_And_Wait
   Return
}


Click_And_Wait:
{
   Click
   Sleep,5000
   return
}


Or download the .ahk file here

I also advise you to download and install http://www.autohotkey.net/~fincs/SciTE4 ... nload.html
which has nice colours for different parts of the code to help you follow what is going on.

Give it a go and tell me if there's anything I missed or that is not clear - (My code has some useless bits - I have bad coding habits). If you're interested in learning Autohotkey (I advise it) I'm happy to give advice and the forum here is friendly and helpful.

Evandevon
P.S. I would appreciate some feedback on MouseTrainer if there was anything you thought about it.

_________________
Inventing problems that need solutions...

Open Communicator
MouseTrainer


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bing [Bot], BrandonHotkey, chaosad, MSN [Bot] and 22 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group