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!
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
emmefisch
- Posts: 27
- Joined: Thu Jul 23, 2009 2:50 am
Post
by emmefisch » Thu Aug 20, 2009 1:08 pm
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
Any idea? Thanks a lot.
Fredi
-
shadowslash
- Posts: 344
- Joined: Tue Feb 24, 2009 6:14 pm
-
Contact:
Post
by shadowslash » Sat Aug 22, 2009 12:39 pm
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
Any idea? Thanks a lot.
Fredi
What do you mean by
grabbing a key? If you mean like a tracking what the user presses then you can try my stack out.
http://www.mediafire.com/file/dyjojgg2t ... racker.rev
Parañaque, Philippines

-
emmefisch
- Posts: 27
- Joined: Thu Jul 23, 2009 2:50 am
Post
by emmefisch » Sat Aug 22, 2009 3:42 pm
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.
-
shadowslash
- Posts: 344
- Joined: Tue Feb 24, 2009 6:14 pm
-
Contact:
Post
by shadowslash » Mon Aug 24, 2009 11:54 am
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.
Parañaque, Philippines

-
BvG
- VIP Livecode Opensource Backer

- Posts: 1239
- Joined: Sat Apr 08, 2006 1:10 pm
-
Contact:
Post
by BvG » Mon Aug 24, 2009 1:46 pm
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
-
emmefisch
- Posts: 27
- Joined: Thu Jul 23, 2009 2:50 am
Post
by emmefisch » Mon Aug 24, 2009 9:34 pm
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.
Thanks all for your help.
-
shadowslash
- Posts: 344
- Joined: Tue Feb 24, 2009 6:14 pm
-
Contact:
Post
by shadowslash » Thu Aug 27, 2009 12:13 pm
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.
Thanks all for your help.
Glad to be of help...

Parañaque, Philippines

-
malte
- Posts: 1098
- Joined: Thu Feb 23, 2006 8:34 pm
-
Contact:
Post
by malte » Thu Aug 27, 2009 12:25 pm
Actually you might be surprised to see what you can do with timers.

Even if the rev app is inactive:
In a button (just as a proof of concept. The answer command does not make too much sense, unless you script a way to make the rev app active)
Code: Select all
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
Cheers,
Malte
-
emmefisch
- Posts: 27
- Joined: Thu Jul 23, 2009 2:50 am
Post
by emmefisch » Thu Aug 27, 2009 9:11 pm
Hi malte
Thank you for your script.
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.
-
malte
- Posts: 1098
- Joined: Thu Feb 23, 2006 8:34 pm
-
Contact:
Post
by malte » Thu Aug 27, 2009 10:02 pm
Hi emmefish,
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)
Code: Select all
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
Cheers,
Malte
-
emmefisch
- Posts: 27
- Joined: Thu Jul 23, 2009 2:50 am
Post
by emmefisch » Fri Aug 28, 2009 5:01 pm
Hi malte
Its perfect, that's exactly what I want!! Thank you very much.
Fredi