Page 1 of 1

getkey system??

Posted: Thu Aug 20, 2009 1:08 pm
by emmefisch
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

Posted: Thu Aug 20, 2009 1:16 pm
by Klaus
Grüezi Fredi,

no sorry, this is not possible without an external!

See also this thread:
http://forums.runrev.com/phpBB2/viewtopic.php?t=3533


Best

Klaus[/url]

Re: getkey system??

Posted: Sat Aug 22, 2009 12:39 pm
by shadowslash
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

Posted: Sat Aug 22, 2009 3:42 pm
by emmefisch
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.

Posted: Mon Aug 24, 2009 11:54 am
by shadowslash
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.
Image
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.

Posted: Mon Aug 24, 2009 1:46 pm
by BvG
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.

Posted: Mon Aug 24, 2009 9:34 pm
by emmefisch
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.

Posted: Thu Aug 27, 2009 12:13 pm
by shadowslash
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... Image

Posted: Thu Aug 27, 2009 12:25 pm
by malte
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

Posted: Thu Aug 27, 2009 9:11 pm
by emmefisch
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.

Posted: Thu Aug 27, 2009 10:02 pm
by malte
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 :D 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

Posted: Fri Aug 28, 2009 5:01 pm
by emmefisch
Hi malte

Its perfect, that's exactly what I want!! Thank you very much.

Fredi