nilsso

Bind 1 key to press 2 at the same time

19 posts in this topic

#1 ·  Posted

Im new to autoit. I guess i can just open a txt file and save it as au3 right?

My question is: How do I bind 1 key to press 2 keys at the same time first down then up

Send{123}, but how do i bind it to a key? Thanks

Share this post


Link to post
Share on other sites



#2 ·  Posted

Update: Im trying to make a script that sends RWIN and + bound to a key. But i get an error, this is the script:

Send ("{RWIN}{+}"NUMPADADD)

Need some help thanks :)

Share this post


Link to post
Share on other sites

#3 ·  Posted

Take out the NUMPADADD

Share this post


Link to post
Share on other sites

#4 ·  Posted

Just now, InunoTaishou said:

Take out the NUMPADADD

Where do I put it? I want to bind clicking right windows and "+" to numbpadadd. Thanks!

Share this post


Link to post
Share on other sites

#5 ·  Posted

I think you mean you want the numpad + to be the hotkey and when it's pressed to send Right Window and +?

Then you need to do this

HotKeySet("{NUMPADADD}", SendCombo)

While (True)
    Sleep(100)
Wend

Func SendCombo()
    Send("{+}{RWin}")
End Func

 

Share this post


Link to post
Share on other sites

#6 ·  Posted

8 minutes ago, InunoTaishou said:

I think you mean you want the numpad + to be the hotkey and when it's pressed to send Right Window and +?

Then you need to do this

HotKeySet("{NUMPADADD}", SendCombo)

While (True)
    Sleep(100)
Wend

Func SendCombo()
    Send("{+}{RWin}")
End Func

 

Would this work as well?

HotKeySet("{NUMPADADD}")

Send ("{RWIN}{+}")

 

Share this post


Link to post
Share on other sites

#7 ·  Posted

I managed to get it to work:

HotKeySet("{NUMPADADD}")
Send ("{RWINDOWN}{+DOWN}")
Sleep(100)
Send ("{RWINUP}{+UP}")

Now, I open the program and it zooms my windows, but only 1 time, how do I make it so when I press numpadadd it does it? Thanks.

Share this post


Link to post
Share on other sites

#8 ·  Posted

@nilsso the question no one has asked yet is exactly what are you trying to accomplish? I would guess some sort of zooming in an application, which one? Often the app has some of these controls built in, and there will be a much easier way to do it than with Send, which are inherently unreliable.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

#9 ·  Posted

Ive tried and asked, i want windows zoomer to be bound to + - on the numpad and a active hotkey when i press it. Is that possible to achieve?

Share this post


Link to post
Share on other sites

#10 ·  Posted

And my question remains. When you say "windows zoomer", what exactly do you mean - setting the zoom within a specific application, or on the Windows desktop? Because how you go about it changes based on the answer to that question.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

#11 ·  Posted

1 hour ago, JLogan3o13 said:

And my question remains. When you say "windows zoomer", what exactly do you mean - setting the zoom within a specific application, or on the Windows desktop? Because how you go about it changes based on the answer to that question.

The windows 10 zoom application. Its simply zooming in and out by pressing + or - on the numpad.

Share this post


Link to post
Share on other sites

#12 ·  Posted

I guess you mean the Windows Zooming function instead of app? 
In general the zoomlevels is changed in any Application with these keys combinations:

Send("^{NUMPADADD}")
Send("^{NUMPADADD}")
sleep(2000)
Send("^{NUMPADSUB}")
Send("^{NUMPADSUB}")

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

I think he's talking about the Magnifying tool installed on Windows. The Windows key and + (add sign) will increase the magnification by 100%, even if the program is not open.

HotKeySet("{NUMPADADD}", IncreaseZoom)
HotKeySet("{NUMPADSUB}", DecreaseZoom)
HotKeySet("{ESC}", Close)

While (True)
    Sleep(100)
Wend

Func Close()
    Exit
EndFunc

Func IncreaseZoom()
    Send("{RWIN DOWN}{+ DOWN}{+ UP}{RWIN UP}")
EndFunc

Func DecreaseZoom()
    Send("{RWIN DOWN}{- DOWN}{- UP}{RWIN UP}")
EndFunc

(Had to make it do the + down then up because windows wasn't recognizing that it was being pressed, but this works. Hopefully this is what OP is referring to....

Edited by InunoTaishou

Share this post


Link to post
Share on other sites

#14 ·  Posted

When i compile that script i get an parsing error Taishou. Not sure why. Will that make the - + button as active hotkeys and not just make it zoom in or out one time when u open the program? Thanks.

Share this post


Link to post
Share on other sites

#15 ·  Posted

You're not sure why....? The compiler will tell you the error and the line it occurred on. My copy/paste messed up and the second HotKeySet is completely messed up. Just change

HotKeySet("{NUMPADSUB}", 
)

To

HotKeySet("{NUMPADSUB}", DecreaseZoom)

 

Share this post


Link to post
Share on other sites

#16 ·  Posted

Yes, that seems to do it! Thank u :) I didnt realize it gave me the error in the error lining, my bad. Yeah, the copypaste fucked up somehow. Now it works as inteded. Is there a way to shorten the script down a bit? As mine is only like 4 lines and it would make it easier for me to learn with a smaller easier setup. thank u.

Would this work?:

HotKeySet("{NUMPADADD}")
Send ("{RWINDOWN}{+DOWN}")
Sleep(100)
Send ("{RWINUP}{+UP}")

HotKeySet("{NUMPADSUB}")
Send ("{RWINDOWN}{-DOWN}")
Sleep(100)
Send ("{RWINUP}{-UP}")

Share this post


Link to post
Share on other sites

#18 ·  Posted

1 hour ago, Jos said:

Did you try?

You'll know this won't work like that. ;)

Jos

I am at work, I wouldnt ask if i could try it. I was wondering if the script looks good or not :)

Share this post


Link to post
Share on other sites

#19 ·  Posted (edited)

No it doesn't,  you will find out when you try and debug that the script will end after a little more than 200 mSecs. ;)

Jos

Edited by Jos

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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