myspacee Posted September 5, 2008 Share Posted September 5, 2008 Hello, Here some stolen code with OCR function and a trasparent selector add (& stolen) by me try to find a way to change color of floating trasparent window selector, but no luck... Anyone can teach me how menage color with trasparencies ? Thank you! m. expandcollapse popup#include <GUIConstants.au3> #include <Array.au3> #include <GuiConstantsEx.au3> #include <GDIPlus.au3> #include <ScreenCapture.au3> #include <WinAPI.au3> #include <GuiListView.au3> #Include <Constants.au3> #include <WindowsConstants.au3> #include <String.au3> #include <misc.au3> ;////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ;// declare var for selector windows ;////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// Const $DIB_RGB_COLORS = 0 Global $GUI, $CopyWin, $PixelArray, $CopyWin, $e, $d, $PixelsReady = 0, $Start = 0 Global $my_Height, $my_Width Global Const $WM_LBUTTONDOWN = 0x0201; Drag Window 1 of 3 addin Global $apos[4] dim $output, $My_text ;////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ;// set var ;////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// $my_Height = 100 $my_Width = 100 ;////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ;// run selector ;////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// _selector() ;////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ;// run OCR ;////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// $output = _OCR(@TempDir & "\temp.bmp") ;////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ;// clean for too spaces ;////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// $My_text = _ArrayToString($output, " ") $My_text = StringReplace($My_text," "," ") $My_text = StringReplace($My_text," "," ") $My_text = StringReplace($My_text," "," ") $My_text = StringReplace($My_text," "," ") msgbox(0,"",$My_text) ;////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ;// output txt File ;////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// $file = FileOpen("output.txt",1) ;~ For $i = 0 to UBound($output) ;~ If $output[$i] = "" Then ExitLoop ;~ FileWriteLine($file,$output[$i]) ;~ Next FileWriteLine($file,$My_text) FileClose($file) ;////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ;// FUNCTION ;////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ;================================= OCR ======================================= ; Function Name: ; Description: Searches a bmp file for all recognizable characters and returns them in an array ; Requires: Microsoft Word must be installed on system & <Array.au3> ; Parameters: $file bmp file to search ; ; Syntax: _OCR($file) ; Returns: $Array[1] = 0 on failure, $Array on success ; ;=============================================================================== Func _OCR($file) Dim $miDoc, $Doc, $str, $oWord, $sArray[500] $oMyError = ObjEvent("AutoIt.Error","_CoMErrFunc") $miDoc = ObjCreate("MODI.Document") $miDocView = ObjCreate("MiDocViewer.MiDocView") $miDoc.Create($file) $miDoc.Ocr(9, True, False) $MiDocView.Document = $miDoc $MiDocView.SetScale (0.75, 0.75) $i = 0 For $oWord in $miDoc.Images(0).Layout.Words $str = $str & $oWord.text & @CrLf ConsoleWrite($oWord.text & @CRLF) $sArray [$i] = $oWord.text $i += 1 Next Return $sArray EndFunc;========================== OCR ======================================== ;////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ; selector ;////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// Func _selector() Opt("GUIResizeMode", 1) Opt("WinTitleMatchMode", 2) $GUI = GUICreate("Selezione", $my_Height, $my_Width, -1, -1, BitOR($WS_POPUP, $WS_SIZEBOX, $WS_CLIPCHILDREN), $WS_EX_TOPMOST) WinSetTrans("Selezione", "", 100) GUIRegisterMsg($WM_LBUTTONDOWN, "_WinMove"); Drag Window 2 of 3 addin ;////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ;// ciclo principale della selezione flottante con resize immagine ;////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// While Not _IsPressed("1B");Esc to Exit GUISetState(@SW_SHOW, $GUI) $apos = WinGetPos("Selezione") ;////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ; press CTRL to quit selector and retur selector position ;////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// If _IsPressed("11") Then GUIDelete("Selezione") ;////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ; catturo area selezionata ;////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// _ScreenCapture_Capture(@TempDir & "\temp.bmp", $apos[0], $apos[1], $apos[0] + $apos[2], $apos[1] + $apos[3], False) Sleep(500) beep(500,1000) ExitLoop EndIf ;~ $apos = WinGetPos("Selezione") ;~ ToolTip("" & $apos[0] & " " & $apos[1] & " " & ($apos[0] + $apos[2]) & " " & ($apos[1] + $apos[3]), 0, 0) Sleep(100) WEnd EndFunc Func _WinMove($hWnd, $Command, $wParam, $lParam) If BitAND(WinGetState($hWnd), 32) Then Return $GUI_RUNDEFMSG ;DllCall("user32.dll", "long", "SendMessage", "hwnd", $HWnd, "int", $WM_SYSCOMMAND, "int", 0xF009, "int", 0) DllCall("user32.dll", "int", "SendMessage", "hWnd", $hWnd, "int", $WM_NCLBUTTONDOWN, "int", $HTCAPTION, "int", 0) Return 1 EndFunc ;==>_WinMove Link to comment Share on other sites More sharing options...
myspacee Posted September 8, 2008 Author Share Posted September 8, 2008 Sorry for bumb, anyone can help to abtain trasparent colored window? thank you, m. 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