Sign in to follow this  
Followers 0
AZJIO

Need a UDF_to_Help.au3

8 posts in this topic

#1 ·  Posted (edited)

I easily made a help file using the converter.

GDIP.7z (GDIP.chm + Examples + Include)

GDIP_Ru.7z (Russian)

Is there a ready script conversion? It is necessary to receive ready files of the description from UDF

; #FUNCTION# ====================================================================================================================
; Name...........: _GDIPlus_LineBrushSetBlend
; Description ...: Sets the blend factors and the blend positions of a linear gradient brush to create a custom blend
; Syntax.........: _GDIPlus_LineBrushSetBlend($hLineGradientBrush, $aBlends)
; Parameters ....: $hLineGradientBrush - Pointer to a LinearGradientBrush object
;                  $aBlends            - Array of blend factors and blend positions:
;                  |[0][0] - Number of blend factors and blend positions, must be at least 2
;                  |[1][0] - Factor 1
;                  |[1][1] - Position 1
;                  |[2][0] - Factor 2
;                  |[2][1] - Position 2
;                  |[n][0] - Factor n
;                  |[n][1] - Position n
; Return values .: Success      - True
;                  Failure      - False and either:
;                  |@error and @extended are set if DllCall failed
;                  |$GDIP_STATUS contains a non zero value specifying the error code
; Remarks .......: Each factor in the array specifies a percentage of the ending color and should be in the range 0.0 to 1.0.
;                  Each position in the array indicates a percentage of the distance between the starting boundary and the ending
;                  +boundary and is in the range 0.0 to 1.0, where 0.0 indicates the starting boundary of the gradient and 1.0
;                  +indicates the ending boundary
; Related .......: _GDIPlus_LineBrushGetBlend
; Link ..........; @@MsdnLink@@ GdipSetLineBlend
; Example .......; No
; ===============================================================================================================================
Here's what I did

#include <Array.au3>

; En
$fLng = False
$LngOption = '[optional] '

; Ru
; если русская локализация, то русский язык
; If @OSLang = 0419 Then
; $fLng = True
; $LngOption = '[необязательный] '
; $LngSuccess = 'Успех'
; $LngFailure = 'Ошибка'
; EndIf
$NameUDF = 'GDIP.au3'
$sText = FileRead(@ScriptDir & '\' & $NameUDF)
$aText = StringRegExp($sText, '(?si)(?:; #FUNCTION# ;?={50,}?)(\r\n.+?)(?=; ?={50,}?)', 3) ; Добавлены под "?" различные форматы
$includeSyntax = '#Include <' & $NameUDF & '>' & @CRLF

; _ArrayDisplay($aText, 'Array')

Local $sErrorLog
Local $iErrorTotal = 0
Local $sHelpTxt

For $i = 0 To UBound($aText) - 1
    ; If $i = 2 Then ExitLoop ; 3 - 4
    $iError = 0
    $sOption = ''
    $sHelpTxt = ''

    If StringRegExp($aText[$i], '\r\n[^;]') Then MsgBox(0, 'Ошибка', $aText[$i])
    $aText[$i] = StringRegExpReplace($aText[$i], '\r\n\h*;\h+\+', ' ') ; Удаление искуственных переносов строк

    ; ~~~~~~~~~~~ Name ~~~~~~~~~~~
    $Name = StringRegExp($aText[$i], '(?i)(?:\r\n\h*;\h*Name[.\h:;]+)(\w+?)(?=\r\n)', 1) ; Имя в одну строку
    If @error Then
        ; $Name = 'None'
        ContinueLoop
    Else
        $Name = $Name[0]
        $sHelpTxt &= '###User Defined Function###' & @CRLF & $Name & @CRLF & @CRLF
    EndIf

    ; ~~~~~~~~~~~ Description ~~~~~~~~~~~
    $Description = StringRegExp($aText[$i], '(?i)(?:\r\n\h*;\h*Description[.\h:;]+)([^\r\n]+?)(?=\r\n)', 1) ; Описание в одну строку (хотя искуственный перенос возможен но удаляется)
    If @error Then
        $Description = 'None'
    Else
        $Description = $Description[0]
        $sHelpTxt &= '###Description###' & @CRLF & $Description & @CRLF & @CRLF
    EndIf

    ; ~~~~~~~~~~~ Syntax ~~~~~~~~~~~
    $Syntax = StringRegExp($aText[$i], '(?i)(?:\r\n\h*;\h*Syntax[.\h:;]+)([^\r\n]+?)(?=\r\n)', 1) ; Строка синтаксиса в одну строку
    If @error Then
        $Syntax = 'None'
        $aParamName = 1
    Else
        $Syntax = $Syntax[0]
        If StringRegExp($Syntax, ',\h*\[') Then
            If Not $iError Then
                $iError += 1
                $sErrorLog &= @CRLF & $Name
            EndIf
            $sErrorLog &= @CRLF & @TAB & '#syntax# error ",[" --> "[,"'
        EndIf
        $aParamName = StringRegExp($Syntax, '[ (,\[][ ]?\$(\w+)', 3) ; Получаем имена параметров. "[" добавлен чтобы парсить и те что с ошибкой
        $sHelpTxt &= '###Syntax###' & @CRLF & $includeSyntax & $Syntax & @CRLF & @CRLF
    EndIf

    ; ~~~~~~~~~~~ Parameters ~~~~~~~~~~~
    $Parameters = StringRegExp($aText[$i], '(?si)(?:\r\n\h*;\h*Parameters[.\h:;]+)(.+?)(?=\r\n\h*;\h*(?:Return values|Remarks|Related|Link|Example))', 1) ; Много строка -------
    If @error Then
        $Parameters = 'None'
        If Not $aParamName Then
            If Not $iError Then
                $iError += 1
                $sErrorLog &= @CRLF & $Name
            EndIf
            $sErrorLog &= @CRLF & @TAB & 'Parameters (not found)'
        EndIf
    Else
        $Parameters = $Parameters[0]
        If $Parameters <> 'None' And StringLen($Parameters) > 1 And Not StringRegExp($Parameters, '(?i)\r\n\h*;\h*(?:Return values|Remarks|Related|Link)') Then
            $Parameters = StringRegExpReplace($Parameters, '\r\n\h*;\h+\$', @CRLF & '$') ; удаляем пробелы перед параметрами
            $Parameters = StringRegExpReplace($Parameters, '\r\n\h*;\h+\|', @CRLF & @TAB)
            If Not $aParamName Then
                ; _ArrayDisplay($aParamName, 'Array')
                For $j = 0 To UBound($aParamName) - 1
                    $tmp = StringRegExp($Parameters, '(?i)\$' & $aParamName[$j] & '[\h.]+(?:- )?', 3) ; 3 вместо 2, чтобы найти повторы в описании и зменить правильно
                    If @error Then
                        If Not $iError Then
                            $iError += 1
                            $sErrorLog &= @CRLF & $Name
                        EndIf
                        $sErrorLog &= @CRLF & @TAB & $aParamName[$j] & ' (not found)'
                    Else
                        ; If Not $sOption And StringRegExp($Syntax, '(?i)\[,\h*\$' & $aParamName[$j] & '(?=[^\w])') Then $sOption = $LngOption
                        If Not $sOption And StringRegExp($Syntax, '(?i)(\[,|,\[)\h*\$' & $aParamName[$j] & '(?=[^\w])') Then $sOption = $LngOption ; Пришлось подстраиваться под ошибки описания ",\["

                        ; If $Name = '_GDIPlus_MetafileRecordFileName' Then _ArrayDisplay($tmp, 'tmp')
                        ; Новый детектор, при повторе параметров использует тот что длиннее, то есть с приставкой "- ", который скорее всегонужный
                        If UBound($tmp) > 1 Then ; если найдено больше одного параметра, то
                            $iMaxLen = StringLen($tmp[0])
                            $iz = 0
                            For $z = 1 To UBound($tmp) - 1
                                $len = StringLen($tmp[$z])
                                If $len > $iMaxLen Then
                                    $iMaxLen = $len
                                    $iz = $z
                                EndIf
                            Next
                            $tmp[0] = $tmp[$iz]
                        EndIf

                        $Parameters = StringReplace($Parameters, $tmp[0], '$' & $aParamName[$j] & @CRLF & @TAB & $sOption, 1)
                        ; MsgBox(0, $aParamName[$j], $Parameters)
                    EndIf
                Next
            EndIf
            $Parameters = StringRegExpReplace($Parameters, '\r\n\h*;\h+', @CRLF & @TAB)
            If $iError Then
                ; $Parameters = StringRegExpReplace($Parameters, '\A(\$\w+?)\h+(- )?', '\1' & @CRLF & @TAB)
                $Parameters = StringRegExpReplace($Parameters, '(\r\n\$\w+?)\h+(- )?', '\1' & @CRLF & @TAB)
            EndIf
            $sHelpTxt &= '###Parameters###' & @CRLF & '@@ParamTable@@' & @CRLF & $Parameters & @CRLF & '@@End@@' & @CRLF & @CRLF
        EndIf
    EndIf

    ; ~~~~~~~~~~~ Return ~~~~~~~~~~~
    $Return = StringRegExp($aText[$i], '(?s)(?:\r\n\h*;\h*Return values[.\h:;]+)(.+?)(?=\r\n\h*;\h*(?:Author|Modified|Remarks|Related|Link|Example))', 1) ; Много строка -------
    If @error Then
        $Return = 'None'
    Else
        $Return = $Return[0]
        If $Return <> 'None' And StringLen($Return) > 1 And Not StringRegExp($Return, '(?i)\r\n\h*;\h*(?:Author|Modified|Remarks|Related|Link)') Then
            $Return = StringRegExpReplace($Return, '(?i)\ASuccess\h*(- )?', 'Success:' & @TAB) ; удаляем пробелы перед параметрами
            $Return = StringRegExpReplace($Return, '(?i)\r\n\h*;\h+Failure\h*(- )?', @CRLF & 'Failure:' & @TAB) ; удаляем пробелы перед параметрами
            $Return = StringRegExpReplace($Return, '\r\n\h*;\h+\|\h*', @CRLF & @TAB)
            $Return = StringRegExpReplace($Return, '(?i)(?<!\n|Success:|Failure:)\t', ' ') ; Заменяем табы по тексту чтобы не портили таблицу
            $sHelpTxt &= '###ReturnValue###' & @CRLF & '@@ReturnTable@@' & @CRLF & $Return & @CRLF & '@@End@@' & @CRLF & @CRLF
        EndIf
    EndIf
    ; If $fLng Then
    ; $Return = StringRegExpReplace($Return, '(?i)\ASuccess:', $LngSuccess & ':' & @TAB)
    ; $Return = StringRegExpReplace($Return, '(?i)\r\nFailure:'& @TAB, @CRLF & $LngFailure & ':' & @TAB)
    ; EndIf

    ; ~~~~~~~~~~~ Remarks ~~~~~~~~~~~
    $Remarks = StringRegExp($aText[$i], '(?si)(?:\r\n\h*;\h*Remarks[.\h:;]+)(.+?)(?=\r\n\h*;\h*(?:Related|Link|Example))', 1) ; Много строка -------
    If @error Then
        $Remarks = 'None'
    Else
        $Remarks = $Remarks[0]
        If $Remarks <> 'None' And StringLen($Remarks) > 1 And Not StringRegExp($Remarks, '(?i)\r\n\h*;\h*(?:Related|Link)') Then
            $Remarks = StringRegExpReplace($Remarks, '\r\n\h*;\h*([^\v]+?)', @CRLF & '\1') ; удаление символа комментария
            $sHelpTxt &= '###Remarks###' & @CRLF & $Remarks & @CRLF & @CRLF
        EndIf
    EndIf

    ; ~~~~~~~~~~~ Related ~~~~~~~~~~~
    $Related = StringRegExp($aText[$i], '(?i)(?:\r\n\h*;\h*Related[.\h:;]+)([^\r\n]+?)(?=\r\n)', 1) ; Связанные функции в одну строку
    If @error Then
        $Related = 'None'
    Else
        $Related = $Related[0]
        If $Related <> 'None' And StringLen($Related) > 1 Then
            $sHelpTxt &= '###Related###' & @CRLF & $Related & @CRLF & @CRLF
        EndIf
    EndIf

    ; ~~~~~~~~~~~ Link ~~~~~~~~~~~
    $Link = StringRegExp($aText[$i], '(?i)(?:\r\n\h*;\h*Link[.\h:;]+)([^\r\n]+?)(?=\r\n)', 1) ; Связанные функции в одну строку
    If @error Then
        $Link = 'None'
    Else
        $Link = $Link[0]
        If $Link <> 'None' And StringLen($Link) > 1 Then
            $sHelpTxt &= '###See Also###' & @CRLF & $Link & @CRLF & @CRLF
        EndIf
    EndIf
    
    ; ~~~~~~~~~~~ Example ~~~~~~~~~~~
    $sHelpTxt &= '###Example###' & @CRLF & '@@IncludeExample@@' & @CRLF

    $hFile = FileOpen(@ScriptDir & '\' & $Name & '.txt', 2)
    FileWrite($hFile, $sHelpTxt)
    FileClose($hFile)
    $iErrorTotal += $iError
Next

If $sErrorLog Then
    $sErrorLog = 'ErrorTotal = ' & $iErrorTotal & @CRLF & $sErrorLog
    $hFile = FileOpen(@ScriptDir & '\~ErrorLog.txt', 2)
    FileWrite($hFile, $sErrorLog)
    FileClose($hFile)
EndIf
Edited by AZJIO

Share this post


Link to post
Share on other sites



There is a conversion tool available. I had to modify the input file as follows:

; #INDEX#
; Title .........: UDF title
; ===============================================================================================================================

; #CURRENT#
;_GDIPlus_LineBrushSetBlend

; #FUNCTION# ====================================================================================================================
; Name...........: _GDIPlus_LineBrushSetBlend
; Description ...: Sets the blend factors and the blend positions of a linear gradient brush to create a custom blend
; Syntax.........: _GDIPlus_LineBrushSetBlend($hLineGradientBrush, $aBlends)
; Parameters ....: $hLineGradientBrush - Pointer to a LinearGradientBrush object
;                  $aBlends            - Array of blend factors and blend positions:
;                  |[0][0] - Number of blend factors and blend positions, must be at least 2
;                  |[1][0] - Factor 1
;                  |[1][1] - Position 1
;                  |[2][0] - Factor 2
;                  |[2][1] - Position 2
;                  |[n][0] - Factor n
;                  |[n][1] - Position n
; Return values .: Success      - True
;                  Failure      - False and either:
;                  |@error and @extended are set if DllCall failed
;                  |$GDIP_STATUS contains a non zero value specifying the error code
; Author ........: user name
; Modified ......: user name
; Remarks .......: Each factor in the array specifies a percentage of the ending color and should be in the range 0.0 to 1.0.
;                  Each position in the array indicates a percentage of the distance between the starting boundary and the ending
;                  +boundary and is in the range 0.0 to 1.0, where 0.0 indicates the starting boundary of the gradient and 1.0
;                  +indicates the ending boundary
; Related .......: _GDIPlus_LineBrushGetBlend
; Link ..........; @@MsdnLink@@ GdipSetLineBlend
; Example .......; No
; ===============================================================================================================================
Func _GDIPlus_LineBrushSetBlend
EndFunc

to get the following output:

###User Defined Function###
_GDIPlus_LineBrushSetBlend

###Description###
Sets the blend factors and the blend positions of a linear gradient brush to create a custom blend

###Syntax###
#Include <UDF header.au3>
_GDIPlus_LineBrushSetBlend($hLineGradientBrush, $aBlends)

###Parameters###
@@ParamTable@@
$hLineGradientBrush
    Pointer to a LinearGradientBrush object
$aBlends
    Array of blend factors and blend positions:
        [0][0] - Number of blend factors and blend positions, must be at least 2
        [1][0] - Factor 1
        [1][1] - Position 1
        [2][0] - Factor 2
        [2][1] - Position 2
        [n][0] - Factor n
        [n][1] - Position n
@@End@@

###ReturnValue###
Success: True
Failure: False and either:

    @error and @extended are set if DllCall failed
    $GDIP_STATUS contains a non zero value specifying the error code

###Remarks###
Each factor in the array specifies a percentage of the ending color and should be in the range 0.0 to 1.0.
Each position in the array indicates a percentage of the distance between the starting boundary and the ending
+boundary and is in the range 0.0 to 1.0, where 0.0 indicates the starting boundary of the gradient and 1.0
+indicates the ending boundary

###Related###
_GDIPlus_LineBrushGetBlend

###See Also###
@@MsdnLink@@ GdipSetLineBlend

###Example###
@@IncludeExample@@

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

If you already have a solution why did you start a thread :huh:


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

I will do very long. Parameters need to be analyzed separately, using block "Syntax"

I guess that such a code is already there.

I looked in the "autoit-docs-v3.3.9.23-src.zip" and has not yet found.

Share this post


Link to post
Share on other sites

###Syntax### is easy. It's just a line including the UDF and the syntax line from the source.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Already a good result. It remains to make the error log. Updated

Edited by AZJIO

Share this post


Link to post
Share on other sites

Interesting AZJIO.


_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

guinness

I found the error, but they are linked with the fact that the error in the description of the UDF.

The error log has issued more than 20 errors.

Tried to convert WinAPI.au3 and WinHttp.au3 and made a few corrections to the script was more versatile. GDIP.chm also updated.

Edited by AZJIO

Share this post


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
Sign in to follow this  
Followers 0