I'm new to AHK (again), having watched 2 videos and then googling.
I'm trying to create a script that will pop up a little menu at the mouse position, for use in a program that doesn't allow one to add options to its right-click menu. The first time the GUI shows, the GUI is at the current mouse position, but all subsequent times the GUI alternates between two places, namely a seemingly random location and the top left corner of the active window. When I move my mouse to another location, and press the hotkey, I want the GUI to show at that new location (i.e. where the mouse cursor is). The GUI pops up at the new cursor position only if the Desktop is the active "window", but not if some other window is active window. What am I doing wrong?
Thanks
Samuel
Code: Select all
#SingleInstance, Force
!RButton::
MouseGetPos, xpos, ypos
Gui, Add, Button, gScript1, Script 1
Gui, Add, Button, gScript2, Script 2
Gui, Add, Button, gScript3, Script 3
Gui, Show, x%xpos% y%ypos%
return
Script1:
Gui, Hide
Run Notepad.exe
return
Script2:
Gui, Hide
Run Notepad.exe
return
Script3:
Gui, Hide
Run Notepad.exe
return
return