Jump to content

Bind 1 key to press 2 at the same time


Recommended Posts

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

Link to comment
Share on other sites

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}{+}")

 

Link to comment
Share on other sites

  • Moderators

@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.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

  • Moderators

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.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • Developers

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

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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}")
Link to comment
Share on other sites

  • Developers

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

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...