Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

Image review tool

GUI image review tool transparency crop

  • Please log in to reply
2 replies to this topic

#1 BlackEvil

BlackEvil

    Seeker

  • Active Members
  • 24 posts

Posted 10 February 2012 - 03:37 PM

Hi there..

I want to work on a image review tool. The basic idea of this tool is to review some GUI applications (developed in any language) and give comments to the developer with reference to the part of the GUI, I am making comment on. The final report with comments needs to be in MS Excel.

My idea is first run the application under review and get the GUI. Then using AutoIT place a transperant layer over it (could be on whole of the desktop size also) then mark a rectangle with a cross mouse icon on interested area, get the image of that area from the GUI beneath the transparent layer. After that get a text box or something where I can put down my comment about the croped area. Finally save those comments and croped images in excel file.

My questions are:

1. Is it possible to get a transparent layer over the GUI using Autoit?
2. Where to find some examples to start with?
3. How do I get the marked image from the desktop?

Thanks in advance

Edited by BlackEvil, 10 February 2012 - 03:40 PM.








#2 Melba23

Melba23

    I'm old - what's your excuse?

  • Moderators
  • 21,827 posts

Posted 10 February 2012 - 03:39 PM

BlackEvil,

Something I had in my Snippets folder: ;)
AutoIt         
#include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #Include <ScreenCapture.au3> #Include <Misc.au3> Global $iX1, $iY1, $iX2, $iY2, $aPos, $sMsg, $sBMP_Path ; Create GUI $hMain_GUI = GUICreate("Select Rectangle", 240, 50) $hRect_Button   = GUICtrlCreateButton("Mark Area",  10, 10, 80, 30) $hCancel_Button = GUICtrlCreateButton("Cancel",    150, 10, 80, 30) GUISetState() While 1     Switch GUIGetMsg()         Case $GUI_EVENT_CLOSE, $hCancel_Button             FileDelete(@ScriptDir & "Rect.bmp")             Exit         Case $hRect_Button             GUISetState(@SW_HIDE, $hMain_GUI)             Mark_Rect()             ; Capture selected area             $sBMP_Path = @ScriptDir & "Rect.bmp"             _ScreenCapture_Capture($sBMP_Path, $iX1, $iY1, $iX2, $iY2, False)             GUISetState(@SW_SHOW, $hMain_GUI)             ; Display image             $hBitmap_GUI = GUICreate("Selected Rectangle", $iX2 - $iX1 + 1, $iY2 - $iY1 + 1, 100, 100)             $hPic = GUICtrlCreatePic(@ScriptDir & "Rect.bmp", 0, 0, $iX2 - $iX1 + 1, $iY2 - $iY1 + 1)             GUISetState()     EndSwitch WEnd ; ------------- 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(0x000000)     ; Wait until mouse button pressed     While Not _IsPressed("01", $UserDLL)         Sleep(10)     WEnd     ; Get first mouse position     $aMouse_Pos = MouseGetPos()     $iX1 = $aMouse_Pos[0]     $iY1 = $aMouse_Pos[1]     ; 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)     WEnd     ; Get second mouse position     $iX2 = $aMouse_Pos[0]     $iY2 = $aMouse_Pos[1]     ; 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     GUIDelete($hRectangle_GUI)     GUIDelete($hCross_GUI)     DllClose($UserDLL) EndFunc   ;==>Mark_Rect

Feel free to use any of it if it helps. :)

M23
StringSize - Automatically size controls to fit text                                                               ExtMsgBox - A user customisable replacement for MsgBox
Toast - Small GUIs which pop out of the Systray                                                                Marquee - Scrolling tickertape GUIs
Scrollbars - Automatically sized scrollbars with a single command                                   GUIFrame - Subdivide GUIs into many adjustable frames
GUIExtender - Extend and retract multiple sections within a GUI                                      NoFocusLines - Remove the dotted focus lines from buttons, sliders, radios and checkboxes
ChooseFileFolder - Single and multiple selections from specified path tree structure      Notify - Small notifications on the edge of the display
Date_Time_Convert - Easily convert date/time formats, including the language               GUIListViewEx - Insert, delete, move, drag, sort and edit ListView items

#3 BlackEvil

BlackEvil

    Seeker

  • Active Members
  • 24 posts

Posted 10 February 2012 - 03:48 PM

Wow .. that's pretty fast! :)
Thank you M23! ;)





Also tagged with one or more of these keywords: GUI, image, review, tool, transparency, crop

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users