This is just like like a Clock generator which I believe is long overdue .
Clock generator or Automatic Switch toggling works by using a third parties software called AutoHotkey.
AutoHotkey can be programmed to control any key with any key presses.
First download AutoHotkey from:
http://www.autohotkey.com/download/
I downloaded Installer for AutoHotkey Basic (1.95 MB)
Please note this software is freeware and appears to be genuine with a support forum. I have used it on a couple of PC's with no issues whatsoever. I have even scanned with Microsoft Security Essentials with nothing found. But as with all software downloaded from the internet, it's at your own risk.
After downloaded and installed you don't need to save sample scrip when prompted since you will be using the attached script (.ahk extension) I developed just for the Automatic Switch toggling.
Save Flowcode Toggle Keys.ahk to any folder on your PC.when saved you can double click file to run AutoHotkey software. When running there will be a green square Icon with a White H in the tray or your PC. Now load the flowchart that's also contained within the attached zip file.
I have set up the flowchart with key mapping which I have explained about here:
http://www.matrixmultimedia.com/mmforum ... 219#p21219
With the Key mapping set up, you press key 5 to toggle switch thats it's mapped to. Every time that key 5 is pressed then since the switch is assigned to port B5 interrupt-on -change, number on LCD is incremented by one.
Now for the automation part.
I have set up AutoHotkeys so if click run on Flowcode then hold Ctrl and Alt and press number 5 on the top row of keyboard, then the number 5 will be rapidly repeated.
To stop 5 from being constantly activated then press Space bar.
Note: it is not advisable to click on any text input box after you have activated the repeating key or you will just see 555555555555555555555555 going across the input box or text editor. You will need to press space bar to stop repeat function first.
You can also stop the the script by right clicking on AutoHotkeys icon that's in the windows task bar.
Here is what the script looks like I have created for AutoHotkeys:
Code: Select all
;Auto Toggle Switches
;By Medelec35
^!$0:: ; Make the Ctrl Alt 0 key into a hotkey (the $ symbol facilitates the "P" mode of GetKeyState below).
sleep 100
Loop ; Since no number is specified with it, this is an infinite loop unless "break" or "return" is encountered
inside.
{
if GetKeyState("space", "P") ; If this statement is true, the user has just pressed the space bar to stop.
break ; Break out of the loop.
; Otherwise (since the above didn't "break"), keep sending 0
send 0 ;
sleep 60 ; time in ms between activation key 1
}
sleep 100
return
^!$1::
sleep 100
Loop
{
if GetKeyState("space", "P")
break
send 1
sleep 60
}
sleep 100
return
^!$2::
sleep 100
Loop
{
if GetKeyState("space", "P")
break
send 2
sleep 60
}
sleep 100
return
^!$3::
sleep 100
Loop
{
if GetKeyState("space", "P")
break
send 3
sleep 60
}
sleep 100
return
^!$4::
sleep 100
Loop
{
if GetKeyState("space", "P")
break
send 4
sleep 60
}
sleep 100
return
^!$5::
sleep 200
Loop
{
if GetKeyState("space", "P")
break
send 5
sleep 60
}
sleep 100
return
^!$6::
sleep 100
Loop
{
if GetKeyState("space", "P")
break
send 6
sleep 60
}
sleep 100
return
^!$7::
sleep 100
Loop
{
if GetKeyState("space", "P")
break
send 7
sleep 60
}
sleep 100
return
^!$8::
sleep 100
Loop
{
if GetKeyState("space", "P")
break
send 8
sleep 60
}
sleep 100
return
^!$9::
sleep 100
Loop
{
if GetKeyState("space", "P")
break
send 9
sleep 60
}
sleep 100
return
As a test I started the switch toggling and number on LCD went from 0 to 300 in 23 seconds.
Bearing in mind that count is increment only when key 5 is pressed and released.
The script can be altered to go even faster if required.
Have fun and don't forget you use the space bar to stop key 5 being repeat pressed.
Hope I have giving enough information as it took me a little while to work out the script, and its late for me.
Martin