Hi Rod,
Here is the entire program to allow you to set the timer for a given
window. I activate this using a hotkey such as Control-Shift-3 keys.
I can send you the entire package I made to you instead of uploading the app to
app central, but maybe I will do that for those who may want it.
You have to change the time to the desired time you want. I placed it at 15
seconds here or .25 minutes as shown below. I did this for testing and you can
install this app and test it to see what I have done.
i use the left and right arrow to trigger and it only does it in the window you
had first set the app running.
The insert key requires 2 key values so if no modifiers just put kmNone as
I have done.
I will also zip up the entire app, including the .xml and let you try it
out.
Bruce
Entire App:
Dim oKeyActiveWindow: set oKeyActiveWindow = Nothing
Dim oKeyActiveChildren: Set oKeyActiveChildren = Nothing
Dim myKeyboard: Set myKeyboard = Keyboard
Dim globalTimer: globaltimer = 0
Dim globaltimerVal: globalTimerVal = .25 'Minutes
Dim myKeyboardConnection: myKeyboardConnection = 0
'Initial setting of timer.
' my_KeyUpConnection = ConnectEvent( Keyboard, "OnKeyProcessedUp",
"OnKeyProcessedUp")
Sub Key_Monitoring( myKeyId)
'This routine is called when the hotkey Control-Shift-4 is pressed.
If Keyboard.KeyDescriberActive Then
Speak myStrings(myKeyId & "_Description")
Else
'Main routine functionality goes here
Queue "Activate_Monitoring"
End If
End Sub
Sub Activate_Monitoring()
'Assumes present program when hotkey is hit is the active application for
monitoring.
If myKeyboardConnection = 0 Then
set oKeyActiveWindow = activeWindow.overlap
' Filter keyboard events for only this process
' myKeyboard.FilterProcess = oKeyActiveWindow.Process
On Error GoTo 0
' handle all MSAA event types
myKeyboardConnection = ConnectEvent( Keyboard, "OnKeyProcessedUp",
"MonitoringKeyUp")
Silence
Speak " Keyboard Monitoring Is Turned On! "
Sleep 1000
ResetTimer globalTimerVal
Else
Disconnect myKeyboardConnection
myKeyboardConnection = 0
On Error Resume Next
If globaltimer > 0 Then
StopTimer globalTimer
globalTimer = 0
End If
Set oKeyActiveWindow = Nothing
Silence
Speak " Keyboard Monitoring Is Shut Off! "
Sleep 1000
End If
End Sub
Sub MonitoringKeyUp( ky, km)
'Key up was processed.
If oKeyActiveWindow.Handle = activeWindow.overlap.Handle Then
Silence
Speak " Key Is Up "
Sleep 1000
Queue "ResetTimer", globalTimerVal
End If
End Sub
Sub ResetTimer( ByVal timerVal)
If globaltimer > 0 Then
StopTimer globalTimer
globalTimer = 0
End If
' Convert time to milliseconds.
timerVal = timerVal * 60 * 1000
globalTimer = StartTimer( timerVal, "DoTab" )
Speak " Timer Is Set "
Sleep 1000
End Sub
Sub DoTab()
If oKeyActiveWindow.Handle = activeWindow.overlap.Handle Then
'Keyboard.WaitForAllKeysUp()
Keyboard.InsertKey vk_Right, kmNone
Sleep 2000
Keyboard.InsertKey vk_Left, kmNone 'kmShift
Sleep 2000
End If
ResetTimer globalTimerVal
End Sub
---
This email is free from viruses and malware because avast! Antivirus protection
is active.
http://www.avast.com