4 posts in this topic
Using GetMousePos for calculating a MouseClick
I've encountered a small issue i just cant seem to program my way out of...
What im doing is: ;or rather, what im trying to do is
Pixelsearch for a color, within a part of my screen,
If color is present, i will rightclick it, for a menu to appear,
in which i want to Leftclick an option. Simplicity itself.
The issue is that because this menu appears in different parts of my screen, its complicated to select the option i want to click.
There is no special color to it, and i cannot define the area in which to click, because the menu appears different places.
The only thing that is in common for the menu is that the Leftclick needs to be (lets say) 30pixels below the rightclick
What can be done, but seemingly not by me, is to get the coordinates of the rightclick, and use them as the "starting point" from where the coordinates for the leftclick will be.
(Not sure if that makes sence, but maybe the code below will help you understand)
You guys like example codes, so therefore i will give it my best shot, and hope it proves usefull
$pos = Pixelsearch(200, 400, 200, 400, 0xFFFFFF) ;This color is what i need to rightclick to bring up the menu
If not @Error then ;If the color is present
(Mouseclick("Right", $pos, $pos, 1, 1) ;Rightclick it, to bring up menu
;Here comes the part i cannot get to work
$x = MousegetPos(X) ;To get the Coordinate "X", so we can calculated with it for the position of the leftclick
$y = MousegetPos(Y) ; To get the Coordinate "Y", so that can be calculated with for the position of the leftclick
MouseClick("Left", $x, $y-30, 1, 1) ;This was supposed to give me a leftclick that is 30pixels below the rightclick.
(The MouseGetPos(X), may seem as a waste of space in this example, but in my script i will need both.
Im only using one in the example, mainly so that i wont confuse myself, but also to make it easier to digest for you guys)
I have not been able to find any topic that covers this, but my apologies if such a topic already exist in the forums.
Maybe while im at it, can i ask, what good does the  and  do, when using a "$variable" as coordinate?
Thanks in advance
Autoit Window Position
I want to get the window coordinates of the command line window I tried following but it cannot acces the variable $aPos...
Local $sCommandlinePath = "C:\Windows\system32\cmd.exe" RunCm() Func RunCm() RunWait($sCommandlinePath) ; Retrieve the position as well as height and width of the active window. Local $aPos = WinGetPos("[CLASS:ConsoleWindowClass]") ; Display the array values returned by WinGetPos. MsgBox($MB_SYSTEMMODAL, "", "X-Pos: " & $aPos & @CRLF & _ "Y-Pos: " & $aPos & @CRLF & _ "Width: " & $aPos & @CRLF & _ "Height: " & $aPos) EndFunc While 1 Sleep(1000) RunCm() WEnd
GDIPlus Arc Calculate Position
I'm weak at mathematic, how to calculate blue point position? I only know red points positions, and arc degree:
Can anybody write an example, function?
Splash Image Help
SplashImageOn("Splash", @ScriptDir & '\Media\Splash.jpg', 600, 400, x pos, y pos, $DLG_NOTITLE + $DLG_MOVEABLE) What should I replace in x pos and y pos for getting my splash image centered? (Empty strings didn't work)
How to get a file x,y position to drag and drop in another window
Hello Great AutoIt Members
I want to drag and drop a file from 1st window to a 2nd window of an application.
I use the MouseClickDrag() function, and it's working good if I specified the X,Y coordinates manually of the file to be dragged and dropped
my problem now is how I can get the file position (X,Y coords) in the screen automatically?
I've tried this code by browsing the file location in an IE browser object (since the GUI window will be empty other than my file and it'll be easy to get file position relative to the GUI window) but it's not working in win8
#include <IE.au3> $oIE = _IECreateEmbedded() $exp_hwnd = GUICreate("", 200, 200, 0, 0) GUICtrlCreateObj( $oIE, 0, 0 , 200, 200 ) GUISetState () _IENavigate($oIE, @DesktopDir, 0) sleep(1000) MouseClickDrag( "left", 50, 50, 300, 300) I hope anyone has any other solution to this simple problem.
thanks for any help