pressing Q should be Q + MB RightClick - autohotkey

I was wondering if this can be done in AutoHotKey that whenever I press Q the output should be Q and mouse right click. I tried
Q::MouseClick, right but this doesnt do the Q keystroke. Any help is appreciated.

As well as ~ you can send the ASCII character
q::
Send, {Asc 113}
mouseclick, right
return

Related

How can i MouseClickDrag position while holding Ctrl+Windows key ? Autohotkey

Please, how can i hold Windows+Ctrl key while MouseClickDraging?
Here is the code:
Send, {Win Ctrl Down}
CoordMode, mouse, screen
MouseClickDrag, left, 3181, 326 , 3769, 642
Thanks
You need to ensure that the hotkey you use to trigger the logic does not conflict with the keys you want to send, ie. don't use Win or Ctrl. With that being said, the following example uses F3. For the Win key, you need to specify left or right. Since it doesn't seem to be of importance, the example just assumes LWin.
CoordMode, mouse, screen
F3::
Send, {LWin down}{Ctrl down}
MouseClickDrag, left, 3181, 326 , 3769, 642
Send, {Ctrl up}{LWin up}
return

Auto Hot Key.. Button Holding?

My brain is borderline flat and I'm having no luck understanding what Up and Down mean. I only want the hotkey to hold left click for whatever amount of time. If anyone could provide the code used for that and maybe a short explanation of how Up and Down work (r/explainlikeim5) that would be greatly appreciated. :)
$Lbutton:: ;when you push left mouse button(Can be changed)
Sendinput, {LButton down} ; holds left mouse button down
Sleep, 1000 ; delay in miliseconds(1 second delay)
Sendinput, {LButton up} ; releases left mouse button
Return
There you go sir.

re-maximize a minimized Gui

Is it possible to prevent a Gui to minimize on a WIN+D shortcut ?
One way of doing it would be to check from time to time if the Gui element is minimized and re-maximize it. But I don't know how to do that.
A very simple example script I'm working with as a reference
Gui +LastFound -Caption +ToolWindow -SysMenu
Gui, Color, 000000
Gui, Font, FF0000
Gui, Font, s12
Gui, Add, Text, vTxt cWhite, XXXXX YYYYY ; XX & YY serve to auto-size the window.
WinSet, TransColor, 0
SetTimer, UpdateOSD, 200
Gosub, UpdateOSD ; Make the first update immediate rather than waiting for the timer.
Gui, Show, x10 y10, NoActivate; NoActivate avoids deactivating the currently active window.
return
UpdateOSD:
MouseGetPos, MouseX, MouseY
GuiControl,, Txt, X %MouseX%, Y %MouseY%
return
Thanks for the help !
You can use context sensitivity to find out which GUI you have active and then write a standard button press shortcut, that then leads nowhere
#IfWinActive Untitled - Notepad
#d::
MsgBox , , Winkey + D pressed, You were inside a new untitled notepad and pressed Windows key + D but I stopped all actions
; Do nothing now
return
#IfWinActive
I just tested it... I keyed it to simple notepad, works for me.
Added a screenshot of the result

Trigger AHK script based on the position of the mouse

Is it possible to trigger an AHK script based on the position of the mouse? Say, if I wanted to press a button or series of buttons on my keyboard if I move my mouse to the corner or edge of the screen. Also, can this be done multiple times per second until the mouse is moved out of the specified area?
All I could find from googling is AHK scripts for moving the mouse using the keyboard, when I want to do the opposite.
I did it, thanks Aaron and ahkcoder.
I got a little better feel with Up and Down instead of PgUp and PgDn, to anyone else, play with the timings until it's sufficient. You'll also need to modify the values for the edges of your screen.
; move up and down when mouse is at edges of screen
#Persistent
SetTimer, foo, 65
return
foo:
MouseGetPos, x, y, id, control
; ToolTip, %x% %y%
; will trigger only at edges of a full screen
if (y = 1087){
; bottom
send {Down}
send {Down}
send {Down}
; sleep, 300
}
else if(y = 8){
; top
send {Up}
send {Up}
send {Up}
}
return
Yes. Easiest way I can think of to do what you are asking is to use SetTimer and MouseGetPos to evaluate the position and if it matches than trigger your script.
The 2nd example code on the MouseGetPos is using SetTimer. This should get you headed in the right direction.

How to click 2 screen regions at once and how to click without moving pointer in autohotkey

So how to click 2 screen regions at the same time or very fast one after another by using a single hotkey. The intent is to cover clicking on an object that can appear in 2 random areas of the screen by using a single key.
As an example I have tried using
a::click 735, 626 send, 750, 204 send, but it creates a loop for a few seconds, where the mouse is unresponsive and hovers in those areas, and using 2 separate hotkeys takes more time than i would wish.
I would also like to know if it is possible to issue a click command via a hotkey but not move the mouse pointer at all. I would like to set a hotkey that pressed will issue a left click command on a determined area of the screen but not move the mouse pointer in order to do so.
You definitely need to take a look at the help docs or FAQ again as well as some other examples to understand basic syntax. It is only one command per line. Here is an example of code that will get you going.
CoordMode, Mouse, Screen
SetDefaultMouseSpeed, 0 ; Sets default mouse speed to maximum
a::
MouseGetPos, X, Y ; Stores current mouse position
Click 735, 626
Click 735, 500
MouseMove, % X, % Y ; Moves mouse back to original position
Return
For the second question about issuing a click command without using the pointer, I suggest you look at the ControlClick documentation here: http://www.autohotkey.com/docs/commands/ControlClick.htm