LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!
Is there a possibility to grab any key, also when my app doesn't have the focus??
In my app the focus is by word and I like to start an action in my programm with a key. Today I have a newbie-workaround-solution. I start the action with "after 5 seconds", go to word, open the menu i wand to take the snapshot (with menu opgen on image), and after 5 seconds my app make the snapshot correct
emmefisch wrote:Is there a possibility to grab any key, also when my app doesn't have the focus??
In my app the focus is by word and I like to start an action in my programm with a key. Today I have a newbie-workaround-solution. I start the action with "after 5 seconds", go to word, open the menu i wand to take the snapshot (with menu opgen on image), and after 5 seconds my app make the snapshot correct
I have tried out your keytracker.rev, thank you. But I think it does not function. I have open a word-window with an open menu. I would like to start import snaphot on a specific key. Because the word-menu has to be open, the word-window has the focus and get all these keys.
emmefisch wrote:I have tried out your keytracker.rev, thank you. But I think it does not function. I have open a word-window with an open menu. I would like to start import snaphot on a specific key. Because the word-menu has to be open, the word-window has the focus and get all these keys.
Thanks for your ideas.
Hi there! I was just wondering, have you tried switching to the Browse Tool first and once you've done that, have you clicked the Track Keys button thus making it colored yellow to indicate that it has been activated? And once you've done all that, you should see the keys that you press is reflected on the box below.
In case of menus, you may want to try a different approach such as combining a timer and the use of the import snapshot capability of revolution.
you want to intercept keystrokes that another app (or the os itself) is handling. there is no build in way in rev to do that. therefore you either need to intercept them at the driver level (this can be done using a platform specific external). you could also make that other app pass the keystrokes along to your rev-made app, for example using vba in office applications.
as far as I know, there is currently no external which does what you want.
Various teststacks and stuff:
http://bjoernke.com
Chat with other RunRev developers:
chat.freenode.net:6666 #livecode
shadowslash: That is my solution yet, i also had the idea to work with a timer. I click the button in my rev app and after 5 seconds i take the snaphot. I have 5 seconds to opben the menu in word - and it does function well.
emmefisch wrote:shadowslash: That is my solution yet, i also had the idea to work with a timer. I click the button in my rev app and after 5 seconds i take the snaphot. I have 5 seconds to opben the menu in word - and it does function well.
global clipboardVar
on mouseUp pMouseBtnNo
set the flag of me to not the flag of me
if the flag of me then checkStuff
end mouseUp
on checkStuff
if "32" is among the items of the keysdown then
beep
answer "space man!!!"
end if
if the clipboarddata<> clipboardVar then
put the clipboarddata into clipboardVar
beep
answer "clipboard!"
end if
if the flag of me then send "checkStuff" to me in 40 millisecs
end checkStuff
I don't understand the clipboard-idea. I have the plan to take a snaphot. With your code I can get a key also when the word-window has the focus. But the word-windows does lost the focus when I put down the 32 key. And the openened menu in word does close before I can take the snapshot.
actually I just added some trivia here. I wanted to demonstrate, that you can make the rev app inactive and still listen to what is going on on your system. So the clipboarddata thing was there to demonstrate that you can react to someone copying something from somewhere. 32 is the spacebar, so obviously that would be no good key to interface with word However, you could fin a key that makes sense and adapt the script to your needs. Assuming you want to react to shift-control-s for a snapshot.
(snippet out of the top of my head, adapt to your needs)
on mouseUp pMouseBtnNo
set the flag of me to not the flag of me
if the flag of me then checkStuff
end mouseUp
on checkStuff
if 83 is among the items of the keysdown then
if the shiftkey is down and the controlkey is down then
export snapshot from rect "0,0,200,200" to file "test.jpg" as JPEG
beep
end if
end if
if the flag of me then send checkStuff to me in 40 millisecs
end checkStuff