Hello,
This might be a dumb question, but is there a way in LiveCode to simulate sending keyboard keys to non-LiveCode applications/windows? For example, if I am running Firefox and want to send a CTRL-T in order to open a new tab, is there a way that I can simulate the CTRL and T being pressed and then send it to a particular instance of a Firefox Window accordingly?
Thanks,
- Boo
Is there a way to send keyboard keys to other windows?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
- VIP Livecode Opensource Backer
- Posts: 348
- Joined: Sun Jul 03, 2011 2:04 am
Re: Is there a way to send keyboard keys to other windows?
For a test run to see how it could be done, make a simple stack with a button and a field.
(disclaimer- I don't know vbscript very well, so anything more complex than this would require research)
In the field put the following:
Assuming firefox is already open, clicking the button should pop a new tab up. On this same note, its very possible that firefox has vbscript hooks so it might be possible to talk to it in a more direct way. But as I said, I don't know as much about vbscript as I would like.
(disclaimer- I don't know vbscript very well, so anything more complex than this would require research)
In the field put the following:
For the button script, put:Dim Wsh
Set Wsh = CreateObject("Wscript.Shell")
Wsh.AppActivate "Firefox" -- activate firefox so that it has focus
Wsh.SendKeys "^t" -- send the keys. the ^ stands for control in this case. % is alt, + is shift.
Code: Select all
on mouseUp
do field 1 as "vbscript"
end mouseUp