Jump to content
Sign in to follow this  
Xandl

Problem with send("{key up/down}")

Recommended Posts

Xandl

Hello,

I am trying to set a keys up/down state using send("{key up/down}").

According to the docs, it looks like this method should work (example with "a" key there).

My problem is that the key does not get released.

I am aware about "SHIFTDOWN/UP", but i would like to use other keys as well.

There is a test script below.

How to test:

- type in the edit. shift is not active.

- press "SHIFT down" button

- type in the edit. shift is pressed.

- press "SHIFT up" button

- type in the edit. shift is NOT released. (problem)

- press and release your keyboards left shift key

- type in the edit. shift is released now.

GUICreate('send test',300,200)
$down=GUICtrlCreateButton('SHIFT down',10,10,100)
$up=GUICtrlCreateButton('SHIFT up',120,10,100)
$ed=GUICtrlCreateEdit('type here to check LSHIFT status',0,50,300,150)
ControlFocus('send test','',$ed)
GUISetState()

While 1
    Switch GUIGetMsg()
        Case -3
            Exit
        Case $down
            Send("{LSHIFT down}")
            ControlFocus('send test','',$ed)
        Case $up
            Send("{LSHIFT up}")
            ControlFocus('send test','',$ed)
    EndSwitch
    Sleep(20)
WEnd

So how can I press/hold/release keys?

thanks,

xandl

Share this post


Link to post
Share on other sites
d4rk

Here :

#512706


[quote]Don't expect for a perfect life ... Expect a least troubles ones[/quote]Contact me : ass@kiss.toWhat I Have Done :Favorites Manager Mangage your favorite's folder, that's coolPC Waker For those who want to save stickersWebScipts Supporter For those who've just started with Web and WebScriptsTemporary Looker Simple but powerful to manage your Temporary folder, you know what you downloaded[UDF] _NumberFormat() Better performance on number display[UDF] _DirGet() What a folder contain [how many (hidden,normal,...) files], with one line of code[UDF] _IsPressEs() Just like _IsPress() but for a group of keys

Share this post


Link to post
Share on other sites
Xandl

Here :

#512706

Thank you, but I am not sure this is exactly my problem.

The point is, that I wonder why the explicit sent "up" does not work.

I used "SHIFTUP/DOWN" first, this worked reliable.

So I was hoping that the up/down options in send would work with "LSHIFT" or other keys, too.

From the help:

To hold a key down (generally only useful for games)

Send("{a down}") ;Holds the A key down

Send("{a up}") ;Releases the A key

ciao

xandl

Share this post


Link to post
Share on other sites
d4rk

From the help file :

{SHIFTDOWN} Holds the SHIFT key down until {SHIFTUP} is sent


[quote]Don't expect for a perfect life ... Expect a least troubles ones[/quote]Contact me : ass@kiss.toWhat I Have Done :Favorites Manager Mangage your favorite's folder, that's coolPC Waker For those who want to save stickersWebScipts Supporter For those who've just started with Web and WebScriptsTemporary Looker Simple but powerful to manage your Temporary folder, you know what you downloaded[UDF] _NumberFormat() Better performance on number display[UDF] _DirGet() What a folder contain [how many (hidden,normal,...) files], with one line of code[UDF] _IsPressEs() Just like _IsPress() but for a group of keys

Share this post


Link to post
Share on other sites
Xandl

Hello,

yes this is what I did first as you can see in my post.

But why does the other method not work?

I was hoping to be able to handle all keys the same way.

ciao

xandl

Share this post


Link to post
Share on other sites
d4rk

i see LSHIFT down/up in your code

i'm mentionting about SHIFTDOWN/SHIFTUP


[quote]Don't expect for a perfect life ... Expect a least troubles ones[/quote]Contact me : ass@kiss.toWhat I Have Done :Favorites Manager Mangage your favorite's folder, that's coolPC Waker For those who want to save stickersWebScipts Supporter For those who've just started with Web and WebScriptsTemporary Looker Simple but powerful to manage your Temporary folder, you know what you downloaded[UDF] _NumberFormat() Better performance on number display[UDF] _DirGet() What a folder contain [how many (hidden,normal,...) files], with one line of code[UDF] _IsPressEs() Just like _IsPress() but for a group of keys

Share this post


Link to post
Share on other sites
Xandl

i see LSHIFT down/up in your code

i'm mentionting about SHIFTDOWN/SHIFTUP

Yes, thats possible for five modifier keys, but what if I want the i.e. DEL key to be pressed, for a period of time?

In this case, the events come from a gamepad device, from its buttons.

What I want to do, is pressing/ holding/releasing keys corresponding to the buttons pressed/held/released on the gamepad.

ciao

xandl

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×