Jump to content

Search the Community

Showing results for tags 'rectangle'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 3 results

  1. ; https://www.autoitscript.com/forum/topic/211986-creates-a-rectangle-frame/ ;---------------------------------------------------------------------------------------- ; Title...........: _GuiFrame.au3 ; Description.....: Creates a rectangle frame ; AutoIt Version..: 3.3.16.1 Author: ioa747 ; Note............: Testet in Win10 22H2 ;---------------------------------------------------------------------------------------- #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #include <WindowsConstants.au3> #include <WinAPIGdi.au3> ;Example: Global $aCoord, $hPoint, $hFrame = _GuiFrame("", 100, 100, 200, 200, 5, 0xFFFFFF, 255) ;********************************** Do $aCoord = PixelSearch(100, 100, 200, 200, 0xFFFFFF, 0, 1, 0) ;0xFFFFFF White If Not @error Then ConsoleWrite("found White at X,Y: " & $aCoord[0] & "," & $aCoord[1] & @CRLF) $hPoint = _GuiFrame("", $aCoord[0], $aCoord[1], $aCoord[0] + 1, $aCoord[1] + 1, 3, 0xFF0000) Sleep(4000) GUIDelete($hPoint) EndIf Sleep(10) Until GUIGetMsg() = -3 ; GUI_EVENT_CLOSE ;********************************** ; #FUNCTION# -------------------------------------------------------------------------------------------------------------------- ; Name...........: _GuiFrame ; Description....: Creates a rectangle frame ; Syntax.........: _GuiFrame($sTitle, $iLeft, $iTop, $iRight, $iBottom [, $iThickness = 2 [, $iColor = 0xFF0000 [, $iTransparency = 150 [, $hWndParent = 0]]]]) ; Parameters.....: $sTitle - The title of frame. ; $iLeft - The left coordinate of frame. ; $iTop - The top coordinate of frame. ; $iRight - The right coordinate of frame. ; $iBottom - The bottom coordinate of frame. ; $iThickness - [optional] The thickness of frame (default = 1). ; $iColor - [optional] The color of frame (default = 0xFF0000). ; $iTransparency - [optional] The transparency of frame, in the range 1 - 255 (default = 150). ; $hWndParent - [optional] The parent window handle (default = 0). ; Return values..: The handle of the created frame. ; Author ........: ioa747 ; Notes .........: Note that coordinate, are the internal frame dimensions. ; Dependencies...: #include <WinAPIGdi.au3>, #include <WindowsConstants.au3> ;-------------------------------------------------------------------------------------------------------------------------------- Func _GuiFrame($sTitle, $iLeft, $iTop, $iRight, $iBottom, $iThickness = 1, $iColor = 0xFF0000, $iTransparency = 150, $hWndParent = 0) If $iThickness < 1 Or $iThickness = Default Then $iThickness = 1 If $iColor = -1 Or $iColor = Default Then $iColor = 0xFF0000 If $iTransparency < 1 Or $iTransparency = Default Or $iTransparency > 255 Then $iTransparency = 150 Local $iWidth = $iRight - $iLeft + (2 * $iThickness) + 1 Local $iHeight = $iBottom - $iTop + (2 * $iThickness) + 1 Local $hGUI = GUICreate($sTitle, $iWidth, $iHeight, $iLeft - $iThickness, $iTop - $iThickness, _ $WS_POPUP, BitOR($WS_EX_TOOLWINDOW, $WS_EX_TOPMOST, $WS_EX_NOACTIVATE), $hWndParent) GUISetBkColor($iColor, $hGUI) WinSetTrans($hGUI, "", $iTransparency) ;255 = Solid, 0 = Invisible. GUISetState(@SW_SHOWNOACTIVATE, $hGUI) Local $hOuter_rgn, $hInner_rgn, $hCombined_rgn $hOuter_rgn = _WinAPI_CreateRectRgn(0, 0, $iWidth, $iHeight) $hInner_rgn = _WinAPI_CreateRectRgn($iThickness, $iThickness, $iWidth - $iThickness, $iHeight - $iThickness) $hCombined_rgn = _WinAPI_CreateRectRgn(0, 0, 0, 0) _WinAPI_CombineRgn($hCombined_rgn, $hOuter_rgn, $hInner_rgn, $RGN_DIFF) _WinAPI_DeleteObject($hInner_rgn) _WinAPI_SetWindowRgn($hGUI, $hCombined_rgn) Return $hGUI EndFunc ;==>_GuiFrame ;-------------------------------------------------------------------------------------------------------------------------------- Another example #include <WindowsConstants.au3> #include <WinAPIGdi.au3> #include <WinAPISys.au3> _Example1() Func _Example1() Local $iGuiFrame = _WinAPI_GetSystemMetrics($SM_CXDLGFRAME) Local $iThickness = 10 Run(@AutoItExe & ' /AutoIt3ExecuteLine "MsgBox(0, ''Hello World!'', ''Hi! Move this window around'')"') Local $hWnd = WinWaitActive('Hello World!', '', 3) Local $aPos = WinGetPos($hWnd) Local $iLeft = $aPos[0] + $iGuiFrame Local $iTop = $aPos[1] Local $iRight = $aPos[0] + $aPos[2] - $iGuiFrame Local $iBottom = $aPos[1] + $aPos[3] - $iGuiFrame Local $hFrame = _GuiFrame("", $iLeft, $iTop, $iRight, $iBottom, $iThickness, 0xFF0000, 150, $hWnd) ConsoleWrite("$hFrame=" & $hFrame & @CRLF) Local $sStrPos While WinExists($hWnd) $aPos = WinGetPos($hWnd) If $sStrPos <> $aPos[0] & ";" & $aPos[1] Then WinMove($hFrame, '', $aPos[0] - $iThickness + $iGuiFrame, $aPos[1] - $iThickness) $sStrPos = $aPos[0] & ";" & $aPos[1] EndIf Sleep(10) WEnd EndFunc ;==>_Example1 ; #FUNCTION# -------------------------------------------------------------------------------------------------------------------- ; Name...........: _GuiFrame ; Description....: Creates a rectangle frame ; Syntax.........: _GuiFrame($sTitle, $iLeft, $iTop, $iRight, $iBottom [, $iThickness = 2 [, $iColor = 0xFF0000 [, $iTransparency = 150 [, $hWndParent = 0]]]]) ; Parameters.....: $sTitle - The title of frame. ; $iLeft - The left coordinate of frame. ; $iTop - The top coordinate of frame. ; $iRight - The right coordinate of frame. ; $iBottom - The bottom coordinate of frame. ; $iThickness - [optional] The thickness of frame (default = 1). ; $iColor - [optional] The color of frame (default = 0xFF0000). ; $iTransparency - [optional] The transparency of frame, in the range 1 - 255 (default = 150). ; $hWndParent - [optional] The parent window handle (default = 0). ; Return values..: The handle of the created frame. ; Author ........: ioa747 ; Notes .........: Note that coordinate, are the internal frame dimensions. ; Dependencies...: #include <WinAPIGdi.au3>, #include <WindowsConstants.au3> ;-------------------------------------------------------------------------------------------------------------------------------- Func _GuiFrame($sTitle, $iLeft, $iTop, $iRight, $iBottom, $iThickness = 1, $iColor = 0xFF0000, $iTransparency = 150, $hWndParent = 0) If $iThickness < 1 Or $iThickness = Default Then $iThickness = 1 If $iColor = -1 Or $iColor = Default Then $iColor = 0xFF0000 If $iTransparency < 1 Or $iTransparency = Default Or $iTransparency > 255 Then $iTransparency = 150 Local $iWidth = $iRight - $iLeft + (2 * $iThickness) + 1 Local $iHeight = $iBottom - $iTop + (2 * $iThickness) + 1 Local $hGUI = GUICreate($sTitle, $iWidth, $iHeight, $iLeft - $iThickness, $iTop - $iThickness, _ $WS_POPUP, BitOR($WS_EX_TOOLWINDOW, $WS_EX_NOACTIVATE), $hWndParent) GUISetBkColor($iColor, $hGUI) WinSetTrans($hGUI, "", $iTransparency) ;255 = Solid, 0 = Invisible. GUISetState(@SW_SHOWNOACTIVATE, $hGUI) Local $hOuter_rgn, $hInner_rgn, $hCombined_rgn $hOuter_rgn = _WinAPI_CreateRectRgn(0, 0, $iWidth, $iHeight) $hInner_rgn = _WinAPI_CreateRectRgn($iThickness, $iThickness, $iWidth - $iThickness, $iHeight - $iThickness) $hCombined_rgn = _WinAPI_CreateRectRgn(0, 0, 0, 0) _WinAPI_CombineRgn($hCombined_rgn, $hOuter_rgn, $hInner_rgn, $RGN_DIFF) _WinAPI_DeleteObject($hInner_rgn) _WinAPI_SetWindowRgn($hGUI, $hCombined_rgn) Return $hGUI EndFunc ;==>_GuiFrame ;-------------------------------------------------------------------------------------------------------------------------------- Please, every comment is appreciated! leave your comments and experiences here! Thank you very much
  2. Hello wise people of the forums – long time since I’ve asked for assistance – it’s me, the Autoit dabbling accountant who is not a programmer (my standard disclaimer). Is there somewhere in the forums that I can find a snippet that creates a moving dashstyle rectangle, similar to the one displayed when copying (“^C”) in excel? I’ve searched, but surprisingly could not find. Your help is greatly appreciated.
  3. 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
×
×
  • Create New...