Jump to content

tip

Active Members
  • Posts

    99
  • Joined

  • Last visited

tip's Achievements

Wayfarer

Wayfarer (2/7)

2

Reputation

  1. Read my answer a bit more carefully please... One method works with "in" in the middle the other works with "to" in the middle. I also advice you to read help files "for in next" and "for to next" sections. Sincerely Tip
  2. Hi jiggypiggy, You can read about $CmdLine and $CmdLineRaw variables in here Sincerely Tip
  3. If you use For $i In $aLines then $i will become the nth element of $aLines array in nth loop. Which means you can either use For $element In $aLines ;grab the skill, OCW,in queue $aTemp = StringSplit($element, ",")or For $i To $aLines[0] ;grab the skill, OCW,in queue $aTemp = StringSplit($aLines[$i], ",") And also if you add [autoit] tags before and after the code you want to share it will be easier for forum members to follow. Sincerely, Tip
  4. Added to the test pack. Added to the test pack. Thanks everyone for your input. I've just added the two mentioned UDFs and updated my results. I personally think _RecFileListToArray is a very solid and sophisticated UDF and I must add that I don't think 27kb size of the UDF is a disadvantage since after upx compression it doesn't really matter much. But in my tests _FileListToArrayPlus seems to be the fastest. I know this not a real life test and applying include/exclude filters will change results but I believe, it will be very complicated to test for and track outcome of every scenerio. So I tried to keep it simple. Sincerely, Tip
  5. I didn't notice that. Thank you for pointing it out. I've fixed the test file and updated my results... Thank you both for quick replies. Is it normal that I have FileListToArrayRecursive function as the fastest with FileListToArray3 coming second and BrewManNH has those functions as the two slowest of all?
  6. Hi everyone; I don't mean to create a new thread about a subject that has been already widely(wildly) discussed but after reading many many posts I still couldn't figure out which method(function) to prefer... I gathered all the recursive FileListToArray functions I could find in the forums and made a small test package. If you could run the test script and post your results, I think we can create a modest comparison database on how these funcitons work on different Windows versions with different languages. I'm not an experienced scripter and I don't entirely understand the methods/routines used in these function. But I also know that the fastest function is not always the best solution. So I would also like to hear what you have to say about these functions too... Reasons to avoid them or why you would prefer one over the other... For example, I've read that the dos dir command is better not to be used because of its non-english character shotcommings etc... I think it would be really cool if we could find a definitive answer on this subject. My results: OS:WIN_XP Service Pack 3, OS Arch:X86, Language:0409, AutoIt: 3.3.8.1 Dos dir command returned 24296 items in 1.16 seconds. FileListToArrayRecursive returned 24304 items in 0.9 seconds. FileListToArray3 returned 24304 items in 1.52 seconds. RecFileListToArray returned 24304 items in 1.32 seconds. FileListToArrayEx returned 24304 items in 0.8 seconds. FileListToArrayPlus returned 24304 items in 0.71 seconds. FileListTreeToArray returned 24304 items in 2.83 seconds. Sincerely, Tip FileListToArray Speed Test.zip
  7. Eltorro thank you for the UDF. I have two questions about XML functions though: 1) I've noticed that _XMLCreate functions doesn't check for the nodes with same properties and creates a new ones even if that node already exists. I know it is something that ini format lacks and in some cases is much needed but in couple of cases I needed to update existing nodes and only create new ones if the same one does't exist already. I wrote some very basic functions that work like iniwrite. Ex: Func _XMLWriteChildNode($strXPath2, $strNode2, $strData2 = "", $strNameSpc2 = "") If not IsObj($objDoc) then _XMLError("No object passed to function _XMLCreateChildNode") Return SetError(1,20,-1) EndIf Local $i_tip_return, $i_tip_XPath =$strXPath2 & "/" & $strNode2 If _XMLNodeExists($i_tip_XPath) = 1 Then $i_tip_return = _XMLUpdateField ( $i_tip_XPath , $strData2) Else $i_tip_return = _XMLCreateChildNode($strXPath2, $strNode2, $strData2, $strNameSpc2) EndIf Return $i_tip_return EndFunc But than it occured to me that this is a well written udf and there may be some valid reason(s) not to use iniwrite kind of aproach with xml. Can anybody comment on this 2) I found that XML takes considerably longer write times. I wonder if there is a way to make it faster like flushing flie after a certainamount of operations etc. To write 85 nodes, XML writing functions noticeably blocks the script for couple of seconds. Thanks everyone in advance and thank you eltorro again for the udf. Regards Tip
  8. Hi to all again, For some time I've been adding new lines to my MsgBox_Tipped UDF and I believe it is now mature enough to be named as a new version. I've added some new cool stuff and kept it compatible with old syntax. I also added a couple of screenshots to the thread. I am looking forward to your feedback. Sincerely, Tip
  9. Ok, here is what I've came up with: #FUNCTION# ====================================================================================================================================================== ; Name...........: _GDIPlus_ImageColorOverlay ; Description ...: Creates overlay effect using GDI+ library. ; Syntax.........: _GDIPlus_ImageColorOverlay($i_tip_GDIBmp,$i_tip_Color,$i_tip_Alpha, $i_WinAPIBMP = False) ; Parameters ....: $i_tip_GDIBmp - Bitmap Handle. ; $i_tip_Color - Color of the effect. ; $i_tip_Alpha - Desired alpha value. This can be also considered as the "opacity" value of the effect. ; $i_WinAPIBMP - [Optinal] If false, function returns bitmap handle. (Ready to be used in GDI+ functions) ; | If true, function returns hbitmap handle.(Ready to be used in WinAPI functions) ; Return values .: Success - Returns (h)bitmap handle. ; Author ........: Tip ; ; Remarks .......: Thanks to smashly for sharing the _GDIPlus_BrushCreateSolid/_GDIPlus_GraphicsFillRect routine. ;================================================================================================================================================================== Func _GDIPlus_ImageColorOverlay($i_tip_GDIBmp,$i_tip_Color,$i_tip_Alpha, $i_WinAPIBMP = False) Local $i_tip_ARBG,$hGraphics,$hBrush If $i_tip_Alpha < 0 Then $i_tip_Alpha = 0 If $i_tip_Alpha > 255 Then $i_tip_Alpha = 255 $hGraphics = _GDIPlus_ImageGetGraphicsContext($i_tip_GDIBmp) If @error Then Return SetError(1,0,-1) $i_tip_ARBG = "0x" & Hex($i_tip_Alpha,2) & Hex($i_tip_Color,6) $hBrush = _GDIPlus_BrushCreateSolid($i_tip_ARBG) _GDIPlus_GraphicsFillRect($hGraphics, 0, 0, _GDIPlus_ImageGetWidth($i_tip_GDIBmp), _GDIPlus_ImageGetHeight($i_tip_GDIBmp), $hBrush) _GDIPlus_BrushDispose($hBrush) _GDIPlus_GraphicsDispose($hGraphics) If $i_WinAPIBMP = True Then Local $hHBITMAP = _GDIPlus_BitmapCreateHBITMAPFromBitmap($i_tip_GDIBmp) ;convert GDI+ bitmap to WinAPI bitmap _GDIPlus_BitmapDispose($i_tip_GDIBmp) Return $hHBITMAP Else Return $i_tip_GDIBmp EndIf EndFunc Regards, Tip
  10. Thank you very much UEZ. Finally I've figured out how to make blur effect more like gaussian blur. "GdipSetSmoothingMode" dllcall is what I needed. Here is the code. Func _GDIPlus_ImageBlur($hBitmap, $iStrenght = 3, $i_WinAPIBMP = False) If $iStrenght <= 1 Then $iStrenght = 1.01 $iStrenght = 1/$iStrenght Local $hGraphics = _GDIPlus_GraphicsCreateFromHWND(_WinAPI_GetDesktopWindow()) $hBitmapWidth = _GDIPlus_ImageGetWidth($hBitmap) $hBitmapHeight = _GDIPlus_ImageGetHeight($hBitmap) Local $hBmpSmall = _GDIPlus_BitmapCreateFromGraphics($hBitmapWidth, $hBitmapHeight, $hGraphics) Local $hGfxSmall = _GDIPlus_ImageGetGraphicsContext($hBmpSmall) DllCall($ghGDIPDll, "uint", "GdipSetPixelOffsetMode", "hwnd", $hGfxSmall, "int", 2) Local $hBmpBig = _GDIPlus_BitmapCreateFromGraphics($hBitmapWidth, $hBitmapHeight, $hGraphics) Local $hGfxBig = _GDIPlus_ImageGetGraphicsContext($hBmpBig) DllCall($ghGDIPDll, "uint", "GdipSetSmoothingMode", "hwnd", $hGfxBig, "int", 7) DllCall($ghGDIPDll, "uint", "GdipSetSmoothingMode", "hwnd", $hGfxSmall, "int", 7) DllCall($ghGDIPDll, "uint", "GdipSetPixelOffsetMode", "hwnd", $hGfxBig, "int", 2) DllCall($ghGDIPDll, "uint", "GdipScaleWorldTransform", "hwnd", $hGfxSmall, "float", $iStrenght, "float", $iStrenght, "int", 0) DllCall($ghGDIPDll, "uint", "GdipSetInterpolationMode", "hwnd", $hGfxSmall, "int", 7) DllCall($ghGDIPDll, "uint", "GdipScaleWorldTransform", "hwnd", $hGfxBig, "float", 1 / $iStrenght, "float", 1 / $iStrenght, "int", 0) DllCall($ghGDIPDll, "uint", "GdipSetInterpolationMode", "hwnd", $hGfxBig, "int", 7) _GDIPlus_GraphicsDrawImageRect($hGfxSmall, $hBitmap, 0, 0, $hBitmapWidth, $hBitmapHeight) _GDIPlus_GraphicsDrawImageRect($hGfxBig, $hBmpSmall, 0, 0, $hBitmapWidth, $hBitmapHeight) _GDIPlus_GraphicsDispose($hGraphics) _GDIPlus_BitmapDispose($hBmpSmall) _GDIPlus_GraphicsDispose($hGfxSmall) _GDIPlus_GraphicsDispose($hGfxBig) If $i_WinAPIBMP = True Then Local $hHBITMAP = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBmpBig) ;convert GDI+ bitmap to WinAPI hbitmap _GDIPlus_BitmapDispose($hBmpBig) Return $hHBITMAP Else Return $hBmpBig EndIf EndFunc ;==>_GDIPlus_ImageBlur Thanks again. Both UEZ and Siao... Regards, Tip
  11. Hi all, I was wondering if it is possible to create simple color effects with gdi+. In my case, I'm trying to make an image a little bit grayer to make it feel like it's been "disabled". I tinkered a bit and wrote something with pixelgetcolor and manually altering each pixels color but not suprisingly it works way too slow. Any help is appreciated. Thanks in advance. Regards Tip
  12. UEZ, thanks for the quick reply. I had used your function but the blur effect is a bit distorted in comparison to Siao's. (I get that you didn't read the whole post ) That's why I've tried to combine your code and his. Can you look at the code in the first post and help me to figure out what is wrong
  13. Hi to all, Recently I've been trying to create a routine to ScreenCapture a window, apply a blur effect to the captured image, return the blurred image bitmap handle and finally apply that bitmap to a PicCtrl using _SetBitmapToCtrl function. (I believe it is written by Zedna.) But I'm having hard time understanding how the GDI+ functions exactly work. I had found several blur effect scripts on the forum. One script has very gaussian-blur-like effect but it applies final bitmap directly to window(_WinAPI_GetDC etc.), the other one returns final bitmaps handle but the effect isn't as realistic imho. First one is written by Siao, can be found here: and the second one is written by UEZ, can be found here I've tried to integrate these two script and failed Here is the last draft: #include &lt;GDIPlus.au3&gt; #include &lt;GUIConstantsEx.au3&gt; #Include &lt;ScreenCapture.au3&gt; _Main() Func _WindowCapture_Blurred($i_HWND1) Local $sRatio = 3, $iInterMode = 7, $iPixOffsetMode = 2, $iSmoothMode = 7 Local $tip_WindowClientInfo = _WinGetClientPos_Ex($i_HWND1,True) _GDIPlus_Startup() Local $hScreenCapture = _ScreenCapture_Capture(&quot;&quot;, $tip_WindowClientInfo[0],$tip_WindowClientInfo[1],$tip_WindowClientInfo[0]+$tip_WindowClientInfo[2],$tip_WindowClientInfo[1]+$tip_WindowClientInfo[3], False) Local $hBitmapBig = _GDIPlus_BitmapCreateFromHBITMAP($hScreenCapture) Local $hBitmapSmall = _GDIPlus_BitmapCloneArea($hBitmapBig, 0, 0, $tip_WindowClientInfo[2]/$sRatio, $tip_WindowClientInfo[3]/$sRatio) Local $hGraphicSmall = _GDIPlus_ImageGetGraphicsContext($hBitmapSmall) Local $hGraphicBig = _GDIPlus_GraphicsCreateFromHWND(_WinAPI_GetDesktopWindow()) ;~ ;http://msdn2.microsoft.com/en-us/library/ms534141(VS.85).aspx ;~ ;InterpolationModeDefault = 0 ;~ ;InterpolationModeLowQuality = 1 ;~ ;InterpolationModeHighQuality = 2 ;~ ;InterpolationModeBilinear = 3 ;~ ;InterpolationModeBicubic = 4 ;~ ;InterpolationModeNearestNeighbor = 5 ;~ ;InterpolationModeHighQualityBilinear = 6 ;~ ;InterpolationModeHighQualityBicubic = 7 DllCall(&quot;gdiplus.dll&quot;, &quot;int&quot;, &quot;GdipSetInterpolationMode&quot;, &quot;hwnd&quot;, $hGraphicBig, &quot;int&quot;, $iInterMode) DllCall(&quot;gdiplus.dll&quot;, &quot;int&quot;, &quot;GdipSetInterpolationMode&quot;, &quot;hwnd&quot;, $hGraphicSmall, &quot;int&quot;, $iInterMode) ;~ ;http://msdn2.microsoft.com/en-us/library/ms534169(VS.85).aspx ;~ ;PixelOffsetModeDefault = 0 = PixelOffsetModeNone ;~ ;PixelOffsetModeHighSpeed = 1 = PixelOffsetModeNone ;~ ;PixelOffsetModeHighQuality = 2 = PixelOffsetModeHalf ;~ ;PixelOffsetModeNone = 3 ;~ ;PixelOffsetModeHalf = 4 DllCall(&quot;gdiplus.dll&quot;, &quot;int&quot;, &quot;GdipSetPixelOffsetMode&quot;, &quot;hwnd&quot;, $hGraphicBig, &quot;int&quot;, $iPixOffsetMode) DllCall(&quot;gdiplus.dll&quot;, &quot;int&quot;, &quot;GdipSetPixelOffsetMode&quot;, &quot;hwnd&quot;, $hGraphicSmall, &quot;int&quot;, $iPixOffsetMode) ;~ ;http://msdn2.microsoft.com/en-us/library/ms534173(VS.85).aspx ;~ ;SmoothingModeDefault = 0 = SmoothingModeNone ;~ ;SmoothingModeHighSpeed = 1 = SmoothingModeNone ;~ ;SmoothingModeHighQuality = 2 = SmoothingModeAntiAlias8x4 ;~ ;SmoothingModeNone ;~ ;SmoothingModeAntiAlias8x4 ;~ ;SmoothingModeAntiAlias = SmoothingModeAntiAlias8x4 ;~ ;SmoothingModeAntiAlias8x8 DllCall(&quot;gdiplus.dll&quot;, &quot;int&quot;, &quot;GdipSetSmoothingMode&quot;, &quot;hwnd&quot;, $hGraphicBig, &quot;int&quot;, $iSmoothMode) DllCall(&quot;gdiplus.dll&quot;, &quot;int&quot;, &quot;GdipSetSmoothingMode&quot;, &quot;hwnd&quot;, $hGraphicSmall, &quot;int&quot;, $iSmoothMode) _GDIPlus_GraphicsDrawImageRect($hGraphicSmall, $hBitmapBig, 0, 0, $tip_WindowClientInfo[2], $tip_WindowClientInfo[3]) _GDIPlus_GraphicsDrawImageRect($hGraphicBig, $hBitmapSmall, 0, 0, $tip_WindowClientInfo[2] / $sRatio, $tip_WindowClientInfo[3] / $sRatio) $aRet = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmapBig) _WinAPI_DeleteObject($hScreenCapture) _GDIPlus_GraphicsDispose($hGraphicSmall) _GDIPlus_GraphicsDispose($hGraphicBig) _GDIPlus_BitmapDispose($hBitmapSmall) _GDIPlus_BitmapDispose($hBitmapBig) _GDIPlus_Shutdown() Return $aRet EndFunc Func _Main() $Form1 = GUICreate(&quot;WindowCapture_Blurred Tryout&quot;, 640, 540, (@DesktopWidth-640)/2, (@DesktopHeight-560)/2) GUISetFont(10, 400, 0, &quot;Segoe UI&quot; ,$Form1,5) GUICtrlSetDefBkColor(-2,$Form1) GUISetBkColor(0x000000,$Form1) $MenuItem1 = GUICtrlCreateMenu(&quot;&amp;File&quot;) $MenuItem2 = GUICtrlCreateMenuItem(&quot;Exit&quot;, $MenuItem1) $Label1 = GUICtrlCreateLabel(&quot; Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.&quot; _ &amp; &quot; Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute&quot; _ &amp; &quot; irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat&quot; _ &amp; &quot; cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.&quot; &amp; @CRLF &amp; @CRLF &amp; &quot; Suspendisse potenti. Fusce semper consequat suscipit. Quisque porttitor est eu felis pharetra lacinia. Donec mauris massa, aliquet &quot; _ &amp; &quot;vitae consectetur quis, laoreet in dolor. Cras fermentum vestibulum nulla, eget sollicitudin elit porttitor id. Nunc sapien nulla, blandit &quot; _ &amp; &quot;pellentesque sollicitudin et, dignissim non justo. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. &quot; _ &amp; &quot;Vivamus congue ligula sed diam vehicula suscipit.&quot;, 30, 60, 580, 200) GUICtrlSetColor(-1, 0xFFFFFF) $Button1 = GUICtrlCreateButton(&quot;Try&quot;, 240, 300, 120, 25) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case -3, $MenuItem2 ; -3=$GUI_EVENT_CLOSE ExitLoop Case $Button1 $a = _WinGetClientPos_Ex($Form1,True) $GUI2 = GUICreate(&quot;&quot;,$a[2],$a[3],$a[0]+$a[2],$a[1]) $PicCtl = GUICtrlCreatePic(&quot;&quot;,0,0,$a[2],$a[3]) $BlurredSS = _WindowCapture_Blurred($Form1) GUISetState() _SetBitmapToCtrl($PicCtl,$BlurredSS) EndSwitch WEnd EndFunc Func _SetBitmapToCtrl($CtrlId, $hBitmap) Local Const $STM_SETIMAGE = 0x0172 Local Const $IMAGE_BITMAP = 0 Local Const $SS_BITMAP = 0xE Local Const $GWL_STYLE = -16 Local $hWnd = GUICtrlGetHandle($CtrlId) If $hWnd = 0 Then Return SetError(1, 0, 0) ; set SS_BITMAP style to control Local $oldStyle = DllCall(&quot;user32.dll&quot;, &quot;long&quot;, &quot;GetWindowLong&quot;, &quot;hwnd&quot;, $hWnd, &quot;int&quot;, $GWL_STYLE) If @error Then Return SetError(2, 0, 0) DllCall(&quot;user32.dll&quot;, &quot;long&quot;, &quot;SetWindowLong&quot;, &quot;hwnd&quot;, $hWnd, &quot;int&quot;, $GWL_STYLE, &quot;long&quot;, BitOR($oldStyle[0], $SS_BITMAP)) If @error Then Return SetError(3, 0, 0) Local $oldBmp = DllCall(&quot;user32.dll&quot;, &quot;hwnd&quot;, &quot;SendMessage&quot;, &quot;hwnd&quot;, $hWnd, &quot;int&quot;, $STM_SETIMAGE, &quot;int&quot;, $IMAGE_BITMAP, &quot;int&quot;, $hBitmap) If @error Then Return SetError(4, 0, 0) If $oldBmp[0] &lt;&gt; 0 Then _WinAPI_DeleteObject($oldBmp[0]) Return 1 EndFunc Func _WinGetClientPos_Ex($i_tip_Hwnd, $i_tip_ConsiderMenu = False) If Not WinExists($i_tip_Hwnd) Or Not IsHWnd($i_tip_Hwnd) Then Return SetError(1,0,-1) Local $i_tip_WinPos, $i_tip_ClientSize, $i_tip_BorderThickness, $i_tip_aRet $i_tip_WinPos = WinGetPos($i_tip_Hwnd) $i_tip_ClientSize = _WinGetClientSize_Ex($i_tip_Hwnd) $i_tip_BorderThickness = ($i_tip_WinPos[2] - $i_tip_ClientSize[0])/2 Dim $i_tip_aRet[4] = [$i_tip_WinPos[0] + $i_tip_BorderThickness, $i_tip_WinPos[1] + ($i_tip_WinPos[3] - $i_tip_ClientSize[1]) - $i_tip_BorderThickness, $i_tip_ClientSize[0], $i_tip_ClientSize[1]] If $i_tip_ConsiderMenu = True And $i_tip_ClientSize[2] &gt; 0 Then $i_tip_aRet[1] -= $i_tip_ClientSize[2] $i_tip_aRet[3] = $i_tip_ClientSize[3] EndIf Return $i_tip_aRet EndFunc ;==&gt;_WinGetClientPos_Ex Func _WinGetClientSize_Ex($i_tip_Hwnd) If Not WinExists($i_tip_Hwnd) Or Not IsHWnd($i_tip_Hwnd) Then Return SetError(1,0,-1) Local $i_tip_MenuExists, $i_tip_MenuExists, $i_tip_aRet $i_tip_MenuExists = DllCall(&quot;User32.dll&quot;, &quot;handle&quot;, &quot;GetMenu&quot;, &quot;hwnd&quot;, $i_tip_Hwnd) ; We are checking if parent gui has a menu. If @error Then $i_tip_MenuExists = 0 Else $i_tip_MenuExists = $i_tip_MenuExists[0] If $i_tip_MenuExists &gt; 0 Then $i_tip_MenuExists = 20 Else $i_tip_MenuExists = 0 EndIf EndIf $i_tip_aRet = WinGetClientSize($i_tip_Hwnd) If IsArray($i_tip_aRet) = 0 Then Return SetError(2,0,-1) Else ReDim $i_tip_aRet[4] $i_tip_aRet[2] = $i_tip_MenuExists $i_tip_aRet[3] = $i_tip_aRet[1] + $i_tip_aRet[2] Return $i_tip_aRet EndIf EndFunc ;==&gt;_WinGetClientSize_Ex If you can point me to right direction I'd be very glad. Sincerely Tip
  14. Hi, I know this is an old thread but I recently have encountered the same issue. I wanted to share what I've learned for the troublesomes of the future ... I think the "error 31" is "Inetget can't write to the specified file path" error . It can happen if destination folder doesn't exist, destination file is write protected or currently open etc. At least it was in my case Regards Tip
×
×
  • Create New...