Jump to content

Michel Claveau

Active Members
  • Posts

    348
  • Joined

  • Last visited

Everything posted by Michel Claveau

  1. Hi! Thanks. The problem is with forum, and BBCodes who "interprete" my exemple...
  2. Hi! Just a exemple of componant. Not finished, but usable. [autoit]#include-once #include <GuiConstantsEx.au3> #include <Array.au3> #include <WindowsConstants.au3> #include <StaticConstants.au3> Global $s_GuiFocus_LastClassName="",$s_FocusNew="" saiod1() Exit Func saiod1() Local $AccelKeys, $gui, $atmp, $hListView, $clef Local $contextmenu, $btnotes, $rpquit, $ligne, $xx, $yy Local $llFocus=1,$ccFocus=1 $gui = GUICreate("Saisie 'GRID' ", 805, 400) GUISetBkColor(0xffffaa) ;-----PopMenu------- $contextmenu = GUICtrlCreateContextMenu(-1) $pmenreg = GUICtrlCreateMenuItem('&Enregistrer', $contextmenu) $pmcompte = GUICtrlCreateMenuItem('&Compte (naviguer vers)', $contextmenu) $pmtiers = GUICtrlCreateMenuItem('&Tiers (naviguer vers)', $contextmenu) GUICtrlCreateMenuItem("", $contextmenu) $btnotes = GUICtrlCreateMenuItem('&Bloc-note(s)', $contextmenu) GUICtrlCreateMenuItem("", $contextmenu) $rpquit = GUICtrlCreateMenuItem('&Quitter (abandonner)', $contextmenu) ;-----PopMenu------- $btdown=GUICtrlCreateButton("Down",10,-100,100,40) $btup=GUICtrlCreateButton("Up",110,-100,100,40) $btins=GUICtrlCreateButton("Ins",210,-100,100,40) $btdel=GUICtrlCreateButton("Del",310,-100,100,40) $btenter=GUICtrlCreateButton("Enter",410,-100,100,40) $btesc = GUICtrlCreateButton("Echap", 510, -100, 100, 40) GUICtrlCreateLabel(" {Up} {Down} {Tab} {Shift-Tab} {Ctrl-Ins} {Ctrl-Del} {Enter} {Esc} etc. ",30,10,400,30) GUISetFont(14,400,0,"Arial Narrow") Local $nblig=10,$nbcol=6 Dim $ligt[$nblig]=[30,30,60,30,30,30,30,30,30,30] ;size lines Dim $colt[$nbcol]=[80,100,320,90,90,90] ;size col Dim $coll[$nbcol]=["Compte","Tiers","Libell gridinput2.au3
  3. Re! Only a little (and old) trick. For print a RTF file, it is possible to use this command: VISTA: "%programfiles%\Windows NT\Accessories\wordpad.exe" monFichier.rtf /p Seven: "%programfiles%\Windows NT\Accessories\wordpad.exe" monFichier.rtf /p XP (french ; others languages must replace "Accessoires") "%programfiles%\Windows NT\Accessoires\wordpad.exe" monFichier.rtf /p
  4. Hi ! Super! Really interesting. if your work need no external dependencies (other than Autoit_RichEditCtrl.dll), it is great. Thanks.
  5. Hi! Don't forget the reverse mode (for that, I had a "calculed" routine for hours numbers). For my part, it was only humor...
  6. Hi! WideBoyDixon, your script is nice. But the code is huge. It's nice and huge. It's huge. Compare to the code of my clock: http://www.autoitscript.com/forum/index.ph...st&p=460361 (see the second message, please).
  7. Hi! WideBoyDixon: - Sorry, I don't understand english (& I don't know write english) ; therefore, I don't understand yours month's names - OK, you translated month's names, but you forgot to translate hours numbers (1 ... 12) ;o) - is your clock the next Big-Ben? GEOSoft: You are right. But I like my three lines, because: - more easy to (de)/comment only one line, for testing - it was my code, then it's (normally) better (or I become senile) - but... Yes, we can (use your suggest) For all: I add the var $reverse ... : ; credits to WideBoyDixon #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <GDIPlus.au3> #Include <Date.au3> Opt("GUIOnEventMode", 1) $width = 200 $height = 200 $reverse=True $xx=-1 $yy=-1 if $CmdLine[0]>0 then $xx=$CmdLine[1] EndIf if $CmdLine[0]>1 then $yy=$CmdLine[2] EndIf If $xx<0 Then $xx=@DesktopWidth-$width+30 If $yy<0 Then $yy=0 Dim $mois[13]=[' ','Janvier','Février','Mars','Avril','Mai','Juin','Juillet','Août','Septembre','Octobre','Novembre','Décembre'] $hWnd = GUICreate("Clock", $width-30, $height-30, $xx,$yy,$WS_POPUP,$WS_EX_LAYERED);for GEOSoft satisfaction. ;$hWnd = GUICreate("Clock", $width-30, $height-30, $xx,$yy) GUISetBkColor(0xFF88FF) ;GUISetStyle($WS_POPUP,$WS_EX_LAYERED, $hWnd) _WinAPI_SetLayeredWindowAttributes($hWnd, 0xFF88FF) GUISetOnEvent($GUI_EVENT_CLOSE, "close") _GDIPlus_Startup() $graphics = _GDIPlus_GraphicsCreateFromHWND($hWnd) $bitmap = _GDIPlus_BitmapCreateFromGraphics($width, $height, $graphics) $backbuffer = _GDIPlus_ImageGetGraphicsContext($bitmap) _GDIPlus_GraphicsSetSmoothingMode($backbuffer, 4) $inc = 0 AdlibEnable("_DrawClock",200) $lgBrush = _GDIPlus_CreateLineBrushFromRect(0, 0, $width, $height, -1, -1, 0xFF7878FF, 0xFF000000, 0) $irBrush = _GDIPlus_CreateLineBrushFromRect(0, 0, $width, $height, -1, -1, 0xFF000000, 0xFF7878FF, 0) $nuBrush = _GDIPlus_BrushCreateSolid(0xFFFFFF22) $hFormat = _GDIPlus_StringFormatCreate() $hFamily = _GDIPlus_FontFamilyCreate("Arial") $nuFont = _GDIPlus_FontCreate($hFamily, 12, 1) $nuFont2 = _GDIPlus_FontCreate($hFamily, 8, 1) $hourBrush = _GDIPlus_BrushCreateSolid(0xFFFFFFFF) $minuteBrush = _GDIPlus_BrushCreateSolid(0xFFD0D0D0) $secondPen = _GDIPlus_PenCreate(0xFFFF0000, 1) $bitmap2 = _GDIPlus_BitmapCreateFromGraphics($width, $height, $graphics) $backbuffer2 = _GDIPlus_ImageGetGraphicsContext($bitmap2) _GDIPlus_GraphicsSetSmoothingMode($backbuffer2, 4) ;_GDIPlus_GraphicsClear($backbuffer2, 0xFFFFFFFF) ; _GDIPlus_GraphicsFillEllipse($backbuffer2, 25, 25, $width-30, $height-30, $lgBrush) ; _GDIPlus_GraphicsFillEllipse($backbuffer2, 35, 35, $width-30-20, $height-30-20, $irBrush) ; _GDIPlus_GraphicsFillEllipse($backbuffer2, 38, 38, $width-30-20-6, $height-30-20-6, $lgBrush) _GDIPlus_GraphicsFillEllipse($backbuffer2, 0, 0, $width-30, $height-30, $lgBrush) _GDIPlus_GraphicsFillEllipse($backbuffer2, 10, 10, $width-30-20, $height-30-20, $irBrush) _GDIPlus_GraphicsFillEllipse($backbuffer2, 13, 13, $width-30-20-6, $height-30-20-6, $lgBrush) $pi = 3.14159265358979 $degToRad = $pi / 180 $coeff=int(($width)/3)-4 For $i=1 to 12 If $reverse Then $j=360-360/12*$i-90 Else $j=360/12*$i-90 EndIf If $j>=360 Then $j-=360 $x=int(Cos($j*$degToRad)*$coeff+$coeff)+16 $y=int(Sin($j*$degToRad)*$coeff+$coeff)+16 If $i>9 Then $x-=4 _DrawMyText($i, $x,$y) Next $tmp=@MDAY &" "& $mois[int(@MON)] $xdat=12-StringLen($tmp) $xdat=$xdat*4 _DrawMyTextPetit($tmp,int($width*0.3)-16+$xdat,int($height*0.52)) GUIRegisterMsg($WM_PAINT,"MY_PAINT") GUISetState() Do _WinMove("Clock") Until Not Sleep(249) Func MY_PAINT($hWnd,$uMsg,$lParam,$wParam) _DrawClock() Return $GUI_RUNDEFMSG EndFunc Func _DrawClock() $diametre=100-15 $rayon=$diametre/2 _GDIPlus_GraphicsDrawImage($backbuffer,$bitmap2,0,0) ;Create angles If $reverse Then $secondAngle = 8.0 * ATan(1) * (60-@SEC)/60.0 $minuteAngle = 8.0 * ATan(1) * ((60-@MIN) - @SEC/60.0) / 60.0 $hourAngle = 8.0 * ATan(1) * ((12-@HOUR) - (@MIN)/60.0) / 12.0 Else $secondAngle = 8.0 * ATan(1) * @SEC / 60.0 $minuteAngle = 8.0 * ATan(1) * (@MIN + @SEC / 60.0) / 60.0 $hourAngle = 8.0 * ATan(1) * (@HOUR + @MIN / 60.0) / 12.0 EndIf ;Draw Hour Hand Local $HourArrow[5][2] = [[4, 0], _ [Int(40 * Sin($hourAngle)) + $diametre, Int(-40 * Cos($hourAngle)) + $diametre], _ [Int(-5 * Cos($hourAngle)) + $diametre, Int(-5 * Sin($hourAngle)) + $diametre], _ [Int(5 * Cos($hourAngle)) + $diametre, Int(5 * Sin($hourAngle)) + $diametre], _ [Int(40 * Sin($hourAngle)) + $diametre, Int(-40 * Cos($hourAngle)) + $diametre]] _GDIPlus_GraphicsFillPolygon($backbuffer, $HourArrow, $hourBrush) ;~ _GDIPlus_GraphicsFillEllipse($backbuffer, 115, 115, 10, 10, $hourBrush) Local $MinuteArrow[5][2] = [[4, 0], _ [Int(70 * Sin($minuteAngle)) + $diametre, Int(-70 * Cos($minuteAngle)) + $diametre], _ [Int(-5 * Cos($minuteAngle)) + $diametre, Int(-5 * Sin($minuteAngle)) + $diametre], _ [Int(5 * Cos($minuteAngle)) + $diametre, Int(5 * Sin($minuteAngle)) + $diametre], _ [Int(70 * Sin($minuteAngle)) + $diametre, Int(-70 * Cos($minuteAngle)) + $diametre]] _GDIPlus_GraphicsFillPolygon($backbuffer, $MinuteArrow, $minuteBrush) ;;;_GDIPlus_GraphicsFillEllipse($backbuffer, 115, 115, 10, 10, $minuteBrush) _GDIPlus_GraphicsFillEllipse($backbuffer, $width/2-20, $width/2-20, 10, 10, $minuteBrush) _GDIPlus_GraphicsDrawLine($backbuffer, $diametre, $diametre, Int(70 * Sin($secondAngle)) + $diametre, _ Int(-70 * Cos($secondAngle)) + $diametre, $secondPen) _GDIPlus_GraphicsDrawImage($graphics, $bitmap, 0, 0) EndFunc Func _DrawMyText($text, $x, $y) $tLayout = _GDIPlus_RectFCreate($x, $y) $aInfo = _GDIPlus_GraphicsMeasureString($backbuffer2, $text, $nuFont, $tLayout, $hFormat) _GDIPlus_GraphicsDrawStringEx($backbuffer2, $text, $nuFont, $aInfo[0], $hFormat, $nuBrush) EndFunc;==>_DrawMyText Func _DrawMyTextPetit($text, $x, $y) $tLayout = _GDIPlus_RectFCreate($x, $y) $aInfo = _GDIPlus_GraphicsMeasureString($backbuffer2, $text, $nuFont2, $tLayout, $hFormat) _GDIPlus_GraphicsDrawStringEx($backbuffer2, $text, $nuFont2, $aInfo[0], $hFormat, $nuBrush) EndFunc;==>_DrawMyText Func close() _GDIPlus_GraphicsDispose($backbuffer2) _GDIPlus_BitmapDispose($bitmap2) _GDIPlus_PenDispose($secondPen) _GDIPlus_BrushDispose($minuteBrush) _GDIPlus_BrushDispose($hourBrush) _GDIPlus_FontDispose($nuFont) _GDIPlus_FontFamilyDispose($hFamily) _GDIPlus_StringFormatDispose($hFormat) _GDIPlus_BrushDispose($nuBrush) _GDIPlus_BrushDispose($irBrush) _GDIPlus_BrushDispose($lgBrush) _GDIPlus_GraphicsDispose($backbuffer) _GDIPlus_BitmapDispose($bitmap) _GDIPlus_GraphicsDispose($graphics) _GDIPlus_Shutdown() Exit EndFunc;==>close ;==== GDIPlus_CreateLineBrushFromRect === ;Description - Creates a LinearGradientBrush object from a set of boundary points and boundary colors. ; $aFactors - If non-array, default array will be used. ; Pointer to an array of real numbers that specify blend factors. Each number in the array ; specifies a percentage of the ending color and should be in the range from 0.0 through 1.0. ;$aPositions - If non-array, default array will be used. ; Pointer to an array of real numbers that specify blend factors' positions. Each number in the array ; indicates a percentage of the distance between the starting boundary and the ending boundary ; and is in the range from 0.0 through 1.0, where 0.0 indicates the starting boundary of the ; gradient and 1.0 indicates the ending boundary. There must be at least two positions ; specified: the first position, which is always 0.0, and the last position, which is always ; 1.0. Otherwise, the behavior is undefined. A blend position between 0.0 and 1.0 indicates a ; line, parallel to the boundary lines, that is a certain fraction of the distance from the ; starting boundary to the ending boundary. For example, a blend position of 0.7 indicates ; the line that is 70 percent of the distance from the starting boundary to the ending boundary. ; The color is constant on lines that are parallel to the boundary lines. ; $iArgb1 - First Top color in 0xAARRGGBB format ; $iArgb2 - Second color in 0xAARRGGBB format ; $LinearGradientMode - LinearGradientModeHorizontal = 0x00000000, ; LinearGradientModeVertical = 0x00000001, ; LinearGradientModeForwardDiagonal = 0x00000002, ; LinearGradientModeBackwardDiagonal = 0x00000003 ; $WrapMode - WrapModeTile = 0, ; WrapModeTileFlipX = 1, ; WrapModeTileFlipY = 2, ; WrapModeTileFlipXY = 3, ; WrapModeClamp = 4 ; GdipCreateLineBrushFromRect(GDIPCONST GpRectF* rect, ARGB color1, ARGB color2, ; LinearGradientMode mode, GpWrapMode wrapMode, GpLineGradient **lineGradient) ; Reference: [url="http://msdn.microsoft.com/en-us/library/ms534043(VS.85).aspx"]http://msdn.microsoft.com/en-us/library/ms534043(VS.85).aspx[/url] ; Func _GDIPlus_CreateLineBrushFromRect($iX, $iY, $iWidth, $iHeight, $aFactors, $aPositions, _ $iArgb1 = 0xFF0000FF, $iArgb2 = 0xFFFF0000, $LinearGradientMode = 0x00000001, $WrapMode = 0) Local $tRect, $pRect, $aRet, $tFactors, $pFactors, $tPositions, $pPositions, $iCount If $iArgb1 = -1 Then $iArgb1 = 0xFF0000FF If $iArgb2 = -1 Then $iArgb2 = 0xFFFF0000 If $LinearGradientMode = -1 Then $LinearGradientMode = 0x00000001 If $WrapMode = -1 Then $WrapMode = 1 $tRect = DllStructCreate("float X;float Y;float Width;float Height") $pRect = DllStructGetPtr($tRect) DllStructSetData($tRect, "X", $iX) DllStructSetData($tRect, "Y", $iY) DllStructSetData($tRect, "Width", $iWidth) DllStructSetData($tRect, "Height", $iHeight) ;Note: Withn _GDIPlus_Startup(), $ghGDIPDll is defined $aRet = DllCall($ghGDIPDll, "int", "GdipCreateLineBrushFromRect", "ptr", $pRect, "int", $iArgb1, _ "int", $iArgb2, "int", $LinearGradientMode, "int", $WrapMode, "int*", 0) If IsArray($aFactors) = 0 Then Dim $aFactors[4] = [0.0, 0.4, 0.6, 1.0] If IsArray($aPositions) = 0 Then Dim $aPositions[4] = [0.0, 0.3, 0.7, 1.0] $iCount = UBound($aPositions) $tFactors = DllStructCreate("float[" & $iCount & "]") $pFactors = DllStructGetPtr($tFactors) For $iI = 0 To $iCount - 1 DllStructSetData($tFactors, 1, $aFactors[$iI], $iI + 1) Next $tPositions = DllStructCreate("float[" & $iCount & "]") $pPositions = DllStructGetPtr($tPositions) For $iI = 0 To $iCount - 1 DllStructSetData($tPositions, 1, $aPositions[$iI], $iI + 1) Next $hStatus = DllCall($ghGDIPDll, "int", "GdipSetLineBlend", "hwnd", $aRet[6], _ "ptr", $pFactors, "ptr", $pPositions, "int", $iCount) Return $aRet[6]; Handle of Line Brush EndFunc;==>_GDIPlus_CreateLineBrushFromRect Func _WinAPI_SetLayeredWindowAttributes($hwnd, $i_transcolor, $Transparency = 255, $dwFlages = 0x03, $isColorRef = False) If $dwFlages = Default Or $dwFlages = "" Or $dwFlages < 0 Then $dwFlages = 0x03 If Not $isColorRef Then $i_transcolor = Hex(String($i_transcolor), 6) $i_transcolor = Execute('0x00' & StringMid($i_transcolor, 5, 2) & StringMid($i_transcolor, 3, 2) & StringMid($i_transcolor, 1, 2)) EndIf Local $Ret = DllCall("user32.dll", "int", "SetLayeredWindowAttributes", "hwnd", $hwnd, "long", $i_transcolor, "byte", $Transparency, "long", $dwFlages) Select Case @error Return SetError(@error, 0, 0) Case $Ret[0] = 0 Return SetError(4, _WinAPI_GetLastError(), 0) Case Else Return 1 EndSelect EndFunc;==>_WinAPI_SetLayeredWindowAttributes ;=============================================================================== ; ; Description: Moves any Window by Left Mouse "Click & Drag" ; Syntax: _WinMove($hWnd) or _WinMove($s_Title) ; Parameter(s): $s_hWnd = as returned by GUICreate() ; $s_Title = title of window to be moved ; Requirement(s): None ; Return Value(s): On Success - Repositions the Window ; On Failure - Returns "" ; Author(s): Valuater, Valuater [at] aol [.com], Inspired by Martin ; ;=============================================================================== Func _WinMove($hWnd) If Not WinActive($hWnd) Then Return Local $a_R = DllCall('user32.dll', "int", "GetAsyncKeyState", "int", '0x1') If @error Or BitAND($a_R[0], 0x8000) <> 0x8000 Then Return Local $a = WinGetPos($hWnd), $b = MouseGetPos() If $b[0] < $a[0] Or $b[1] < $a[1] Or $b[0] > $a[2] + $a[0] Or $b[1] > $a[3] + $a[1] Then Return While WinActive($hWnd) Local $c = MouseGetPos() WinMove($hWnd, '', $a[0] + $c[0] - $b[0], $a[1] + $c[1] - $b[1]) $a_R = DllCall('user32.dll', "int", "GetAsyncKeyState", "int", '0x1') If @error Or BitAND($a_R[0], 0x8000) <> 0x8000 Then Return WEnd EndFunc;==>_WinMove
  8. Hi! New modified version. With the _winmove of Picea892, and others modifs from ProgAndy. Accept two parameters (X & Y) ; right align by default or by -1. And, allways, invisible background & popup mode (without border). Re. Another little thing: I modified the write of hours (1 to 12). And I added date. #NoTrayIcon #Region;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_icon=..\ponx.ico #AutoIt3Wrapper_UseUpx=n #AutoIt3Wrapper_Res_Comment=http://mclaveau.com #AutoIt3Wrapper_Res_Fileversion=0.2 #AutoIt3Wrapper_Res_LegalCopyright=Michel Claveau Informatique #AutoIt3Wrapper_Res_Language=1036 #AutoIt3Wrapper_Res_Field=CompanyName|Michel Claveau Informatique #AutoIt3Wrapper_Res_Field=ProductVersion|0.2 #EndRegion;**** Directives created by AutoIt3Wrapper_GUI **** ; credits to WideBoyDixon #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <GDIPlus.au3> #Include <Date.au3> Opt("GUIOnEventMode", 1) $width = 200 $height = 200 $xx=-1 $yy=-1 if $CmdLine[0]>0 then $xx=$CmdLine[1] EndIf if $CmdLine[0]>1 then $yy=$CmdLine[2] EndIf If $xx<0 Then $xx=@DesktopWidth-$width+30 If $yy<0 Then $yy=0 Dim $mois[13]=[' ','Janvier','Février','Mars','Avril','Mai','Juin','Juillet','Août','Septembre','Octobre','Novembre','Décembre'] ;Dim $mois[13]=[' ','Janvier','Février','Mars','Avril','Décembre','Juin','Juillet','Août','Septembre','Octobre','Novembre','Décembre'] $hWnd = GUICreate("Clock", $width-30, $height-30, $xx,$yy) GUISetBkColor(0xFF88FF) GUISetStyle($WS_POPUP,$WS_EX_LAYERED, $hWnd) _WinAPI_SetLayeredWindowAttributes($hWnd, 0xFF88FF) GUISetOnEvent($GUI_EVENT_CLOSE, "close") _GDIPlus_Startup() $graphics = _GDIPlus_GraphicsCreateFromHWND($hWnd) $bitmap = _GDIPlus_BitmapCreateFromGraphics($width, $height, $graphics) $backbuffer = _GDIPlus_ImageGetGraphicsContext($bitmap) _GDIPlus_GraphicsSetSmoothingMode($backbuffer, 4) $inc = 0 AdlibEnable("_DrawClock",200) $lgBrush = _GDIPlus_CreateLineBrushFromRect(0, 0, $width, $height, -1, -1, 0xFF7878FF, 0xFF000000, 0) $irBrush = _GDIPlus_CreateLineBrushFromRect(0, 0, $width, $height, -1, -1, 0xFF000000, 0xFF7878FF, 0) $nuBrush = _GDIPlus_BrushCreateSolid(0xFFFFFF22) $hFormat = _GDIPlus_StringFormatCreate() $hFamily = _GDIPlus_FontFamilyCreate("Arial") $nuFont = _GDIPlus_FontCreate($hFamily, 12, 1) $nuFont2 = _GDIPlus_FontCreate($hFamily, 8, 1) $hourBrush = _GDIPlus_BrushCreateSolid(0xFFFFFFFF) $minuteBrush = _GDIPlus_BrushCreateSolid(0xFFD0D0D0) $secondPen = _GDIPlus_PenCreate(0xFFFF0000, 1) $bitmap2 = _GDIPlus_BitmapCreateFromGraphics($width, $height, $graphics) $backbuffer2 = _GDIPlus_ImageGetGraphicsContext($bitmap2) _GDIPlus_GraphicsSetSmoothingMode($backbuffer2, 4) ;_GDIPlus_GraphicsClear($backbuffer2, 0xFFFFFFFF) ; _GDIPlus_GraphicsFillEllipse($backbuffer2, 25, 25, $width-30, $height-30, $lgBrush) ; _GDIPlus_GraphicsFillEllipse($backbuffer2, 35, 35, $width-30-20, $height-30-20, $irBrush) ; _GDIPlus_GraphicsFillEllipse($backbuffer2, 38, 38, $width-30-20-6, $height-30-20-6, $lgBrush) _GDIPlus_GraphicsFillEllipse($backbuffer2, 0, 0, $width-30, $height-30, $lgBrush) _GDIPlus_GraphicsFillEllipse($backbuffer2, 10, 10, $width-30-20, $height-30-20, $irBrush) _GDIPlus_GraphicsFillEllipse($backbuffer2, 13, 13, $width-30-20-6, $height-30-20-6, $lgBrush) $pi = 3.14159265358979 $degToRad = $pi / 180 $coeff=int(($width)/3)-4 For $i=12 to 1 step -1 $j=360/12*$i-90 If $j>=360 Then $j-=360 $x=int(Cos($j*$degToRad)*$coeff+$coeff)+16 $y=int(Sin($j*$degToRad)*$coeff+$coeff)+16 If $i>9 Then $x-=2 _DrawMyText($i, $x,$y) Next $tmp=@MDAY &" "& $mois[int(@MON)] $xdat=12-StringLen($tmp) $xdat=$xdat*4 _DrawMyTextPetit($tmp,int($width*0.3)-16+$xdat,int($height*0.52)) GUIRegisterMsg($WM_PAINT,"MY_PAINT") GUISetState() Do _WinMove("Clock") Until Not Sleep(249) Func MY_PAINT($hWnd,$uMsg,$lParam,$wParam) _DrawClock() Return $GUI_RUNDEFMSG EndFunc Func _DrawClock() $diametre=100-15 $rayon=$diametre/2 _GDIPlus_GraphicsDrawImage($backbuffer,$bitmap2,0,0) ;Create angles $secondAngle = 8.0 * ATan(1) * @SEC / 60.0 $minuteAngle = 8.0 * ATan(1) * (@MIN + @SEC / 60.0) / 60.0 $hourAngle = 8.0 * ATan(1) * (@HOUR + @MIN / 60.0) / 12.0 ;Draw Hour Hand Local $HourArrow[5][2] = [[4, 0], _ [Int(40 * Sin($hourAngle)) + $diametre, Int(-40 * Cos($hourAngle)) + $diametre], _ [Int(-5 * Cos($hourAngle)) + $diametre, Int(-5 * Sin($hourAngle)) + $diametre], _ [Int(5 * Cos($hourAngle)) + $diametre, Int(5 * Sin($hourAngle)) + $diametre], _ [Int(40 * Sin($hourAngle)) + $diametre, Int(-40 * Cos($hourAngle)) + $diametre]] _GDIPlus_GraphicsFillPolygon($backbuffer, $HourArrow, $hourBrush) ;~ _GDIPlus_GraphicsFillEllipse($backbuffer, 115, 115, 10, 10, $hourBrush) Local $MinuteArrow[5][2] = [[4, 0], _ [Int(70 * Sin($minuteAngle)) + $diametre, Int(-70 * Cos($minuteAngle)) + $diametre], _ [Int(-5 * Cos($minuteAngle)) + $diametre, Int(-5 * Sin($minuteAngle)) + $diametre], _ [Int(5 * Cos($minuteAngle)) + $diametre, Int(5 * Sin($minuteAngle)) + $diametre], _ [Int(70 * Sin($minuteAngle)) + $diametre, Int(-70 * Cos($minuteAngle)) + $diametre]] _GDIPlus_GraphicsFillPolygon($backbuffer, $MinuteArrow, $minuteBrush) ;;;_GDIPlus_GraphicsFillEllipse($backbuffer, 115, 115, 10, 10, $minuteBrush) _GDIPlus_GraphicsFillEllipse($backbuffer, $width/2-20, $width/2-20, 10, 10, $minuteBrush) _GDIPlus_GraphicsDrawLine($backbuffer, $diametre, $diametre, Int(70 * Sin($secondAngle)) + $diametre, _ Int(-70 * Cos($secondAngle)) + $diametre, $secondPen) _GDIPlus_GraphicsDrawImage($graphics, $bitmap, 0, 0) EndFunc Func _DrawMyText($text, $x, $y) $tLayout = _GDIPlus_RectFCreate($x, $y) $aInfo = _GDIPlus_GraphicsMeasureString($backbuffer2, $text, $nuFont, $tLayout, $hFormat) _GDIPlus_GraphicsDrawStringEx($backbuffer2, $text, $nuFont, $aInfo[0], $hFormat, $nuBrush) EndFunc;==>_DrawMyText Func _DrawMyTextPetit($text, $x, $y) $tLayout = _GDIPlus_RectFCreate($x, $y) $aInfo = _GDIPlus_GraphicsMeasureString($backbuffer2, $text, $nuFont2, $tLayout, $hFormat) _GDIPlus_GraphicsDrawStringEx($backbuffer2, $text, $nuFont2, $aInfo[0], $hFormat, $nuBrush) EndFunc;==>_DrawMyText Func close() _GDIPlus_GraphicsDispose($backbuffer2) _GDIPlus_BitmapDispose($bitmap2) _GDIPlus_PenDispose($secondPen) _GDIPlus_BrushDispose($minuteBrush) _GDIPlus_BrushDispose($hourBrush) _GDIPlus_FontDispose($nuFont) _GDIPlus_FontFamilyDispose($hFamily) _GDIPlus_StringFormatDispose($hFormat) _GDIPlus_BrushDispose($nuBrush) _GDIPlus_BrushDispose($irBrush) _GDIPlus_BrushDispose($lgBrush) _GDIPlus_GraphicsDispose($backbuffer) _GDIPlus_BitmapDispose($bitmap) _GDIPlus_GraphicsDispose($graphics) _GDIPlus_Shutdown() Exit EndFunc;==>close ;==== GDIPlus_CreateLineBrushFromRect === ;Description - Creates a LinearGradientBrush object from a set of boundary points and boundary colors. ; $aFactors - If non-array, default array will be used. ; Pointer to an array of real numbers that specify blend factors. Each number in the array ; specifies a percentage of the ending color and should be in the range from 0.0 through 1.0. ;$aPositions - If non-array, default array will be used. ; Pointer to an array of real numbers that specify blend factors' positions. Each number in the array ; indicates a percentage of the distance between the starting boundary and the ending boundary ; and is in the range from 0.0 through 1.0, where 0.0 indicates the starting boundary of the ; gradient and 1.0 indicates the ending boundary. There must be at least two positions ; specified: the first position, which is always 0.0, and the last position, which is always ; 1.0. Otherwise, the behavior is undefined. A blend position between 0.0 and 1.0 indicates a ; line, parallel to the boundary lines, that is a certain fraction of the distance from the ; starting boundary to the ending boundary. For example, a blend position of 0.7 indicates ; the line that is 70 percent of the distance from the starting boundary to the ending boundary. ; The color is constant on lines that are parallel to the boundary lines. ; $iArgb1 - First Top color in 0xAARRGGBB format ; $iArgb2 - Second color in 0xAARRGGBB format ; $LinearGradientMode - LinearGradientModeHorizontal = 0x00000000, ; LinearGradientModeVertical = 0x00000001, ; LinearGradientModeForwardDiagonal = 0x00000002, ; LinearGradientModeBackwardDiagonal = 0x00000003 ; $WrapMode - WrapModeTile = 0, ; WrapModeTileFlipX = 1, ; WrapModeTileFlipY = 2, ; WrapModeTileFlipXY = 3, ; WrapModeClamp = 4 ; GdipCreateLineBrushFromRect(GDIPCONST GpRectF* rect, ARGB color1, ARGB color2, ; LinearGradientMode mode, GpWrapMode wrapMode, GpLineGradient **lineGradient) ; Reference: [url="http://msdn.microsoft.com/en-us/library/ms534043(VS.85).aspx"]http://msdn.microsoft.com/en-us/library/ms534043(VS.85).aspx[/url] ; Func _GDIPlus_CreateLineBrushFromRect($iX, $iY, $iWidth, $iHeight, $aFactors, $aPositions, _ $iArgb1 = 0xFF0000FF, $iArgb2 = 0xFFFF0000, $LinearGradientMode = 0x00000001, $WrapMode = 0) Local $tRect, $pRect, $aRet, $tFactors, $pFactors, $tPositions, $pPositions, $iCount If $iArgb1 = -1 Then $iArgb1 = 0xFF0000FF If $iArgb2 = -1 Then $iArgb2 = 0xFFFF0000 If $LinearGradientMode = -1 Then $LinearGradientMode = 0x00000001 If $WrapMode = -1 Then $WrapMode = 1 $tRect = DllStructCreate("float X;float Y;float Width;float Height") $pRect = DllStructGetPtr($tRect) DllStructSetData($tRect, "X", $iX) DllStructSetData($tRect, "Y", $iY) DllStructSetData($tRect, "Width", $iWidth) DllStructSetData($tRect, "Height", $iHeight) ;Note: Withn _GDIPlus_Startup(), $ghGDIPDll is defined $aRet = DllCall($ghGDIPDll, "int", "GdipCreateLineBrushFromRect", "ptr", $pRect, "int", $iArgb1, _ "int", $iArgb2, "int", $LinearGradientMode, "int", $WrapMode, "int*", 0) If IsArray($aFactors) = 0 Then Dim $aFactors[4] = [0.0, 0.4, 0.6, 1.0] If IsArray($aPositions) = 0 Then Dim $aPositions[4] = [0.0, 0.3, 0.7, 1.0] $iCount = UBound($aPositions) $tFactors = DllStructCreate("float[" & $iCount & "]") $pFactors = DllStructGetPtr($tFactors) For $iI = 0 To $iCount - 1 DllStructSetData($tFactors, 1, $aFactors[$iI], $iI + 1) Next $tPositions = DllStructCreate("float[" & $iCount & "]") $pPositions = DllStructGetPtr($tPositions) For $iI = 0 To $iCount - 1 DllStructSetData($tPositions, 1, $aPositions[$iI], $iI + 1) Next $hStatus = DllCall($ghGDIPDll, "int", "GdipSetLineBlend", "hwnd", $aRet[6], _ "ptr", $pFactors, "ptr", $pPositions, "int", $iCount) Return $aRet[6]; Handle of Line Brush EndFunc;==>_GDIPlus_CreateLineBrushFromRect Func _WinAPI_SetLayeredWindowAttributes($hwnd, $i_transcolor, $Transparency = 255, $dwFlages = 0x03, $isColorRef = False) If $dwFlages = Default Or $dwFlages = "" Or $dwFlages < 0 Then $dwFlages = 0x03 If Not $isColorRef Then $i_transcolor = Hex(String($i_transcolor), 6) $i_transcolor = Execute('0x00' & StringMid($i_transcolor, 5, 2) & StringMid($i_transcolor, 3, 2) & StringMid($i_transcolor, 1, 2)) EndIf Local $Ret = DllCall("user32.dll", "int", "SetLayeredWindowAttributes", "hwnd", $hwnd, "long", $i_transcolor, "byte", $Transparency, "long", $dwFlages) Select Case @error Return SetError(@error, 0, 0) Case $Ret[0] = 0 Return SetError(4, _WinAPI_GetLastError(), 0) Case Else Return 1 EndSelect EndFunc;==>_WinAPI_SetLayeredWindowAttributes ;=============================================================================== ; ; Description: Moves any Window by Left Mouse "Click & Drag" ; Syntax: _WinMove($hWnd) or _WinMove($s_Title) ; Parameter(s): $s_hWnd = as returned by GUICreate() ; $s_Title = title of window to be moved ; Requirement(s): None ; Return Value(s): On Success - Repositions the Window ; On Failure - Returns "" ; Author(s): Valuater, Valuater [at] aol [.com], Inspired by Martin ; ;=============================================================================== Func _WinMove($hWnd) If Not WinActive($hWnd) Then Return Local $a_R = DllCall('user32.dll', "int", "GetAsyncKeyState", "int", '0x1') If @error Or BitAND($a_R[0], 0x8000) <> 0x8000 Then Return Local $a = WinGetPos($hWnd), $b = MouseGetPos() If $b[0] < $a[0] Or $b[1] < $a[1] Or $b[0] > $a[2] + $a[0] Or $b[1] > $a[3] + $a[1] Then Return While WinActive($hWnd) Local $c = MouseGetPos() WinMove($hWnd, '', $a[0] + $c[0] - $b[0], $a[1] + $c[1] - $b[1]) $a_R = DllCall('user32.dll', "int", "GetAsyncKeyState", "int", '0x1') If @error Or BitAND($a_R[0], 0x8000) <> 0x8000 Then Return WEnd EndFunc;==>_WinMove
  9. Hi! Very nice, WideBoyDixon ! I modified (just a little), for transparency (like a widget/gadget): #NoTrayIcon #include <GUIConstantsEx.au3> #include <GDIPlus.au3> #include <WindowsConstants.au3> Opt("GUIOnEventMode", 1) $width = 230 $height = 230 GUISetBkColor(0x888822) $hWnd = GUICreate("Clock", $width, $height, 1, 1) GUISetBkColor(0xFF2222) GUISetStyle($WS_POPUP,$WS_EX_LAYERED, $hWnd) _WinAPI_SetLayeredWindowAttributes($hWnd, 0xFF2222) GUISetOnEvent($GUI_EVENT_CLOSE, "close") GUISetState() _GDIPlus_Startup() $graphics = _GDIPlus_GraphicsCreateFromHWND($hWnd) $bitmap = _GDIPlus_BitmapCreateFromGraphics($width, $height, $graphics) $backbuffer = _GDIPlus_ImageGetGraphicsContext($bitmap) _GDIPlus_GraphicsSetSmoothingMode($backbuffer, 4) $inc = 0 $lgBrush = _GDIPlus_CreateLineBrushFromRect(0, 0, $width, $width, -1, -1, 0xFF7878FF, 0xFF000000, 0) $irBrush = _GDIPlus_CreateLineBrushFromRect(0, 0, $width, $width, -1, -1, 0xFF000000, 0xFF7878FF, 0) $nuBrush = _GDIPlus_BrushCreateSolid(0xFFFFFF00) $hFormat = _GDIPlus_StringFormatCreate() $hFamily = _GDIPlus_FontFamilyCreate("Arial") $nuFont = _GDIPlus_FontCreate($hFamily, 12, 1) $hourBrush = _GDIPlus_BrushCreateSolid(0xFFFFFFEE) $minuteBrush = _GDIPlus_BrushCreateSolid(0xFFD0D0D0) $secondPen = _GDIPlus_PenCreate(0xFFFF0000, 1) Do ;_GDIPlus_GraphicsClear($backbuffer, 0xFFFFFFF0) _GDIPlus_GraphicsFillEllipse($backbuffer, 20, 20, $width-30, $height-30, $lgBrush) _GDIPlus_GraphicsFillEllipse($backbuffer, 30, 30, $width-30-20, $height-30-20, $irBrush) _GDIPlus_GraphicsFillEllipse($backbuffer, 33, 33, $width-30-20-6, $height-30-20-6, $lgBrush) _DrawMyText("12", 109, 40) _DrawMyText("11", 75, 50) _DrawMyText("10", 47, 75) _DrawMyText("9", 43, 110) _DrawMyText("8", 52, 145) _DrawMyText("7", 75, 170) _DrawMyText("6", 113, 180) _DrawMyText("5", 150, 170) _DrawMyText("4", 173, 145) _DrawMyText("3", 182, 110) _DrawMyText("2", 173, 75) _DrawMyText("1", 150, 50) ;Create angles $secondAngle = 8.0 * ATan(1) * @SEC / 60.0 $minuteAngle = 8.0 * ATan(1) * (@MIN + @SEC / 60.0) / 60.0 $hourAngle = 8.0 * ATan(1) * (@HOUR + @MIN / 60.0) / 12.0 ;Draw Hour Hand Local $HourArrow[5][2] = [[4, 0], _ [Int(40 * Sin($hourAngle)) + 120, Int(-40 * Cos($hourAngle)) + 120], _ [Int(-5 * Cos($hourAngle)) + 120, Int(-5 * Sin($hourAngle)) + 120], _ [Int(5 * Cos($hourAngle)) + 120, Int(5 * Sin($hourAngle)) + 120], _ [Int(40 * Sin($hourAngle)) + 120, Int(-40 * Cos($hourAngle)) + 120]] _GDIPlus_GraphicsFillPolygon($backbuffer, $HourArrow, $hourBrush) _GDIPlus_GraphicsFillEllipse($backbuffer, 115, 115, 10, 10, $hourBrush) Local $MinuteArrow[5][2] = [[4, 0], _ [Int(70 * Sin($minuteAngle)) + 120, Int(-70 * Cos($minuteAngle)) + 120], _ [Int(-5 * Cos($minuteAngle)) + 120, Int(-5 * Sin($minuteAngle)) + 120], _ [Int(5 * Cos($minuteAngle)) + 120, Int(5 * Sin($minuteAngle)) + 120], _ [Int(70 * Sin($minuteAngle)) + 120, Int(-70 * Cos($minuteAngle)) + 120]] _GDIPlus_GraphicsFillPolygon($backbuffer, $MinuteArrow, $minuteBrush) _GDIPlus_GraphicsFillEllipse($backbuffer, 115, 115, 10, 10, $minuteBrush) _GDIPlus_GraphicsDrawLine($backbuffer, 120, 120, Int(70 * Sin($secondAngle)) + 120, _ Int(-70 * Cos($secondAngle)) + 120, $secondPen) _GDIPlus_GraphicsDrawImageRect($graphics, $bitmap, 0, 0, $width, $height) Until Not Sleep(20) Exit Func _DrawMyText($text, $x, $y) $tLayout = _GDIPlus_RectFCreate($x, $y) $aInfo = _GDIPlus_GraphicsMeasureString($backbuffer, $text, $nuFont, $tLayout, $hFormat) _GDIPlus_GraphicsDrawStringEx($backbuffer, $text, $nuFont, $aInfo[0], $hFormat, $nuBrush) EndFunc;==>_DrawMyText Func close() _GDIPlus_PenDispose($secondPen) _GDIPlus_BrushDispose($minuteBrush) _GDIPlus_BrushDispose($hourBrush) _GDIPlus_FontDispose($nuFont) _GDIPlus_FontFamilyDispose($hFamily) _GDIPlus_StringFormatDispose($hFormat) _GDIPlus_BrushDispose($nuBrush) _GDIPlus_BrushDispose($irBrush) _GDIPlus_BrushDispose($lgBrush) _GDIPlus_GraphicsDispose($backbuffer) _GDIPlus_BitmapDispose($bitmap) _GDIPlus_GraphicsDispose($graphics) _GDIPlus_Shutdown() Exit EndFunc;==>close ;==== GDIPlus_CreateLineBrushFromRect === ;Description - Creates a LinearGradientBrush object from a set of boundary points and boundary colors. ; $aFactors - If non-array, default array will be used. ; Pointer to an array of real numbers that specify blend factors. Each number in the array ; specifies a percentage of the ending color and should be in the range from 0.0 through 1.0. ;$aPositions - If non-array, default array will be used. ; Pointer to an array of real numbers that specify blend factors' positions. Each number in the array ; indicates a percentage of the distance between the starting boundary and the ending boundary ; and is in the range from 0.0 through 1.0, where 0.0 indicates the starting boundary of the ; gradient and 1.0 indicates the ending boundary. There must be at least two positions ; specified: the first position, which is always 0.0, and the last position, which is always ; 1.0. Otherwise, the behavior is undefined. A blend position between 0.0 and 1.0 indicates a ; line, parallel to the boundary lines, that is a certain fraction of the distance from the ; starting boundary to the ending boundary. For example, a blend position of 0.7 indicates ; the line that is 70 percent of the distance from the starting boundary to the ending boundary. ; The color is constant on lines that are parallel to the boundary lines. ; $iArgb1 - First Top color in 0xAARRGGBB format ; $iArgb2 - Second color in 0xAARRGGBB format ; $LinearGradientMode - LinearGradientModeHorizontal = 0x00000000, ; LinearGradientModeVertical = 0x00000001, ; LinearGradientModeForwardDiagonal = 0x00000002, ; LinearGradientModeBackwardDiagonal = 0x00000003 ; $WrapMode - WrapModeTile = 0, ; WrapModeTileFlipX = 1, ; WrapModeTileFlipY = 2, ; WrapModeTileFlipXY = 3, ; WrapModeClamp = 4 ; GdipCreateLineBrushFromRect(GDIPCONST GpRectF* rect, ARGB color1, ARGB color2, ; LinearGradientMode mode, GpWrapMode wrapMode, GpLineGradient **lineGradient) ; Reference: [url="http://msdn.microsoft.com/en-us/library/ms534043(VS.85).aspx"]http://msdn.microsoft.com/en-us/library/ms534043(VS.85).aspx[/url] ; Func _GDIPlus_CreateLineBrushFromRect($iX, $iY, $iWidth, $iHeight, $aFactors, $aPositions, _ $iArgb1 = 0xFF0000FF, $iArgb2 = 0xFFFF0000, $LinearGradientMode = 0x00000001, $WrapMode = 0) Local $tRect, $pRect, $aRet, $tFactors, $pFactors, $tPositions, $pPositions, $iCount If $iArgb1 = -1 Then $iArgb1 = 0xFF0000FF If $iArgb2 = -1 Then $iArgb2 = 0xFFFF0000 If $LinearGradientMode = -1 Then $LinearGradientMode = 0x00000001 If $WrapMode = -1 Then $WrapMode = 1 $tRect = DllStructCreate("float X;float Y;float Width;float Height") $pRect = DllStructGetPtr($tRect) DllStructSetData($tRect, "X", $iX) DllStructSetData($tRect, "Y", $iY) DllStructSetData($tRect, "Width", $iWidth) DllStructSetData($tRect, "Height", $iHeight) ;Note: Withn _GDIPlus_Startup(), $ghGDIPDll is defined $aRet = DllCall($ghGDIPDll, "int", "GdipCreateLineBrushFromRect", "ptr", $pRect, "int", $iArgb1, _ "int", $iArgb2, "int", $LinearGradientMode, "int", $WrapMode, "int*", 0) If IsArray($aFactors) = 0 Then Dim $aFactors[4] = [0.0, 0.4, 0.6, 1.0] If IsArray($aPositions) = 0 Then Dim $aPositions[4] = [0.0, 0.3, 0.7, 1.0] $iCount = UBound($aPositions) $tFactors = DllStructCreate("float[" & $iCount & "]") $pFactors = DllStructGetPtr($tFactors) For $iI = 0 To $iCount - 1 DllStructSetData($tFactors, 1, $aFactors[$iI], $iI + 1) Next $tPositions = DllStructCreate("float[" & $iCount & "]") $pPositions = DllStructGetPtr($tPositions) For $iI = 0 To $iCount - 1 DllStructSetData($tPositions, 1, $aPositions[$iI], $iI + 1) Next $hStatus = DllCall($ghGDIPDll, "int", "GdipSetLineBlend", "hwnd", $aRet[6], _ "ptr", $pFactors, "ptr", $pPositions, "int", $iCount) Return $aRet[6]; Handle of Line Brush EndFunc;==>_GDIPlus_CreateLineBrushFromRect Func _WinAPI_SetLayeredWindowAttributes($hwnd, $i_transcolor, $Transparency = 255, $dwFlages = 0x03, $isColorRef = False) If $dwFlages = Default Or $dwFlages = "" Or $dwFlages < 0 Then $dwFlages = 0x03 If Not $isColorRef Then $i_transcolor = Hex(String($i_transcolor), 6) $i_transcolor = Execute('0x00' & StringMid($i_transcolor, 5, 2) & StringMid($i_transcolor, 3, 2) & StringMid($i_transcolor, 1, 2)) EndIf Local $Ret = DllCall("user32.dll", "int", "SetLayeredWindowAttributes", "hwnd", $hwnd, "long", $i_transcolor, "byte", $Transparency, "long", $dwFlages) Select Case @error Return SetError(@error, 0, 0) Case $Ret[0] = 0 Return SetError(4, _WinAPI_GetLastError(), 0) Case Else Return 1 EndSelect EndFunc;==>_WinAPI_SetLayeredWindowAttributes
  10. Hi! It is only an exemple (for POC). 3 scripts, for : - capture a region, in several files (.BMP) (warning: need big size on disk) - Optimize the result (delete dedondant .BMP ; convert the rest in .JPG) - (re)-Play the capture. The example is in french, but easy to understand. #NoTrayIcon #include-once #include <WinAPI.au3> #include <GDIPlus.au3> #Include <Array.au3> #include <GuiConstantsEx.au3> #include <GuiEdit.au3> Global Const $__SCREENCAPTURECONSTANT_SRCCOPY = 0x00CC0020 Global $giBMPFormat = $GDIP_PXF24RGB Global $lfichiers[9999] Global $icudir = IniRead(@ScriptDir & "\icu.ini", "Param", "folder", "L:\temp\") Global $icufilename = $icudir & "c" Global $icunum=0 Global $icuX = IniRead(@ScriptDir & "\icu.ini", "Param", "x",100) Global $icuY = IniRead(@ScriptDir & "\icu.ini", "Param", "y",20) Global $icuLarg = IniRead(@ScriptDir & "\icu.ini", "Param", "w",800) Global $icuHaut = IniRead(@ScriptDir & "\icu.ini", "Param", "h",500) Global $intervalle = IniRead(@ScriptDir & "\icu.ini", "Param", "intervalle",250) Global $duree = IniRead(@ScriptDir & "\icu.ini", "Param", "dureeMaxi",60) $gui=GUICreate("ICU - Paramètres",400,390) GUISetFont(10,600,-1,"Arial") $pas=30 $v=15 $v+=$pas $h=170 $l1=GUICtrlCreateLabel("Dossier (folder) de travail:",10,$v+3,155) $chdoss=GUICtrlCreateInput($icudir,$h,$v,200) $v+=$pas $l2=GUICtrlCreateLabel("Région, début X:",10,$v+3,135) $chx=GUICtrlCreateInput($icuX,$h,$v,200) $v+=$pas $l3=GUICtrlCreateLabel("Région, début Y:",10,$v+3,135) $chy=GUICtrlCreateInput($icuY,$h,$v,200) $v+=$pas $l4=GUICtrlCreateLabel("Région, Largeur:",10,$v+3,135) $chw=GUICtrlCreateInput($icuLarg,$h,$v,200) $v+=$pas $l5=GUICtrlCreateLabel("Région, Hauteur:",10,$v+3,135) $chh=GUICtrlCreateInput($icuHaut,$h,$v,200) $v+=$pas $l6=GUICtrlCreateLabel("Intervalle de capture (ms):",10,$v+3,155) $chi=GUICtrlCreateInput($intervalle,$h,$v,200) $v+=$pas $l7=GUICtrlCreateLabel("Durée Maximale (s):",10,$v+3,135) $chdm=GUICtrlCreateInput($duree,$h,$v,200) $l8=GUICtrlCreateLabel("Rappel : {Ctrl} ² pour terminer la capture",50,300,380) GUICtrlSetColor(-1,0xAA0000) GUICtrlSetFont($l1,10,400,-1,"Arial") GUICtrlSetFont($l2,10,400,-1,"Arial") GUICtrlSetFont($l3,10,400,-1,"Arial") GUICtrlSetFont($l4,10,400,-1,"Arial") GUICtrlSetFont($l5,10,400,-1,"Arial") GUICtrlSetFont($l6,10,400,-1,"Arial") GUICtrlSetFont($l7,10,400,-1,"Arial") $btok=GUICtrlCreateButton("OK",50,350,100,30) $btesc=GUICtrlCreateButton("Abandon",250,350,100,30) GUISetState() While 1 $csmsg = GUIGetMsg() If ($csmsg = $GUI_EVENT_CLOSE) Or ($csmsg = $btesc) Then ExitLoop EndIf If $csmsg = $btok Then $icudir=GUICtrlRead($chdoss) $icuX=GUICtrlRead($chx) $icuY=GUICtrlRead($chy) $icuLarg=GUICtrlRead($chw) $icuHaut=GUICtrlRead($chh) $intervalle=GUICtrlRead($chi) $duree=GUICtrlRead($chdm) ExitLoop EndIf WEnd GUIDelete($gui) If ($csmsg = $GUI_EVENT_CLOSE) Or ($csmsg = $btesc) Then Exit EndIf $duree=$duree*1000 If Not FileExists($icudir) Then DirCreate($icudir) EndIf ecrit_ini() Func ecrit_ini() IniWrite(@ScriptDir & "\icu.ini", "Param", "folder", $icudir) IniWrite(@ScriptDir & "\icu.ini", "Param", "x", $icuX) IniWrite(@ScriptDir & "\icu.ini", "Param", "y", $icuY) IniWrite(@ScriptDir & "\icu.ini", "Param", "w", $icuLarg) IniWrite(@ScriptDir & "\icu.ini", "Param", "h", $icuHaut) IniWrite(@ScriptDir & "\icu.ini", "Param", "intervalle", $intervalle) If $duree>60000 Then $duree=60000 EndIf IniWrite(@ScriptDir & "\icu.ini", "Param", "dureeMaxi", ($duree/1000)) EndFunc ;==>ecrit_ini Global $icudesktop,$icuDDC,$icuCDC,$icuBMP,$icuCLSID,$icuhImage,$icupGUID, $icutGUID,$icubufferimage,$icubufferimage2 Global $BitmapData0,$BitmapData1,$icuScan0,$icuScan1,$icusize0,$ptr0,$ptr1 Global $postbat $postbat="CD /D"& $icudir & @CRLF HotKeySet("^²","fin") fastcaptprepar() $init=TimerInit() $debut=TimerInit() $temps=$intervalle While 1 If TimerDiff($debut)>=$temps Then fastcapt() $temps += $intervalle Else sleep(10) EndIf If TimerDiff($init)>$duree Then ExitLoop WEnd $fin=TimerDiff($debut) fastcaptclose() _GDIPlus_Shutdown() MsgBox(0,"Nb fichiers",$icunum,2) $f=FileOpen($icudir &"nbfichiers.txt",2) FileWrite($f,String($icunum)) FileClose($f) Exit Func fin() $duree=1 HotKeySet("^²") EndFunc Func fastcaptprepar() $icudesktop = _WinAPI_GetDesktopWindow() $icuDDC = _WinAPI_GetDC($icudesktop) $icuCDC = _WinAPI_CreateCompatibleDC($icuDDC) $icuBMP = _WinAPI_CreateCompatibleBitmap($icuDDC, $icuLarg, $icuHaut) _GDIPlus_Startup() $icuCLSID = _GDIPlus_EncodersGetCLSID("BMP") $icutGUID = _WinAPI_GUIDFromString($icuCLSID) $icupGUID = DllStructGetPtr($icutGUID) $icubufferimage="" EndFunc Func fastcaptclose() _GDIPlus_BitmapUnlockBits($icubufferimage, $BitmapData0) _GDIPlus_ImageDispose($icuhImage) _WinAPI_DeleteObject($icuBMP) _WinAPI_ReleaseDC($icudesktop, $icuDDC) _WinAPI_DeleteDC($icuCDC) _WinAPI_DeleteObject($icuBMP) _GDIPlus_Shutdown() sleep(250) $postbat &= "exit" & @CRLF $f=FileOpen($icudir & "deldoublon.bat",2) FileWrite($f,$postbat) FileClose($f) EndFunc Func fastcapt() _WinAPI_SelectObject($icuCDC, $icuBMP) _WinAPI_BitBlt($icuCDC, 0, 0, $icuLarg, $icuHaut, $icuDDC, $icuX, $icuY, $__SCREENCAPTURECONSTANT_SRCCOPY) #cs $aCursor = _WinAPI_GetCursorInfo() If $aCursor[1] Then $hIcon = _WinAPI_CopyIcon($aCursor[2]) $aIcon = _WinAPI_GetIconInfo($hIcon) EndIf #ce $icunum+=1 $lfichiers[$icunum]=$icufilename & (10000+$icunum) &'.bmp' $aResult = DllCall($ghGDIPDll, "int", "GdipCreateBitmapFromHBITMAP", "hwnd", $icuBMP, "hwnd", 0, "int*", 0) $icuhImage = $aResult[3] DllCall($ghGDIPDll, "int", "GdipSaveImageToFile", "hwnd", $icuhImage, "wstr", $lfichiers[$icunum], "ptr", $icupGUID, "ptr", 0) EndFunc #NoTrayIcon #include-once #include <WinAPI.au3> #include <GDIPlus.au3> #Include <Array.au3> Global $icufilename Global Const $__SCREENCAPTURECONSTANT_SRCCOPY = 0x00CC0020 Global $giBMPFormat = $GDIP_PXF24RGB Global $lfichiers[9999] Global $icudir = IniRead(@ScriptDir & "\icu.ini", "Param", "folder", "L:\temp\") Global $icufilename = $icudir & "c" Global $icunum=0 Global $icuX = IniRead(@ScriptDir & "\icu.ini", "Param", "x",100) Global $icuY = IniRead(@ScriptDir & "\icu.ini", "Param", "y",20) Global $icuLarg = IniRead(@ScriptDir & "\icu.ini", "Param", "w",800) Global $icuHaut = IniRead(@ScriptDir & "\icu.ini", "Param", "h",500) Global $intervalle = IniRead(@ScriptDir & "\icu.ini", "Param", "intervalle",100) Global $duree = IniRead(@ScriptDir & "\icu.ini", "Param", "dureeMaxi",60) Global $icudesktop,$icuDDC,$icuCDC,$icuBMP,$icuCLSID,$icuhImage,$icupGUID, $icutGUID,$icubufferimage,$icubufferimage2 Global $BitmapData0,$BitmapData1,$icuScan0,$icuScan1,$icusize0,$ptr0,$ptr1 Global $postbat $postbat="CD /D"& $icudir & @CRLF $f=FileOpen($icudir &"nbfichiers.txt",0) $icunum=FileRead($f) FileClose($f) SplashTextOn("Optimisation","En cours; veuillez patienter...",260,80) ;----------Partie optimisation 1--------------------------------- _GDIPlus_Startup() $ibuffer = _GDIPlus_ImageLoadFromFile($icufilename & '10001.bmp') $numbuffer=1 sleep(12) $ibuffer2 = _GDIPlus_ImageLoadFromFile($icufilename & '10002.bmp') $numbuffer2=2 sleep(12) $batch="CD /D "& $icudir & @CRLF For $i=3 To $icunum $fichier = $icufilename & (10000+$i) &'.bmp' $image = _GDIPlus_ImageLoadFromFile($fichier) sleep(12) $tmp=CompareBitmaps($image, $ibuffer) If $tmp Then $batch &= "del /Q "& $fichier & @CRLF $lfichiers[$i]="-1" Else $tmp=CompareBitmaps($image, $ibuffer2) If $tmp Then $batch &= "del /Q "& $fichier & @CRLF $lfichiers[$i]="-2" Else $jpgimage = _GDIPlus_ImageLoadFromFile($fichier) $gdiCLSID = _GDIPlus_EncodersGetCLSID("JPG") _GDIPlus_ImageSaveToFile($jpgimage, $icufilename & (10000+$i) &'.jpg') Sleep(12) _GDIPlus_ImageDispose($jpgimage) If $numbuffer<$numbuffer2 Then $ibuffer = _GDIPlus_ImageLoadFromFile($fichier) $numbuffer=$i $lfichiers[$i]=1 Else $ibuffer2 = _GDIPlus_ImageLoadFromFile($fichier) $numbuffer2=$i $lfichiers[$i]=2 EndIf EndIf EndIf Next _GDIPlus_ImageDispose($image) _GDIPlus_ImageDispose($ibuffer) _GDIPlus_ImageDispose($ibuffer2) _GDIPlus_Shutdown() $lfichiers[1]=1 $lfichiers[2]=2 $f=FileOpen($icudir & "deldoublon.bat",2) FileWrite($f,"CD /D "& $icudir & @CRLF &"tasklist"& @CRLF &"del /Q *.bmp"& @CRLF) FileClose($f) sleep(250) Run($icudir &"deldoublon.bat") sleep(250) $f=FileOpen($icudir &"listefichiers.txt",2) FileWrite($f,_ArrayToString($lfichiers,'|')) FileClose($f) SplashOff() Sleep(250) Run("cmd /c" & $icudir &"deldoublon.bat",$icudir) Exit Func CompareBitmaps($bm1, $bm2) $Bm1W = _GDIPlus_ImageGetWidth($bm1) $Bm1H = _GDIPlus_ImageGetHeight($bm1) $BitmapData1 = _GDIPlus_BitmapLockBits($bm1, 0, 0, $Bm1W, $Bm1H, $GDIP_ILMREAD, $GDIP_PXF32RGB) $Stride = DllStructGetData($BitmapData1, "Stride") $Scan0 = DllStructGetData($BitmapData1, "Scan0") $ptr1 = $Scan0 $size1 = ($Bm1H - 1) * $Stride + ($Bm1W - 1) * 4 $Bm2W = _GDIPlus_ImageGetWidth($bm2) $Bm2H = _GDIPlus_ImageGetHeight($bm2) $BitmapData2 = _GDIPlus_BitmapLockBits($bm2, 0, 0, $Bm2W, $Bm2H, $GDIP_ILMREAD, $GDIP_PXF32RGB) $Stride = DllStructGetData($BitmapData2, "Stride") $Scan0 = DllStructGetData($BitmapData2, "Scan0") $ptr2 = $Scan0 $size2 = ($Bm2H - 1) * $Stride + ($Bm2W - 1) * 4 $smallest = $size1 If $size2 < $smallest Then $smallest = $size2 $call = DllCall("msvcrt.dll", "int:cdecl", "memcmp", "ptr", $ptr1, "ptr", $ptr2, "int", $smallest) _GDIPlus_BitmapUnlockBits($bm1, $BitmapData1) _GDIPlus_BitmapUnlockBits($bm2, $BitmapData2) Return ($call[0]=0) EndFunc #include-once #include <WinAPI.au3> #include <GDIPlus.au3> #Include <Array.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Global $lfichiers[9999] Global $icudir = IniRead(@ScriptDir & "\icu.ini", "Param", "folder", "L:\temp\") Global $icufilename = $icudir & "c" Global $icunum=0 Global $icuX = IniRead(@ScriptDir & "\icu.ini", "Param", "x",100) Global $icuY = IniRead(@ScriptDir & "\icu.ini", "Param", "y",20) Global $icuLarg = IniRead(@ScriptDir & "\icu.ini", "Param", "w",800) Global $icuHaut = IniRead(@ScriptDir & "\icu.ini", "Param", "h",500) Global $intervalle = IniRead(@ScriptDir & "\icu.ini", "Param", "intervalle",100) Global $duree = IniRead(@ScriptDir & "\icu.ini", "Param", "dureeMaxi",60) $duree=$duree*1000 $f=FileOpen($icudir &"listefichiers.txt",0) $tmp=FileRead($f) $lfichiers=StringSplit($tmp,'|') FileClose($f) _ArrayDelete($lfichiers,1) $f=FileOpen($icudir &"nbfichiers.txt",0) $icunum=FileRead($f) FileClose($f) $gui=GUICreate("ICU-Player {Echap} ou {Esc} pour abandonner. ",$icuLarg,$icuHaut,-1,-1,-1) $fichier = $icufilename & (10000+1) &'.jpg' $image=GUICtrlCreatePic($fichier,0,0,$icuLarg,$icuHaut,-1) GUISetState() HotKeySet("{ESC}","fin") _GDIPlus_StartUp() $gdiCLSID = _GDIPlus_EncodersGetCLSID("JPG") $init=TimerInit() $num=0 $debut=TimerInit() $temps=$intervalle While 1 $num+=1 If $num>$icunum Then ExitLoop $fichier = $icufilename & (10000+$num) &'.jpg' If $lfichiers[$num]=1 Then $buffer1=$fichier If $lfichiers[$num]=2 Then $buffer2=$fichier If $lfichiers[$num]=-1 Then $fichier=$buffer1 If $lfichiers[$num]=-2 Then $fichier=$buffer2 $gdimage=_GDIPlus_ImageLoadFromFile($fichier) $gdih = _GDIPlus_GraphicsCreateFromHWND($gui) _WinAPI_RedrawWindow($image, 0, 0, $RDW_UPDATENOW) _GDIPlus_GraphicsDrawImage($gdih, $gdimage, 0, 0) _WinAPI_RedrawWindow($image, 0, 0, $RDW_VALIDATE) _GDIPlus_ImageDispose($gdimage) If TimerDiff($debut)<$temps Then Sleep($temps-TimerDiff($debut)) EndIf $temps += $intervalle WEnd _GDIPlus_ShutDown () MsgBox(0,"Terminé"," Durée : "& Int(TimerDiff($init)/100)/10 &" s") Exit Func fin() HotKeySet("{ESC}") $icunum=1 EndFuncicucapture.au3 icuoptimize.au3 icuplayer.au3
  11. Hi! Interesting. But... On Vista, the first {ctrl}{alt}{del} is intercepted, but no the next. And, on 25 % of my tests, I blocked my computer... @+
  12. Hi! Complement: I tested, with success, Autoit in Windows-2008-server-CORE (with GUI). It's great, because many GUI don't run in Core... (because no dotNET, no IE, no...) -- MCI
  13. Hi! Thanks, Frew!My case was little different, because my script had no "Send" (the problem was only with hotkeyset & the (manually) keyboard usage). But, the idea to test the key {CTRLDOWN} and send {CTRLUP} was a solution. Problem solved. Thx again.
  14. Hi! From time to time, after use (activate) an hotkey with {Ctrl} (example: hotkeyset("^{TAB}") ), the keyboard of the user has the key {CTRL} "locked" (persistent). Until the {CTRL} is again used. Any idea of the problem, and for a solution? Thanks in advance.
  15. Hi! It is cool & mega-Fun. But GuiCtrlSetOnHover_UDF.au3 is missing. But, OK, I found it in another message.
  16. Hi! Win-7 has a native OCR component (see Control_Panel + Program_&_features & Turn_windows_features_On_Off). But, I don't know how to use it...
  17. Hi! Warning! "about:blank" launch IE in "Internet zone". For launch IE in "local zone", you MUST navigate on a (local) file (file:///xxxx...)
  18. Hi! Thanks for your answer. Yes. But it is a poor satisfaction. It's my actual way. But it is not very fun... I hope than "Much smarter people" read & answer. I hope... @-salutations, & sorry for my bad english.
  19. Hi! Is it possible to edit "inline" a subitem of a GUICtrlListView? Thanks for answer(s)
  20. [For info] Hi! With IE-8, the property "Busy" is not reliable. If you have access, read this: https://connect.microsoft.com/IE/feedback/V...p;wa=wsignin1.0 (mini-link: http://minilien.fr/a0jrct ) @-salutations
  21. I don't know. But that work with Brother QL-550 & QL-1050.
  22. Hi! Accents, diacritics, special characters are not translated... Try: éèëêç...
  23. Hi! > direct TCP If you have a server ; and if you can script-it, you can do a script who answer your IP. Then, send your demand, like (example): TCPStartUp() $socket = TCPConnect( $ip, $port ) TCPSend($socket, "WantMyIP") $myIP=TCPRecv($socket, 512) TCPCloseSocket($socket)
  24. Hi! It is an idea of interesting alternate solution. A good idea. However, you should not forget that SMTP is slower than HTTP (or, better, direct TCP/IP). @-salutations -- Michel Claveau
  25. Hi! No. In Vista, Windows-2008 and Seven, MDAC is changed to Windows-DAC. But MDAC & Windows-DAC are similary.
×
×
  • Create New...