I just tried preceding the mouse down with twapi::move_mouse to reposition it and it worked. However, then what is the purpose of focus??
I just tried preceding the mouse down with twapi::move_mouse to
reposition it and it worked. However, then what is the purpose of
focus??
There is a windows speech application that is invoked with the Win key + h. Thanks to greg and others, it can be done programmatically. However the focus must be on an entry box so that the spoken text may be placed there. However, what happens is thatwhen the .tcl script is selected in explorer, the cursor remains over the .tcl file and the code gets invoked twice. So, it seems that focus is not moved away and the mouse down invokes it a second time. I thought focusmodel and focus would make what was
The twapi mouse down has to occur in the entry box.
(by the way, if I\we can get this working then there is a way to use azure speech for $0)
The tcl code is -
package require twapi
set SRStatement {}
wm iconify .
console hide
set top [toplevel .t1 -background {light blue}]
set theLabel [label $top.l1 -text {hello joe}]
set theEntryBox [ttk::entry $top.e1 -textvariable SRStatement -width 20 -font {{Segoe UI bold} 10}]
set theExit [ttk::button $top.b1 -text Close -command {destroy . $top ; exit}]
pack $theLabel $theEntryBox $theExit -side top -pady 16
wm focusmodel $top active
tkwait visibility $top
focus $theEntryBox
update
# make the mouse selection to indicate the text entry location for speech rec output
::twapi::click_mouse_button right
::twapi::send_input {"keydown 0x5B 0" "key 0x48 0" "keyup 0x5B 0"}
The Rickster schrieb am Mittwoch, 30. August 2023 um 07:12:06 UTC+2:that when the .tcl script is selected in explorer, the cursor remains over the .tcl file and the code gets invoked twice. So, it seems that focus is not moved away and the mouse down invokes it a second time. I thought focusmodel and focus would make
There is a windows speech application that is invoked with the Win key + h. Thanks to greg and others, it can be done programmatically. However the focus must be on an entry box so that the spoken text may be placed there. However, what happens is
Thanks ... was moving in that direction (pardon the pun). But seeing how you wrote it gives confidence. Think biggest cerebral issue was pointed out by Rich, Needed to separate Windows from TK.The twapi mouse down has to occur in the entry box.
(by the way, if I\we can get this working then there is a way to use azure speech for $0)
The tcl code is -
package require twapi
set SRStatement {}
wm iconify .
console hide
set top [toplevel .t1 -background {light blue}]
set theLabel [label $top.l1 -text {hello joe}]
set theEntryBox [ttk::entry $top.e1 -textvariable SRStatement -width 20 -font {{Segoe UI bold} 10}]
set theExit [ttk::button $top.b1 -text Close -command {destroy . $top ; exit}]
pack $theLabel $theEntryBox $theExit -side top -pady 16
wm focusmodel $top active
tkwait visibility $top
focus $theEntryBox
update
# make the mouse selection to indicate the text entry location for speech rec output
::twapi::click_mouse_button right
::twapi::send_input {"keydown 0x5B 0" "key 0x48 0" "keyup 0x5B 0"}#https://twapi.magicsplat.com/v4.7/ui.html#tkpath_to_hwnd #https://twapi.magicsplat.com/v4.7/ui.html#set_focus
...
twapi::set_focus [twapi::tkpath_to_hwnd $theEntryBox]
...
On Wednesday, August 30, 2023 at 11:36:41 AM UTC-7, greg wrote:that when the .tcl script is selected in explorer, the cursor remains over the .tcl file and the code gets invoked twice. So, it seems that focus is not moved away and the mouse down invokes it a second time. I thought focusmodel and focus would make
The Rickster schrieb am Mittwoch, 30. August 2023 um 07:12:06 UTC+2:
There is a windows speech application that is invoked with the Win key + h. Thanks to greg and others, it can be done programmatically. However the focus must be on an entry box so that the spoken text may be placed there. However, what happens is
Turns out, only solution is to use winfo to locate position of entry box, adjusted for screen location of toplevel, then use twapi to move the windows cursor accordingly. Next twapi click_mouse_button was used to effect physical, windows focus and,The twapi mouse down has to occur in the entry box.
(by the way, if I\we can get this working then there is a way to use azure speech for $0)
The tcl code is -
package require twapi
set SRStatement {}
wm iconify .
console hide
set top [toplevel .t1 -background {light blue}]
set theLabel [label $top.l1 -text {hello joe}]
set theEntryBox [ttk::entry $top.e1 -textvariable SRStatement -width 20 -font {{Segoe UI bold} 10}]
set theExit [ttk::button $top.b1 -text Close -command {destroy . $top ; exit}]
pack $theLabel $theEntryBox $theExit -side top -pady 16
wm focusmodel $top active
tkwait visibility $top
focus $theEntryBox
update
# make the mouse selection to indicate the text entry location for speech rec output
::twapi::click_mouse_button right
::twapi::send_input {"keydown 0x5B 0" "key 0x48 0" "keyup 0x5B 0"}#https://twapi.magicsplat.com/v4.7/ui.html#tkpath_to_hwnd #https://twapi.magicsplat.com/v4.7/ui.html#set_focus
...Thanks ... was moving in that direction (pardon the pun). But seeing how you wrote it gives confidence. Think biggest cerebral issue was pointed out by Rich, Needed to separate Windows from TK.
twapi::set_focus [twapi::tkpath_to_hwnd $theEntryBox]
...
Thanks again...and for what it is worth, this is a way to use\try out Azure speech rec (NOT VOICE REC, as many call it! {;-) )
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 497 |
Nodes: | 16 (2 / 14) |
Uptime: | 26:36:20 |
Calls: | 9,796 |
Calls today: | 15 |
Files: | 13,749 |
Messages: | 6,188,350 |