krisddd Posted January 21, 2010 Share Posted January 21, 2010 I was wondering if anyone could help me or point me in the right direction with a project I'm trying to do. Basically all I want to do is create a graphic overlay (a grid) on the screen and someone allow the user to adjust the size of the grid. The AutoIt script will the use the position and the size of the grid to accomplish the tasks I want. The grid would have to be transparent and the script should be allowed to click through it. I did use search and I came across GhostIt which would allow me to accomplish this to some degree. I haven't tried it yet, but before I jump in head first, I wanted to see if there was possibly another approach I can take. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 21, 2010 Moderators Share Posted January 21, 2010 krisddd, Welcome to the Autoit forum. From what I can see from the thread, GhostIt does not pass clicks. So drawing a GDI grid might be a better bet as this does allow clicks to pass. Perhaps something like this: expandcollapse popup#include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> HotKeySet("{ESC}", "On_Exit") Global $hGUI, $aRadio[5], $hButton, $iStep $hGUI = GUICreate("Grid", 150, 190) GUICtrlCreateLabel("Choose a grid step value", 10, 10, 150, 20) GUIStartGroup() For $i = 0 To 4 $aRadio[$i] = GUICtrlCreateRadio(100 + ($i * 100), 55, 30 + ($i * 20), 100, 20) Next GUICtrlSetState($aRadio[0], $GUI_CHECKED) $hButton = GUICtrlCreateButton("Show Grid", 35, 150, 80, 30) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $hButton GUISetState(@SW_HIDE, $hGUI) For $i = 0 To 4 If GUICtrlRead($aRadio[$i]) = 1 Then $iStep = GUICtrlRead($aRadio[$i], 1) ExitLoop EndIf Next Grid() EndSwitch WEnd ; ------------- Func Grid() Local $iVerticals = Floor(@DesktopWidth / $iStep) Local $iHorizontals = Floor(@DesktopHeight / $iStep) Local $hRectangle_GUI = GUICreate("", @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP, $WS_EX_TOOLWINDOW + $WS_EX_TOPMOST) GUISetBkColor(0x000000) Local $hMaster_Mask = _WinAPI_CreateRectRgn(0, 0, 0, 0) For $i = 0 To $iVerticals $hMask = _WinAPI_CreateRectRgn($i * $iStep, 0, ($i * $iStep) + 1, @DesktopHeight) _WinAPI_CombineRgn($hMaster_Mask, $hMask, $hMaster_Mask, 2) _WinAPI_DeleteObject($hMask) Next For $i = 0 To $iHorizontals $hMask = _WinAPI_CreateRectRgn(0, $i * $iStep, @DesktopWidth, ($i * $iStep) + 1) _WinAPI_CombineRgn($hMaster_Mask, $hMask, $hMaster_Mask, 2) _WinAPI_DeleteObject($hMask) Next ; Set overall region _WinAPI_SetWindowRgn($hRectangle_GUI, $hMaster_Mask) GUISetState() While 1 Sleep(10) WEnd EndFunc ;==>Grid Func On_Exit() Exit EndFunc I hope that helps. M23 SamsonSlice 1 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
krisddd Posted January 22, 2010 Author Share Posted January 22, 2010 Thank you very much for your response. I will give this a try and let you know how it works out, but it does look promising. And thanks, I've been meaning to join for a while, but the time just isn't there. Link to comment Share on other sites More sharing options...
uber125 Posted April 1, 2011 Share Posted April 1, 2011 (edited) Thank you for this, it's almost exactly what I was looking for. 5stars I only have one question. What value(s) are changed to tighten up the grid, I need something just a tad smaller then 100. I know this is resurrection, but I don't see the point in making anew post if question(s) is/are still relevant. NVM I got it, thanks. BTW in case anyone is wondering the same, try adjusting the numbers in the GUICtrlCreateRadio. Edited April 1, 2011 by uber125 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now