Search the Community
Showing results for tags 'position'.
-
I have a situation where the desktop is designed in java swings. The nodes JTree is not allowing me to do checkbox selection using "spacebar". I am able to navigate through the nodes using up, down arrow and a tab. When I reach to the desire node selection, mouse left click is not working due a flaw a JTree core. However since it is selected, if mouse cursor auto moved to the position of the selection and send a "click" then it should be solved. Any ideas much appreciated. the problem with having fixed coordinates are the main windows is divided to 2panels where right panel containing this JTree can be expanded or shrink-ed.
-
Hello . I implemented script like this But the vars $iX1 $iY1 are counting from the desktop start and I want it coords by window This not work with this script Opt("MouseCoordMode", 0) Func Mark_Rect() Local $aMouse_Pos, $hMask, $hMaster_Mask, $iTemp Local $UserDLL = DllOpen("user32.dll") ; Create transparent GUI with Cross cursor $hCross_GUI = GUICreate("Test", @DesktopWidth, @DesktopHeight - 20, 0, 0, $WS_POPUP, $WS_EX_TOPMOST) WinSetTrans($hCross_GUI, "", 8) GUISetState(@SW_SHOW, $hCross_GUI) GUISetCursor(3, 1, $hCross_GUI) Global $hRectangle_GUI = GUICreate("", @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP, $WS_EX_TOOLWINDOW + $WS_EX_TOPMOST) GUISetBkColor(0x00FF00) ; Wait until mouse button pressed While Not _IsPressed("01", $UserDLL) Sleep(10) WEnd ; Get first mouse position $aMouse_Pos = MouseGetPos() global $iX1 = Round($aMouse_Pos[0], 2) global $iY1 = Round($aMouse_Pos[1], 2) ; Draw rectangle while mouse button pressed While _IsPressed("01", $UserDLL) $aMouse_Pos = MouseGetPos() $hMaster_Mask = _WinAPI_CreateRectRgn(0, 0, 0, 0) $hMask = _WinAPI_CreateRectRgn($iX1, $aMouse_Pos[1], $aMouse_Pos[0], $aMouse_Pos[1] + 1) ; Bottom of rectangle _WinAPI_CombineRgn($hMaster_Mask, $hMask, $hMaster_Mask, 2) _WinAPI_DeleteObject($hMask) $hMask = _WinAPI_CreateRectRgn($iX1, $iY1, $iX1 + 1, $aMouse_Pos[1]) ; Left of rectangle _WinAPI_CombineRgn($hMaster_Mask, $hMask, $hMaster_Mask, 2) _WinAPI_DeleteObject($hMask) $hMask = _WinAPI_CreateRectRgn($iX1 + 1, $iY1 + 1, $aMouse_Pos[0], $iY1) ; Top of rectangle _WinAPI_CombineRgn($hMaster_Mask, $hMask, $hMaster_Mask, 2) _WinAPI_DeleteObject($hMask) $hMask = _WinAPI_CreateRectRgn($aMouse_Pos[0], $iY1, $aMouse_Pos[0] + 1, $aMouse_Pos[1]) ; Right of rectangle _WinAPI_CombineRgn($hMaster_Mask, $hMask, $hMaster_Mask, 2) _WinAPI_DeleteObject($hMask) ; Set overall region _WinAPI_SetWindowRgn($hRectangle_GUI, $hMaster_Mask) If WinGetState($hRectangle_GUI) < 15 Then GUISetState() Sleep(10) ; Get second mouse position global $iX2 = Round($aMouse_Pos[0], 2) global $iY2 = Round($aMouse_Pos[1], 2) ; Set in correct order if required If $iX2 < $iX1 Then $iTemp = $iX1 $iX1 = $iX2 $iX2 = $iTemp EndIf If $iY2 < $iY1 Then $iTemp = $iY1 $iY1 = $iY2 $iY2 = $iTemp EndIf If _IsPressed("01", $UserDLL) = 0 Then _GDIPlus_Startup () $hDC = _WinAPI_GetWindowDC(0) $hGraphic = _GDIPlus_GraphicsCreateFromHDC($hDC) ;Stworz pedzel i kolor, width ;$hPen = _GDIPlus_PenCreate(0x00FF00) ; Rysowanie linii ;_GDIPlus_GraphicsDrawLine($hGraphic,$iX1,$iY1,$iX2,$iY2,$hPen) ; middle of rectangle $xMiddle = ( $iX1 + $iX2 ) / 2 $yMiddle = ( $iY1 + $iY2 ) / 2 _GDIPlus_GraphicsDrawRect( $hGraphic, $xMiddle-20, $yMiddle-20, 40, 40) EndIf WEnd GUIDelete($hRectangle_GUI) GUIDelete($hCross_GUI) DllClose($UserDLL) EndFunc ;==>Mark_Rect
- 3 replies
-
- rectangle
- mark region
-
(and 2 more)
Tagged with:
-
Hello There! 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[0], $pos[1], 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[0], $y-30[1], 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 [0] and [1] do, when using a "$variable" as coordinate? Thanks in advance - DiveHigh
- 5 replies
-
- mouseclick
- mousegetpos
-
(and 3 more)
Tagged with:
-
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[0] & @CRLF & _ "Y-Pos: " & $aPos[1] & @CRLF & _ "Width: " & $aPos[2] & @CRLF & _ "Height: " & $aPos[3]) EndFunc While 1 Sleep(1000) RunCm() WEnd
-
Hello, 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? Thanks!
-
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)
-
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
-
Hi people, I hope you can help. I have a GUI with a scrollable child GUI containing an image. I am trying to get the x,y position of the mouse relative to the image. I'm using opt ('MouseCoordMode', 2) MouseGetPos() and GUIGetCursorInfo($Child_GUI) both return the position of the mouse on the window. So unless there is another command I have overlooked ??? !! The alternate way is if I knew the current top and left of the image that is actually visible. From this it would be simple to calculate the image (x,y) that the mouse is over. I have used #include "GUIScrollbars_Ex.au3" for the scrollbars. Had hoped the values I need would be lurking in that code but if they are I can't see them. I suspect I am missing the point somewhere (again) All help greatly appreciated. Bob
-
Hi, I would like to be able to set the position of the caret in a GUICtrlEdit box. I have a function that inserts a placeholder into the text box at the current position (which I obtain using _GUICtrlEdit_GetSel) and I would like to move the caret to the end of the text inserted. Could somebody help me achieve this please? Thanks in advance
- 20 replies
-
- GUICtrlEdit
- typing
-
(and 3 more)
Tagged with:
-
How can I search for a certain color in a background or masked window by other windows( no minimized ), and get the color's relative window's coordinates ?? Is it possible ? I appreciate any help....
- 33 replies
-
- pixelsearch
- background
-
(and 7 more)
Tagged with: