Jump to content

Recommended Posts

Here is another one from : https://github.com/Universal-Rom-Tools/Universal-XML-Scraper/blob/master/Include/_GDIpProgress.au3

I don't know if this version is newer or modified, at least the code is longer ;).

#cs ----------------------------------------------------------------------------

    AutoIt Version: 3.2.12.0
    Author:         Prog@ndy
    after Script from nobbe ( 2008 in http://www.autoitscript.com/forum/index.php?s=&showtopic=64703&view=findpost&p=485031 )

    Script Function:  A UDF for colored Progressbars with GDIPlus

    Remarks: Theres an example from Line 22 to line 112 ( between the first #Region - #Endregion Tags

#ce ----------------------------------------------------------------------------

#include-once
#include <GuiConstants.au3>
#include <WIndowsConstants.au3>
#include <EditConstants.au3>
#include <WinApi.au3>
#include <GdiPlus.au3>

Global $_Progress_ahCallBack[3] = [-1, -1, 0], $_Progress_Bars[1][15] = [[-1]], $iPercent = 0;

#EndRegion EXAMPLE
;##################################################

;-------------------------------------------------------------------
#Region Colored Progressbar
;===============================================================================
;
; Function Name:   _ProgressCreate
; Description::    Creates a GDIplus Progressbar
; Parameter(s):    $x     : left
;                  $y     : top
;                  $w     : width
;                  $h     : height
;                  $Col     : [Optional] Top color of the foreground gradient
;                  $GradCol : [Optional] Bottom color of the foreground gradient
;                  $BG      : [Optional] Top color of the background gradient
;                  $GradBG  : [Optional] Bottom color of the background gradient
; Requirement(s):  GDIplus
; Return Value(s): Success: ID of Progressbar, Error: 0
; Author(s):       Prog@ndy
;
;===============================================================================
;
Func _ProgressCreate($x, $y, $w = 204, $h = 24, $Col = 0xFFFF00, $GradCol = 0x00FF00, $BG = 0xAAAA00, $GradBG = 0xFF0000)
    __CheckForGDIPlus()
    $ID = UBound($_Progress_Bars)
    ReDim $_Progress_Bars[$ID + 1][15]
    $_Progress_Bars[$ID][0] = GUICtrlCreateLabel("", $x, $y, $w, $h)
    GUICtrlSetStyle(-1,0)
    GUICtrlSetBkColor($_Progress_Bars[$ID][0], -2) ; $GUI_BKCOLOR_TRANSPARENT = -2
    If @error Then Return SetError(@error, @extended, 0)
    If $Col = -1 Then $Col = 0xFFFF00
    If $BG = -1 Then $BG = 0xAAAA00
    If $GradCol = -1 Then $GradCol = 0x00FF00
    If $GradBG = -1 Then $GradBG = 0xFF0000
    _GDIPlus_Startup()
    Local $graphic = _GDIPlus_GraphicsCreateFromHWND(GUICtrlGetHandle($_Progress_Bars[$ID][0]))
    Local $bitmap = _GDIPlus_BitmapCreateFromGraphics($w, $h, $graphic)
    Local $backbuffer = _GDIPlus_ImageGetGraphicsContext($bitmap)

    Local $bmpfront = _GDIPlus_BitmapCreateFromGraphics($w, $h, $graphic)
    _CreateGradientImg($bmpfront, $w - 1, $h - 1, $Col, $GradCol)
    $_Progress_Bars[$ID][11] = _GDIPlus_ImageGetWidth($bmpfront)
    $_Progress_Bars[$ID][12] = _GDIPlus_ImageGetHeight($bmpfront)

    Local $bmpBack = _GDIPlus_BitmapCreateFromGraphics($w, $h, $graphic)
    _CreateGradientImg($bmpBack, $w - 1, $h - 1, $BG, $GradBG)
    $_Progress_Bars[$ID][13] = _GDIPlus_ImageGetWidth($bmpBack)
    $_Progress_Bars[$ID][14] = _GDIPlus_ImageGetHeight($bmpBack)

    $_Progress_Bars[$ID][1] = $w
    $_Progress_Bars[$ID][2] = $h

    $_Progress_Bars[$ID][3] = $graphic
    $_Progress_Bars[$ID][4] = $bitmap
    $_Progress_Bars[$ID][5] = $backbuffer
    $_Progress_Bars[$ID][6] = $bmpfront
    $_Progress_Bars[$ID][7] = $bmpBack
    $_Progress_Bars[$ID][8] = 0
    $_Progress_Bars[$ID][9] = 1
    $_Progress_Bars[$ID][10] = "Arial|10|1|0xFF000000|0"
    _ProgressRefresh($ID, 0)
    _Progress_CallBack_Init()
    Return SetError(0, 0, $ID)
EndFunc   ;==>_ProgressCreate

;===============================================================================
;
; Function Name:   _ProgressDelete
; Description::    Deletes a GDI+ Progressbar
; Parameter(s):    $ID      : ID of Progressbar
; Requirement(s):  GDIplus
; Return Value(s): Sucess: 1, Error: 0
; Author(s):       Prog@ndy
;
;===============================================================================
;
Func _ProgressDelete(ByRef $ID)
    If Not IsArray($_Progress_Bars) Or UBound($_Progress_Bars, 2) <> 15 Or $ID > (UBound($_Progress_Bars)-1) Then Return SetError(1, 0, 0)
    If $_Progress_Bars[$ID][0] = -1 Then Return SetError(-1,0,0)
    _Progress_CallBack_Free()
    Local $temp[9],$i
    FoR $i = 0 To 8
        $temp[$i] = $_Progress_Bars[$ID][$i]
    Next
    $_Progress_Bars[$ID][0] = -1
    Local $ret = GUICtrlDelete($temp[0])
    If @error Then Return SetError(1,0,0)
    $_Progress_Bars[$ID][1] = -1
    $_Progress_Bars[$ID][2] = -1

    $_Progress_Bars[$ID][3] = -1
    _GDIPlus_GraphicsDispose($temp[3])
    Local $error = @error
    $_Progress_Bars[$ID][4] = -1
    _WinAPI_DeleteObject($temp[4])
    Local $error = @error
    $_Progress_Bars[$ID][5] = -1
    _GDIPlus_GraphicsDispose($temp[5])
    Local $error = @error
    $_Progress_Bars[$ID][6] = -1
    _WinAPI_DeleteObject($temp[6])
    Local $error = @error
    _GDIPlus_ImageDispose($temp[6])
    Local $error = @error
    $_Progress_Bars[$ID][7] = -1
    _WinAPI_DeleteObject($temp[7])
    Local $error = @error
    _GDIPlus_ImageDispose($temp[7])
    $_Progress_Bars[$ID][8] = -1


    _GDIPlus_Shutdown()
    Return SetError($error, 0, $error=0)
EndFunc   ;==>_ProgressDelete

;===============================================================================
;
; Function Name:   _ProgressSetColors(
; Description::    Sets gradients as foreground and background
; Parameter(s):    $ID      : ID of Progressbar
;                  $Col     : Top color of the foreground gradient
;                  $GradCol : Bottom color of the foreground gradient
;                  $BG      : Top color of the background gradient
;                  $GradBG  : Bottom color of the background gradient
;             If $Col or $GradCol is -1, the foreground gradient isn't changed
;             If $BG or $GradBG is -1, the background gradient isn't changed
; Requirement(s):  Winapi.au3, GDIplus
; Return Value(s): Success: 1, Error: 0
; Author(s):       Prog@ndy
;
;===============================================================================
;
Func _ProgressSetColors(ByRef $ID, $Col = -1, $GradCol = -1, $BG = -1, $GradBG = -1)
    If Not IsArray($_Progress_Bars) Or UBound($_Progress_Bars, 2) <> 15 Or $ID > (UBound($_Progress_Bars)-1) Then Return SetError(1, 0, 0)
    If Execute($Col) > -1 And Execute($GradCol) > -1 Then
        _WinAPI_DeleteObject($_Progress_Bars[$ID][6])
        _GDIPlus_ImageDispose($_Progress_Bars[$ID][6])
        $_Progress_Bars[$ID][6] = _GDIPlus_BitmapCreateFromGraphics($_Progress_Bars[$ID][1], $_Progress_Bars[$ID][2], $_Progress_Bars[$ID][3])
        _CreateGradientImg($_Progress_Bars[$ID][6], $_Progress_Bars[$ID][1] - 1, $_Progress_Bars[$ID][2] - 1, $Col, $GradCol)
        $_Progress_Bars[$ID][11] = $_Progress_Bars[$ID][1]
        $_Progress_Bars[$ID][12] = $_Progress_Bars[$ID][2]
    EndIf
    If Execute($BG) > -1 And Execute($GradBG) > -1 Then
        _WinAPI_DeleteObject($_Progress_Bars[$ID][7])
        _GDIPlus_ImageDispose($_Progress_Bars[$ID][7])
        $_Progress_Bars[$ID][7] = _GDIPlus_BitmapCreateFromGraphics($_Progress_Bars[$ID][1], $_Progress_Bars[$ID][2], $_Progress_Bars[$ID][3])
        _CreateGradientImg($_Progress_Bars[$ID][7], $_Progress_Bars[$ID][1] - 1, $_Progress_Bars[$ID][2] - 1, $BG, $GradBG)
        $_Progress_Bars[$ID][13] = $_Progress_Bars[$ID][1]
        $_Progress_Bars[$ID][14] = $_Progress_Bars[$ID][2]
    EndIf
;~  _ProgressSet($ID, $_Progress_Bars[$ID][8])
    Return SetError(@error, 0, @error = 0)
EndFunc   ;==>_ProgressSetColors


;===============================================================================
;
; Function Name:   _ProgressSetImages(
; Description::    Sets images as foreground and background by Path
; Parameter(s):    $ID : ID of Progressbar
;                  $ForeBmp : Path to image , empty String "" To leave the old
;                             The foreground image
;                  $BackBmp : [Optional] Path to image , empty String "" To leave the old
;                             The background image
; Requirement(s):  Winapi.au3, GDIplus
; Return Value(s): Success: 1, Error: 0
; Author(s):       Prog@ndy
;
;===============================================================================
;
Func _ProgressSetImages(ByRef $ID, $ForeBmp = "", $backBMP = "")
    Local $bmp = ""
    If Not IsArray($_Progress_Bars) Or UBound($_Progress_Bars, 2) <> 15 Or $ID > (UBound($_Progress_Bars)-1) Then Return SetError(1, 0, 0)
    If GUICtrlGetHandle($_Progress_Bars[$ID][0]) = 0 Then Return SetError(2, 0, 0)
    If $ForeBmp <> "" And FileExists($ForeBmp) Then
        $bmp = _GDIPlus_ImageLoadFromFile($ForeBmp)
        If Not @error Then
;~          _WinAPI_DeleteObject($_Progress_Bars[$ID][6])
            _GDIPlus_ImageDispose($_Progress_Bars[$ID][6])
            $_Progress_Bars[$ID][6] = $bmp
            $_Progress_Bars[$ID][11] = _GDIPlus_ImageGetWidth($_Progress_Bars[$ID][6])
            $_Progress_Bars[$ID][12] = _GDIPlus_ImageGetHeight($_Progress_Bars[$ID][6])
        EndIf
    EndIf
    If $backBMP <> "" And FileExists($backBMP) Then
        $bmp = _GDIPlus_ImageLoadFromFile($backBMP)
        If Not @error Then
;~          _WinAPI_DeleteObject($_Progress_Bars[$ID][7])
            _GDIPlus_ImageDispose($_Progress_Bars[$ID][7])
            $_Progress_Bars[$ID][7] = $bmp
            $_Progress_Bars[$ID][13] = _GDIPlus_ImageGetWidth($_Progress_Bars[$ID][7])
            $_Progress_Bars[$ID][14] = _GDIPlus_ImageGetHeight($_Progress_Bars[$ID][7])
        EndIf
    EndIf
;~  _ProgressSet($ID, $_Progress_Bars[$ID][8])
    Return SetError(@error, 0, @error = 0)
EndFunc   ;==>_ProgressSetImages

;===============================================================================
;
; Function Name:   _ProgressSetHBitmaps(
; Description::    Sets previously loaded GDIplus Images / bitmaps as foreground and background
; Parameter(s):    $ID : ID of Progressbar
;                  $ForeBmp : Handle to GDIplus -image or -bitmap , -1 To leave the old
;                             The foreground image
;                  $BackBmp : [Optional] Handle to GDIplus -image or -bitmap , -1 To leave the old
;                             The background image
; Requirement(s):  Winapi.au3, GDIplus
; Return Value(s): Success: 1, Error: 0
; Author(s):       Prog@ndy
;
;===============================================================================
;
Func _ProgressSetHBitmaps(ByRef $ID, $ForeBmp = -1, $backBMP = -1)
    If Not IsArray($_Progress_Bars) Or UBound($_Progress_Bars, 2) <> 15 Or $ID > (UBound($_Progress_Bars)-1) Then Return SetError(1, 0, 0)
    If GUICtrlGetHandle($_Progress_Bars[$ID][0]) = 0 Then Return SetError(2, 0, 0)
    If $ForeBmp > -1 And _GDIPlus_ImageGetHeight($ForeBmp) Then
;~      _WinAPI_DeleteObject($_Progress_Bars[$ID][6])
        _GDIPlus_ImageDispose($_Progress_Bars[$ID][6])
        $_Progress_Bars[$ID][6] = $ForeBmp
        $_Progress_Bars[$ID][11] = _GDIPlus_ImageGetWidth($_Progress_Bars[$ID][6])
        $_Progress_Bars[$ID][12] = _GDIPlus_ImageGetHeight($_Progress_Bars[$ID][6])
    EndIf
    If $backBMP > -1 And _GDIPlus_ImageGetHeight($backBMP) Then
;~      _WinAPI_DeleteObject($_Progress_Bars[$ID][7])
        _GDIPlus_ImageDispose($_Progress_Bars[$ID][7])
        $_Progress_Bars[$ID][7] = $backBMP
        $_Progress_Bars[$ID][13] = _GDIPlus_ImageGetWidth($_Progress_Bars[$ID][7])
        $_Progress_Bars[$ID][14] = _GDIPlus_ImageGetHeight($_Progress_Bars[$ID][7])
    EndIf
;~  _ProgressSet($ID, $_Progress_Bars[$ID][8])
    Return SetError(@error, 0, @error = 0)
EndFunc   ;==>_ProgressSetHBitmaps

;===============================================================================
;
; Function Name:   _ProgressSetText(
; Description::    Sets the text to be shown
; Parameter(s):    $ID : ID of Progressbar
;                  $text:  -> TRUE : Show percent
;                          -> A string to be shown, %P% is replaced with Percentage
; Requirement(s):  This UDf
; Return Value(s): Success: 1, Error: 0
; Author(s):       Prog@ndy
;
;===============================================================================
;
Func _ProgressSetText(ByRef $ID, $text = True)
    If Not IsArray($_Progress_Bars) Or UBound($_Progress_Bars, 2) <> 15 Or $ID > (UBound($_Progress_Bars)-1) Then Return SetError(1, 0, 0)
    $_Progress_Bars[$ID][9] = $text
;~  _ProgressSet($ID, $_Progress_Bars[$ID][8])
    Return SetError(@error, 0, @error = 0)
EndFunc   ;==>_ProgressSetText

;===============================================================================
;
; Function Name:   _ProgressSetFont()
; Description::    Sets the Font and Color of the Text of the Progressbar
; Parameter(s):    $ID : ID of Progressbar
;                  $Font      : Name of the font (empty String "" to do not change)
;                  $size      : [Optional] size of the font ( 0 or negative to leave the old)
;                  $Styles    : [Optional] The style of the typeface. Can be a combination of the following:
;                                  0 - Normal weight or thickness of the typeface
;                                  1 - Bold typeface
;                                  2 - Italic typeface
;                                  4 - Underline
;                                  8 - Strikethrough
;                                  ( -1, negative to leave the old)
;                  $ARGBcolor : [Optional] the color of the font, can be RGB or ARGB (depending on  $isARGB)
;                                  (empty String "" to do not change)
;                  $InverseColor: [Optional] should the color be inversed when the bar is under the text?
;                  $isARGB    : [Optional] Sets, whether $ARGBcolor is RGB (False, default) or ARGB (True)
; Requirement(s):  This UDF
; Return Value(s): Success: 1, Error: 0
; Author(s):       Prog@ndy
;
;===============================================================================
;
Func _ProgressSetFont(ByRef $ID, $Font, $size = Default, $Styles = Default, $ARGBcolor = Default, $InverseColor=-1, $isARGB = False)
    If Not IsArray($_Progress_Bars) Or UBound($_Progress_Bars, 2) <> 15 Or $ID > (UBound($_Progress_Bars)-1) Then Return SetError(1, 0, 0)
    Local $array = StringSplit($_Progress_Bars[$ID][10], "|")
    If $Font <> "" And IsString($Font) And $Font <> Default Then $array[1] = $Font
    $size = Number($size)
    If $size > 0 And $size <> Default Then $array[2] = $size
    $Styles = Number($Styles)
    If $Styles > -1 And $Styles <> Default Then $array[3] = BitAND($Styles, 15)
    If Not $isARGB Then $ARGBcolor = "0xFF" & Hex($ARGBcolor, 6)
    If Not ($ARGBcolor == "") And Not ($ARGBcolor == Default) Then $array[4] = "0x" & Hex($ARGBcolor, 8)
    If $InverseColor > 0 Then $array[5] = "1"
    If $InverseColor = 0 Then $array[5] = "0"
    $_Progress_Bars[$ID][10] = $array[1] & "|" & $array[2] & "|" & $array[3] & "|" & $array[4] & "|" & $array[5]
;~  _ProgressSet($ID, $_Progress_Bars[$ID][8])
    Return SetError(@error, 0, @error = 0)
EndFunc   ;==>_ProgressSetFont

;===============================================================================
;
; Function Name:   _ProgressSet()
; Description::    Sets the percentage of the Progressbar
; Parameter(s):    $ID : ID of Progressbar
;                  $prc The percentage to set
; Requirement(s):  This UDF :)
; Return Value(s): If Progressbar odes not Exist: @error is set to 1
; Author(s):       Prog@ndy
;
;===============================================================================
;
Func _ProgressSet(ByRef $ID, $prc)
    If Not IsArray($_Progress_Bars) Or UBound($_Progress_Bars, 2) <> 15 Or $ID > (UBound($_Progress_Bars)-1) Then Return SetError(1, 0, 0)
    If $prc > 100 Then $prc = 100
    If $prc < 0 Then $prc = 0
    $_Progress_Bars[$ID][8] = $prc
    Return 1
EndFunc   ;==>_ProgressSet
Func _ProgressGet(ByRef $ID)
    If Not IsArray($_Progress_Bars) Or UBound($_Progress_Bars, 2) <> 15 Or $ID > (UBound($_Progress_Bars)-1) Then Return SetError(1, 0, 0)
    Return _WinAPI_LoWord($_Progress_Bars[$ID][8])
EndFunc
;===============================================================================
;
; Function Name:   _ProgressMarquee()
; Description::    Sets the
; Parameter(s):    $ID : ID of Progressbar
;                  $speed : The speed of the Marquee: 1 to 10, smaller as 1 turns it off
;                  $makeSmallFront : Crop the Front image to 1/10 of its former width
;                         If it was created by _ProgressSetColors, this is 1/10 of Progress Width :)
;                         If this is set to -1 and $speed is set to < 0 then the Front image size is
;                             set to the width of the Progressbar
; Requirement(s):  WinAPI
; Return Value(s): If Progressbar does not Exist: @error is set to 1
; Author(s):       Prog@ndy
;
;===============================================================================
;
Func _ProgressMarquee(ByRef $ID, $speed = 2, $makeSmallFront = 1)
    If Not IsArray($_Progress_Bars) Or UBound($_Progress_Bars, 2) <> 15 Or $ID > (UBound($_Progress_Bars)-1) Then Return SetError(1, 0, 0)
    If $speed < 0 Then
        $_Progress_Bars[$ID][8] = _WinAPI_LoWord($_Progress_Bars[$ID][8])
        If $makeSmallFront = -1 Then $_Progress_Bars[$ID][11] = $_Progress_Bars[$ID][1]
        Return 1
    EndIf
    If $speed > 10 Then $speed = 10
    If $speed < 1 Then $speed = 1
    $_Progress_Bars[$ID][8] = _WinAPI_MakeLong(_WinAPI_LoWord($_Progress_Bars[$ID][8]), Number($speed))
    If $makeSmallFront Then $_Progress_Bars[$ID][11] = Int($_Progress_Bars[$ID][11] / 10)
    Return 1
EndFunc   ;==>_ProgressMarquee

; Author(s):       Prog@ndy
Func _ProgressRefresh(ByRef $ID, $prc = Default)
    If Not IsArray($_Progress_Bars) Or UBound($_Progress_Bars, 2) <> 15 Or $ID > (UBound($_Progress_Bars)-1) Then Return SetError(1, 0, 0)
    If $_Progress_Bars[$ID][1] < 1 Then Return SetError(2, 0, 0)
    Local $bar_height = $_Progress_Bars[$ID][2]
    Local $bar_width = $_Progress_Bars[$ID][1]
    If $prc = Default Then $prc = $_Progress_Bars[$ID][8]
    If $_Progress_Bars[$ID][8] > 65535 Then Return _ProgressRefreshMarquee($ID)
    If $prc > 100 Then $prc = 100
    If $prc < 0 Then $prc = 0
    $_Progress_Bars[$ID][8] = $prc
;~     $iPercent = $prc
;~ ConsoleWrite($iPercent & @CRLF)
;~     GUICtrlSetData($Status_Label, $prc & "%")
    Local $position_in_bar = Int(($bar_width) / 100 * $prc) ;; or we move out the bar
    If $prc = 0 Then $position_in_bar = 0
    _GDIPlus_GraphicsClear($_Progress_Bars[$ID][5], 0xFFFFFFFF)

;~      ; draw grey bar to right side
;~  _GDIPlus_GraphicsDrawImageRectRect($_Progress_Bars[$ID][5], $_Progress_Bars[$ID][7], Int(($_Progress_Bars[$ID][13] / 100) * $prc), 0, Int(($_Progress_Bars[$ID][13] / 100) * (100 - $prc)), $_Progress_Bars[$ID][14], _
;~          $position_in_bar , _
;~          0, _
;~          $bar_width - ($position_in_bar ), _
;~          $bar_height);
;~
        ; draw grey bar to right side
    _GDIPlus_GraphicsDrawImageRectRect($_Progress_Bars[$ID][5], $_Progress_Bars[$ID][7], 0 , 0, $_Progress_Bars[$ID][13] , $_Progress_Bars[$ID][14], _
            0 , _
            0, _
            $bar_width , _
            $bar_height);

    ;; draw blue bar from left
    If $position_in_bar > 0 Then _GDIPlus_GraphicsDrawImageRectRect($_Progress_Bars[$ID][5], $_Progress_Bars[$ID][6], _
            0, 0, Int(($_Progress_Bars[$ID][11] / 100) * $prc), $_Progress_Bars[$ID][12], _
            0, _
            0, _
            $position_in_bar, _
            $bar_height)


    If Not IsString($_Progress_Bars[$ID][9]) And $_Progress_Bars[$ID][9] = True Then
        _DrawStringCenter($_Progress_Bars[$ID][5], $prc & "%", $bar_width, $bar_height, $_Progress_Bars[$ID][10])
        If $position_in_bar Then _DrawStringCenter($_Progress_Bars[$ID][5], $prc & "%", $bar_width, $bar_height, $_Progress_Bars[$ID][10], $position_in_bar)
    ElseIf StringLen($_Progress_Bars[$ID][9]) > 0 Then
        _DrawStringCenter($_Progress_Bars[$ID][5], StringReplace($_Progress_Bars[$ID][9], "%P%", $prc), $bar_width, $bar_height, $_Progress_Bars[$ID][10])
        If $position_in_bar Then _DrawStringCenter($_Progress_Bars[$ID][5], StringReplace($_Progress_Bars[$ID][9], "%P%", $prc), $bar_width, $bar_height, $_Progress_Bars[$ID][10], $position_in_bar)
    EndIf
;~  _GDIPlus_GraphicsDrawString($_Progress_Bars[$ID][5],$prc & " %",Ceiling(($bar_width/2)-15),Ceiling(($bar_height/2)-5))
    _GDIPlus_GraphicsDrawImage($_Progress_Bars[$ID][3], $_Progress_Bars[$ID][4], 0, 0)

EndFunc   ;==>_ProgressRefresh

; Author(s):       Prog@ndy
Func _ProgressRefreshMarquee(ByRef $ID, $prc = Default)
    If Not IsArray($_Progress_Bars) Or UBound($_Progress_Bars, 2) <> 15 Or $ID > (UBound($_Progress_Bars)-1) Then Return SetError(1, 0, 0)
    If $_Progress_Bars[$ID][1] < 1 Then Return SetError(2, 0, 0)
    Local $bar_height = $_Progress_Bars[$ID][2]
    Local $bar_width = $_Progress_Bars[$ID][1]
    If $prc = Default Then $prc = _WinAPI_LoWord($_Progress_Bars[$ID][8])
    If $prc > 100 Then $prc = 0
    If $prc < 0 Then $prc = 0
    $_Progress_Bars[$ID][8] = _WinAPI_MakeLong($prc + _WinAPI_HiWord($_Progress_Bars[$ID][8]), _WinAPI_HiWord($_Progress_Bars[$ID][8]))
;~     $iPercent = $prc
;~ ConsoleWrite($iPercent & @CRLF)
;~     GUICtrlSetData($Status_Label, $prc & "%")
    Local $position_in_bar = Int(($bar_width + ($bar_height / $_Progress_Bars[$ID][12] * $_Progress_Bars[$ID][11])) / 100 * $prc) ;; or we move out the bar
    If $prc = 0 Then $position_in_bar = 0
    _GDIPlus_GraphicsClear($_Progress_Bars[$ID][5], 0xFFFFFFFF)
    ; draw grey bar to right side
    _GDIPlus_GraphicsDrawImageRectRect($_Progress_Bars[$ID][5], $_Progress_Bars[$ID][7], 0, 0, $_Progress_Bars[$ID][13], $_Progress_Bars[$ID][14], _
            0, _
            0, _
            $bar_width, _
            $bar_height);
    ;; draw blue bar from left
    If $position_in_bar > 0 Then _GDIPlus_GraphicsDrawImageRectRect($_Progress_Bars[$ID][5], $_Progress_Bars[$ID][6], _
            0, 0, $_Progress_Bars[$ID][11], $_Progress_Bars[$ID][12], _
            $position_in_bar - ($bar_height / $_Progress_Bars[$ID][12] * $_Progress_Bars[$ID][11]), _
            0, _
            $bar_height / $_Progress_Bars[$ID][12] * $_Progress_Bars[$ID][11], _
            $bar_height)
    If (Not IsString($_Progress_Bars[$ID][9])) And $_Progress_Bars[$ID][9] = True Then
        _DrawStringCenter($_Progress_Bars[$ID][5], StringReplace("          ", " ", ".", Mod(@SEC, 5) + 1), $bar_width, $bar_height, $_Progress_Bars[$ID][10])
    ElseIf StringLen($_Progress_Bars[$ID][9]) > 0 Then
        _DrawStringCenter($_Progress_Bars[$ID][5], StringReplace($_Progress_Bars[$ID][9], "%P%", StringReplace("            ", " ", ".", Mod(@SEC, 5) + 1)), $bar_width, $bar_height, $_Progress_Bars[$ID][10])
    EndIf
;~  _GDIPlus_GraphicsDrawString($_Progress_Bars[$ID][5],$prc & " %",Ceiling(($bar_width/2)-15),Ceiling(($bar_height/2)-5))
    _GDIPlus_GraphicsDrawImage($_Progress_Bars[$ID][3], $_Progress_Bars[$ID][4], 0, 0)

EndFunc   ;==>_ProgressRefreshMarquee


; Author(s):       Prog@ndy
Func _DrawStringCenter(ByRef $hGraphic, $sString, $bar_width, $bar_height, $FontFormat = "Arial|12|1|0xFF000000|0", $InverseStart = -1)
    $FontFormat = StringSplit($FontFormat, "|")
    If $InverseStart>-1 And $FontFormat[5]=1 Then
        DLLCall($__g_hGDIPDll, "int", "GdipSetClipRectI", "ptr", $hGraphic, "int", 0, "int", 0, "int", $InverseStart, "int", $bar_height, "int", 0)
        $FontFormat[4]= BitOr(0xFF000000,_InverseColor($FontFormat[4]))
    EndIf
    Local $hBrush = _GDIPlus_BrushCreateSolid($FontFormat[4])
    Local $hFormat = _GDIPlus_StringFormatCreate(0x0400)
    Local $hFamily = _GDIPlus_FontFamilyCreate($FontFormat[1])
    Local $hFont = _GDIPlus_FontCreate($hFamily, $FontFormat[2], $FontFormat[3])
    Local $tLayout = _GDIPlus_RectFCreate(0, 0, 0, 0)
    Local $aInfo = _GDIPlus_GraphicsMeasureString($hGraphic, $sString, $hFont, $tLayout, $hFormat)
    DllStructSetData($aInfo[0], "X", Int(($bar_width - DllStructGetData($aInfo[0], "Width")) / 2))
    DllStructSetData($aInfo[0], "Y", Int(($bar_height - DllStructGetData($aInfo[0], "Height")) / 2))
    _GDIPlus_GraphicsDrawStringEx($hGraphic, $sString, $hFont, $aInfo[0], $hFormat, $hBrush)
    If $InverseStart>-1 And $FontFormat[5]=1 Then DLLCall($__g_hGDIPDll, "int", "GdipSetClipRectI", "ptr", $hGraphic, "int", 0, "int", 0, "int", $bar_width, "int", $bar_height, "int", 0)
    _GDIPlus_FontDispose($hFont)
    _GDIPlus_FontFamilyDispose($hFamily)
    _GDIPlus_StringFormatDispose($hFormat)
    _GDIPlus_BrushDispose($hBrush)
EndFunc   ;==>_DrawStringCenter

; Modified _Max() Function, directly included
; Author(s):       Jeremy Landes <jlandes at landeserve dot com>
Func _MyMax($nNum1, $nNum2)

    If Number($nNum1) > Number($nNum2) Then
        Return Number($nNum1)
    Else
        Return Number($nNum2)
    EndIf
EndFunc   ;==>_MyMax

#EndRegion Colored Progressbar
;-------------------------------------------------------------------

;-------------------------------------------------------------------
#Region Gradient
;===============================================================================
;
; Function Name:   _Gradient($RGB_Color1 ,$RGB_Color2, $Count)
; Description::    Returns an Array of Gradient Colors
; Parameter(s):    $RGB_Color1 : The Start-Color in RGB Hexadecimal
;                  $RGB_Color2 : The End-Color in RGB Hexadecimal
;                  $Count :      The number of Colors in the Gradient
; Requirement(s):
; Return Value(s): An Array with the Colors
; Author(s):       Prog@ndy
;
;===============================================================================
;

Func _Gradient($RGB_Color1, $RGB_Color2, $Count, $ARGB = False)
    Local $Color1_R, $Color1_G, $Color1_B, $Color2_R, $Color2_G, $Color2_B, $NeuCol_R, $NeuCol_G, $NeuCol_B
    $ARGB = StringLeft("FF", 2 * $ARGB)
    $Color1_R = BitAND(BitShift($RGB_Color1, 16), 0xff)
    $Color1_G = BitAND(BitShift($RGB_Color1, 8), 0xff)
    $Color1_B = BitAND($RGB_Color1, 0xff)

    $Color2_R = BitAND(BitShift($RGB_Color2, 16), 0xff)
    $Color2_G = BitAND(BitShift($RGB_Color2, 8), 0xff)
    $Color2_B = BitAND($RGB_Color2, 0xff)

    $Count -= 1 ; 0-basiert !
    Dim $arColors[$Count + 1], $pos1

    For $i = 0 To $Count
        $pos1 = $Count - $i
        $NeuCol_R = ($Color1_R * $pos1 + $Color2_R * $i) / ($Count)
        $NeuCol_G = ($Color1_G * $pos1 + $Color2_G * $i) / ($Count)
        $NeuCol_B = ($Color1_B * $pos1 + $Color2_B * $i) / ($Count)
        $arColors[$i] = Execute('0x' & $ARGB & Hex($NeuCol_R, 2) & Hex($NeuCol_G, 2) & Hex($NeuCol_B, 2))
    Next
    Return $arColors
EndFunc   ;==>_Gradient


;Hilfsfunktion für doppelten Verlauf
; Author(s):       Prog@ndy
Func _ZwischenGrad($RGB_c, $ARGB = False)
    Local $c_R = BitAND(BitShift($RGB_c, 16), 0xff)
    Local $c_G = BitAND(BitShift($RGB_c, 8), 0xff)
    Local $c_B = BitAND($RGB_c, 0xff)
    $c_R = _MyMax(0, $c_R - 99)
    $c_G = _MyMax(0, $c_G - 99)
    $c_B = _MyMax(0, $c_B - 99)
    If $ARGB Then Return Dec("FF" & Hex($c_R, 2) & Hex($c_G, 2) & Hex($c_B, 2))
    Return Dec(Hex($c_R, 2) & Hex($c_G, 2) & Hex($c_B, 2))
EndFunc   ;==>_ZwischenGrad

; Author(s):       Prog@ndy
Func _CreateGradientImg(ByRef $bmpfront, $w, $h, $startRGB, $endRGB)
    Local $graph_front = _GDIPlus_ImageGetGraphicsContext($bmpfront)
    Local $hPen = _GDIPlus_PenCreate(0, 1)
    Local $Wechsel = Round((9 / 20) * $h)
    Local $temp = _Gradient($startRGB, $endRGB, 3)
    $temp = _ZwischenGrad($temp[1], 0)
    Local $Gradient = _Gradient($startRGB, $temp, $Wechsel, 1)
    Local $Gradient2 = _Gradient($temp, $endRGB, $h - $Wechsel, 1)
    Local $PenColor
    For $i = 0 To $h - 1
        If $i < $Wechsel Then
            $PenColor = $Gradient[$i]
        Else
            $PenColor = $Gradient2[$i - $Wechsel]
        EndIf
        _GDIPlus_PenSetColor($hPen, $PenColor)
        _GDIPlus_GraphicsDrawLine($graph_front, 0, $i, $w, $i, $hPen)
    Next
    _GDIPlus_PenSetColor($hPen, 0xFF666666)
    _GDIPlus_GraphicsDrawRect($graph_front, 0, 0, $w, $h, $hPen)
    _GDIPlus_PenDispose($hPen)
    _GDIPlus_GraphicsDispose($graph_front)
EndFunc   ;==>_CreateGradientImg

#EndRegion Gradient
;-------------------------------------------------------------------

;-------------------------------------------------------------------
#Region Internal
; Internal Function, do not use !
Func _Paint_Bars_Procedure($hWnd, $nMsg, $wParam, $lParam)
    For $i = 1 To UBound($_Progress_Bars) - 1
        If Not ($_Progress_Bars[$i][0] = -1) Then _ProgressRefresh($i);
    Next
EndFunc   ;==>_Paint_Bars_Procedure

; Internal Function, do not use !
; Author(s):       Prog@ndy
Func _Progress_CallBack_Init($ForceReInit = False)
    Local $sFuncName = "_Paint_Bars_Procedure", $iTime = 50, $sParam = "hwnd;int;int;dword"
    $_Progress_ahCallBack[2] += 1
    If $_Progress_ahCallBack[2] > 1 And Not $ForceReInit Then Return True
    If $ForceReInit Then
        Local $temp = $_Progress_ahCallBack[2]
        _Progress_CallBack_Free(1)
        $_Progress_ahCallBack[2] = $temp
    EndIf
    Local $hCallBack = DllCallbackRegister("_Paint_Bars_Procedure", "int", $sParam)

    Local $aTimer = DllCall("user32.dll", "uint", "SetTimer", _
            "hwnd", 0, "uint", 0, "int", $iTime, "ptr", DllCallbackGetPtr($hCallBack))

    $_Progress_ahCallBack[0] = $hCallBack
    $_Progress_ahCallBack[1] = $aTimer[0]

    Return True
EndFunc   ;==>_Progress_CallBack_Init

; Internal Function, do not use !
; Author(s):       Prog@ndy
Func _Progress_CallBack_Free($Force = False)
    $_Progress_ahCallBack[2] -= 1
    If $_Progress_ahCallBack[2] < 0 Then
        $_Progress_ahCallBack[2] = 0
        Return
    EndIf
    If (Not $Force) And ($_Progress_ahCallBack[2] > 0) Then Return
    ConsoleWrite("!DEBUG Variables ------------------" & @CRLF)
    ConsoleWrite("! $Force" & $Force & @CRLF)
    ConsoleWrite("! $_Progress_ahCallBack[2]" & $_Progress_ahCallBack[2] & @CRLF)
    ConsoleWrite("! $_Progress_ahCallBack[0]" & $_Progress_ahCallBack[1] & @CRLF)
    ConsoleWrite("! $_Progress_ahCallBack[1]" & $_Progress_ahCallBack[1] & @CRLF)
    ConsoleWrite("!----------------------------------" & @CRLF)
    If $_Progress_ahCallBack[1] <> -1 Then DllCall("user32.dll", "int", "KillTimer", "hwnd", 0*ConsoleWrite("KILL" & @CRLF) , "uint", $_Progress_ahCallBack[1])
    ConsoleWrite("!DEBUG after Kill TImer" & @CRLF)
    ConsoleWrite("!DEBUG Variables ------------------" & @CRLF)
    ConsoleWrite("! $Force" & $Force & @CRLF)
    ConsoleWrite("! $_Progress_ahCallBack[2]" & $_Progress_ahCallBack[2] & @CRLF)
    ConsoleWrite("! $_Progress_ahCallBack[0]" & $_Progress_ahCallBack[1] & @CRLF)
    ConsoleWrite("! $_Progress_ahCallBack[1]" & $_Progress_ahCallBack[1] & @CRLF)
    ConsoleWrite("!----------------------------------" & @CRLF)
    If $_Progress_ahCallBack[0] <> -1 Then DllCallbackFree($_Progress_ahCallBack[0])
    ConsoleWrite("!DEBUG after Free callback" & @CRLF)
    ConsoleWrite("!DEBUG Variables ------------------" & @CRLF)
    ConsoleWrite("! $Force" & $Force & @CRLF)
    ConsoleWrite("! $_Progress_ahCallBack[2]" & $_Progress_ahCallBack[2] & @CRLF)
    ConsoleWrite("! $_Progress_ahCallBack[0]" & $_Progress_ahCallBack[1] & @CRLF)
    ConsoleWrite("! $_Progress_ahCallBack[1]" & $_Progress_ahCallBack[1] & @CRLF)
    ConsoleWrite("!----------------------------------" & @CRLF)
    $_Progress_ahCallBack[0] = -1
    $_Progress_ahCallBack[1] = -1
    $_Progress_ahCallBack[2] = 0
    ConsoleWrite("!DEBUG after Var REset" & @CRLF)
    ConsoleWrite("!DEBUG Variables ------------------" & @CRLF)
    ConsoleWrite("! $Force" & $Force & @CRLF)
    ConsoleWrite("! $_Progress_ahCallBack[2]" & $_Progress_ahCallBack[2] & @CRLF)
    ConsoleWrite("! $_Progress_ahCallBack[0]" & $_Progress_ahCallBack[1] & @CRLF)
    ConsoleWrite("! $_Progress_ahCallBack[1]" & $_Progress_ahCallBack[1] & @CRLF)
    ConsoleWrite("!----------------------------------" & @CRLF)
EndFunc   ;==>_Progress_CallBack_Free


;~ Func _DebugPrint($s_text)
;~  $s_text = StringReplace($s_text, @LF, @LF & "-")
;~  ConsoleWrite($s_text & @LF); & _
;~ EndFunc   ;==>_DebugPrint

Func __CheckForGDIPlus($Fatal = True)
    Local $x = DllOpen("GDIPlus.dll")
    Local $ret = DllCall("Kernel32.dll", "dword", "GetModuleHandle", "str", "GDIPlus")
    DllClose($x)
    If $ret[0] = 0 And $Fatal Then _WinAPI_FatalAppExit("GDIplus not found. Please install GDIplus to use this application")
    Return ($ret[0] = 0)
EndFunc   ;==>__CheckForGDIPlus

#EndRegion Internal
;-------------------------------------------------------------------

Func _InverseColor($Col)
    $Col = Number($Col)
    Local $a = BitAND($Col,0xFF)
    Local $b = BitAND(BitShift($Col,8),0xFF)
    Local $c = BitAND(BitShift($Col,16),0xFF)
    Return BitOR(BitShift(255-$c,-16), BitShift(255-$b,-8), 255-$a)
EndFunc

 

GDIpProgress.au3

Edited by Musashi

Musashi-C64.png

"In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move."

Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By p4sCh
      Hello everyone,
      I've created a UDF for basic communication with SSH servers. I know there is already such a UDF, but I wasn't satisfied with it for my purpose, so I created a new one.
      This UDF also acts as a wrapper for the plink executable. Its essential functions are _SSHConnect, _SSHSend, _SSHRecv and _SSHCloseSocket.
      It does support multiple simultaneous connections and aims to be pretty robust. Feel free to share your opinions
      Two of the included examples use a slightly modified version of Vintage Terminal by @Chimp
      Download
      The download includes ssh.au3 (UDF), plink.exe (necessary), vintage terminal and code examples:
      SSH UDF.zip
    • By seadoggie01
      This UDF is because I'm tired of trying to use UI Automation and Send to automate Adobe Acrobat. I often need to read the contents of PDFs and Acrobat is not easy to work with as a window.  The functions are based on the API Reference from Adobe located here.
      Acrobat Pro is required for all functions.
      It's very beta right now, but it still seems to work. Currently, the functions are based around page level manipulation of PDF documents: re-arranging, swapping, deleting, and moving pages as this is what I use the most.
      Please feel free to request/suggest features!
       
       
    • By water
      I have started to rewrite the PowerPoint UDF similar to the Word, Excel and Outlook UDF. The new UDF will not be compatible with the existing one.
      I will add examples, documentation, a section in the wiki etc.
      So far the following functions have been coded - more are on the ToDo list.
      _PPT_Open: Open a connection to a running instance of PowerPoint or start a new one _PPT_Close: Close a PowerPoint instance _PPT_CommentAdd: Add a Comment anywhere on a Slide or connected to a Shape (version 1.5.0.0 2021-08-31) _PPT_CommentDelete: Delete a single Comment from a Slide or all Comments from a SlideRange (version 1.5.0.0 2021-08-31) _PPT_CommentList: Get a list of all Comments in a Presentation (version 1.5.0.0 2021-08-31) _PPT_ConvertUnits: Convert units (like centimeters) to other units (like points) (version 1.3.0.0 2021-08-17) _PPT_HeaderFooterList: Returns a list of Headers and Footers for a Presentation (version 1.1.0.0 2021-07-25, removed with version 1.4.0.0 2021-08-25) _PPT_HeaderFooterSet: Sets the Header/Footer for a Slide/Slides or the Slide-/Notes-/Handout-/Title-Master of the Presentation (version 1.2.0.0 2021-08-09) _PPT_PresentationAttach: Attach to an already opened Presentation _PPT_PresentationClose: Close a Presentation _PPT_PresentationExport: Export one/multiple/all Slides as PDF or XPS. _PPT_PresentationExportGraphic: Export one/multiple/all Slides in a graphic format. _PPT_PresentationList: Returns a list of currently open Presentations (version 1.0.0.0 2021-07-20) _PPT_PresentationNew: Create a new Presentation _PPT_PresentationOpen: Open an existing Presentation _PPT_Print: Print one/multiple/all Slides of a Presentation (version 1.0.0.0 2021-07-20) _PPT_PresentationSave: Save a Presentation _PPT_PresentationSaveAs: Save a Presentation to another location or with another type _PPT_ShapeAdd: Add a Shape to a single or multiple Slides (version 1.1.0.0 2021-07-25) _PPT_ShapeCopyMove: Copy/move a Shape(s) of a single Slide to a Slide(s) in the same or a different Presentation (version 1.1.0.0 2021-07-25) _PPT_ShapeDelete: Delete a Shape or Shapes from a single or multiple Slides (version 1.1.0.0 2021-07-25) _PPT_SlideAdd: Add slide(s) to a Presentation _PPT_SlideCopyMove: Copy, move, duplicate Slide(s) _PPT_SlideDelete: Delete Slide(s) _PPT_SlideShow: Show a Presentation _PPT_TableGet: Extract data from a PowerPoint Table Shape to an array (version 1.3.0.0 2021-08-17) _PPT_TableSet: Write data to a PowerPoint Table Shape (version 1.3.0.0 2021-08-17) _PPT_TextFindReplace: Find & replace text throughout entire PowerPoint presentation (version 1.0.0.0 2021-07-20) _PPT_TextSet: Sets/modifies the Text of a Shape or Shapes of a single or multiple Slides (version 1.2.0.0 2021-08-09 Which functions do you want me to add to the UDF?
      ToDo list:
      create slide (JLogan3o13) - Done: _PPT_SlideAdd Apply template to slide (JLogan3o13) - Done: _PPT_SlideAdd Apply theme to slide (JLogan3o13) Cut/Copy/Duplicate/Move/Delete slide(s) (JLogan3o13) - Done: _PPT_SlideCopyMove, _PPT_SlideDelete Export slides (JLogan3o13) - Done: _PPT_PresentationExport Cut/Copy/Duplicate/Move/Delete shape(s) (JLogan3o13): Done : _PPT_ShapeCopyMove, _PPT_ShapeDelete (version 1.1.0.0 2021-07-25) ApplyAnimation, Select, SetDefaultProperties, and zOrder for shape(s) (JLogan3o13) Searching and replacing text (pcjunki) - Done: _PPT_TextFindReplace (version 1.0.0.0 2021-07-20) Export slides in a graphic format (JPG, GIF, PNG ...) (UEZ) - Done: _PPT_PresentationExportGraphic The UDF can be downloaded from the download forum.
       
    • By DonChunior
      Introduction 
      In the course of my research for a project involving, among other things, the transfer of large amounts of data, I came across the BITS service and from that the idea for this UDF was born.
      For a brief overview, I'll quote from Microsoft's BITS website (https://docs.microsoft.com/en-us/windows/win32/bits/background-intelligent-transfer-service-portal).
      Availability 🛒
      The BITS UDF can be downloaded from my GitHub repository:
      🔗 https://github.com/DonChunior/BITS-UDF
      Comments 💬
      Currently, only an alpha version of the UDF is available.
      This contains by and large the full functionality of the object interfaces, but still completely lacks error checking and handling.
      I will implement this in the upcoming beta version.
      Therefore I ask you to use the UDF only for testing purposes but not in productive code!
      Acknowledgment 🤝
      Many thanks to @Nine and @Danyfirex.
      You helped me very well in solving some tricky problems.
    • By Hermes
      I have Index.html where it contains a frame with a source "frame1.html". I can select/highlight elements in index.html but unable to select/highlight elements inside the frame with the src "frame1.html", the autoit output is throwing error:
      __WD_Post: URL=HTTP://127.0.0.1:9515/session/2143396006437be4005db3b84acc1496/element/8be1c3c4-5bb1-42b1-8cde-7954765cbc61/element; $sData={"using":"css selector","value":"frameset:nth-of-type(1)"} __WD_Post: StatusCode=404; ResponseText={"value":{"error":"no such element","message":"no such element: Unable to locate element: {\"method\... __WD_Post ==> No match: {"value":{"error":"no such element","message":"no such element: Unable to locate element: {\"method\":\"css selector\",\"selector\":\"frameset:nth-of-type(1)\"}\n (Session info: chrome=90.0.4430.212)","stacktrace":"Backtrace:\n\tOrdinal0 [0x00FCE7D3+124883]\n\tOrdinal0 [0x00FCE7B1+124849]\n\tGetHandleVerifier [0x01218688+193832]\n\tGetHandleVerifier [0x0123C478+340760]\n\tGetHandleVerifier [0x012361F1+315537]\n\tGetHandleVerifier [0x012516BA+427354]\n\tGetHandleVerifier [0x01236176+315414]\n\tGetHandleVerifier [0x0125174A+427498]\n\tGetHandleVerifier [0x0125D6EB+476555]\n\tGetHandleVerifier [0x0125154B+426987]\n\tGetHandleVerifier [0x01234FFD+310941]\n\tGetHandleVerifier [0x01235D8E+314414]\n\tGetHandleVerifier [0x01235D19+314297]\n\tGetHandleVerifier [0x012F31EC+1089676]\n\tGetHandleVerifier [0x012F17C9+1082985]\n\tGetHandleVerifier [0x012F13A3+1081923]\n\tGetHandleVerifier [0x013ED9FD+2115741]\n\tOrdinal0 [0x0111B82E+1488942]\n\tOrdinal0 [0x010B5A7D+1071741]\n\tOrdinal0 [0x010B559B+1070491]\n\tOrdinal0 [0x010B54B1+1070257]\n\tOrdinal0 [0x010EFF53+1310547]\n\tBaseThreadInitThunk [0x770662C4+36]\n\tRtlSubscribeWnfStateChangeNotification [0x776B1B69+1081]\n\tRtlSubscribeWnfStateChangeNotification [0x776B1B34+1028]\n"}} Auto IT Script:
      #Include "wd_core.au3" #Include "wd_helper.au3" Local $sDesiredCapabilities, $sSession SetupChrome() _WD_Startup() $sSession = _WD_CreateSession($sDesiredCapabilities) _WD_Navigate($sSession, 'index.html') _WD_LoadWait($sSession) Local $index = _WD_FindElement($sSession, $_WD_LOCATOR_ByCSSSelector, "frameset:nth-of-type(1)") Local $index1 = _WD_FindElement($sSession, $_WD_LOCATOR_ByCSSSelector, "frameset:nth-of-type(1)", $index) Local $index2 = _WD_FindElement($sSession, $_WD_LOCATOR_ByCSSSelector, "frame:nth-of-type(1)", $index1) Local $index3 = _WD_FindElement($sSession, $_WD_LOCATOR_ByCSSSelector, "frameset:nth-of-type(1)", $index2) _WD_HighlightElement($sSession, $index2, 1) _WD_HighlightElement($sSession, $index3, 1) _WD_Shutdown() Func SetupChrome() _WD_Option('Driver', 'chromedriver.exe') _WD_Option('Port', 9515) _WD_Option('DriverParams', '--log-path="' & @ScriptDir & '\chrome.log"') $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true, "args":["start-maximized","disable-infobars"]}}}}' EndFunc ;==>SetupChrome  

      frame1.html index.html
×
×
  • Create New...