Jump to content
Chimp

Ascii Art filigree Christmas tree

Recommended Posts

You made my day happy today
Thank you.

Kind regards and stay healthy,
mLipok

 


Signature beginning:   Wondering who uses AutoIt and what it can be used for ?
* GHAPI UDF - modest beginning - communication with GitHub REST API Forum Rules *
Include Dependency Tree (Tool for analyzing script relations)
ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  for other useful stuff click the following button

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library *

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) *

PDF Related:How to get reference to PDF object embeded in IE *

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2021-01-03

Share this post


Link to post
Share on other sites

I was playing with your code.
Little refactoring (less Global's , Au3Check compliance, enclosing in function, function parametrization).

#AutoIt3Wrapper_Run_AU3Check=Y
#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7

#include <GUIConstants.au3>
#include <WinAPISys.au3>
Global $g_hGUI_ChristmasTree

_Christmas_Tree_Create('Merry Christmas', 310, 290, 1000, 0xFFFFFF, 255)

Func _Christmas_Tree_Create($sInfo, $iWidth = 310, $iHeight = 290, $iSleep = 2000, $iTransColor = 0x000000, $iTransparencyLevel = 0)
    HotKeySet("{ESC}", _Christmas_Tree_End)
    Local Const $aColors[6] = [0x00FF00, 0XFF0000, 0X0040FF, 0XFFFF00, 0X00FFFF, 0XFF00FF] ; 0xRRGGBB
    Local Const $sBall = '♥'
    Local $hLayer[6]
    Local $a[] = ['.', '~', "'", $sBall, "'", '~', '.', '*', '               ']
    Local $tree = $a[8] & $a[7] & @CRLF
    Local $ndx, $sGotString, $sGetString, $ChristmasBalls, $sRandomBalls, $iNrOfBalls
    Local $vDummy
    #forceref $vDummy

    $g_hGUI_ChristmasTree = GUICreate($sInfo, $iWidth, $iHeight, Default, Default, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST))
    GUISetBkColor($iTransColor, $g_hGUI_ChristmasTree)
    _WinAPI_SetLayeredWindowAttributes($g_hGUI_ChristmasTree, $iTransColor, $iTransparencyLevel, $LWA_COLORKEY)
    GUISetState()
    For $i = 0 To 14
        $tree &= StringRight($a[8], 15 - ($i + 1))
        For $x = 0 To ($i + 1) * 2
            $tree &= $a[Mod($ndx, 7)]
            $ndx += 1
        Next
        $tree &= @CRLF
        If $i < 6 Then
            $hLayer[$i] = GUICtrlCreateLabel("", 0, 0, $iWidth, $iHeight, -1, $GUI_WS_EX_PARENTDRAG)
            $vDummy = GUICtrlSetFont(-1, 12, 800, 0, "Courier new") + GUICtrlSetColor(-1, $aColors[$i]) + GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
        EndIf
    Next ; RegExp thanks to @seadoggie01 https://www.autoitscript.com/forum/topic/200770-how-to-clean-a-string-by-regexp/?do=findComment&comment=1440488
    $ChristmasBalls = StringRegExpReplace($tree, "(*UCP)(?s)[^\Q" & $sBall & @CRLF & "\E]", " ") ; keep only balls
    StringReplace($ChristmasBalls, $sBall, $sBall)
    $iNrOfBalls = @extended
    GUICtrlSetData($hLayer[0], $tree) ; StringRegExpReplace($tree, "(*UCP)(?s)[\Q" & $a[7] & "\E]", " "))
    Local $RemainingBalls
    While Sleep($iSleep)
        $sRandomBalls = $ChristmasBalls
        $RemainingBalls = $iNrOfBalls
        For $i = 1 To Random(5, $RemainingBalls - 5, 1)
            $sRandomBalls = StringReplace($sRandomBalls, StringInStr($sRandomBalls, $sBall, 0, Random(1, $RemainingBalls, 1)), " ")
            $RemainingBalls -= 1
        Next
        For $i = 1 To 5
            $sGetString = GUICtrlRead($hLayer[$i]) ; StringReplace(GUICtrlRead($hLayer[$i]), $a[7], " ")
            $sGotString = $sGetString
            For $ii = 1 To $RemainingBalls
                If StringMid($sGetString, StringInStr($sRandomBalls, $sBall, 0, $ii), 1) = $sBall Then
                    $sGetString = StringReplace($sGetString, StringInStr($sRandomBalls, $sBall, 0, $ii), " ")
                EndIf
            Next
            If $sGotString <> $sGetString Then GUICtrlSetData($hLayer[$i], $sGetString)
        Next
        GUICtrlSetData($hLayer[Random(1, 5, 1)], $sRandomBalls)
    WEnd
EndFunc   ;==>_Christmas_Tree_Create

Func _Christmas_Tree_End()
    If WinActive("[ACTIVE]") = $g_hGUI_ChristmasTree Then Exit GUIDelete($g_hGUI_ChristmasTree)
EndFunc   ;==>_Christmas_Tree_End

 

I was in hope to change Transparency level and show the title, but I have no success in this regards.
Could you take a look ?

 

Edited by mLipok

Signature beginning:   Wondering who uses AutoIt and what it can be used for ?
* GHAPI UDF - modest beginning - communication with GitHub REST API Forum Rules *
Include Dependency Tree (Tool for analyzing script relations)
ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  for other useful stuff click the following button

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library *

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) *

PDF Related:How to get reference to PDF object embeded in IE *

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2021-01-03

Share this post


Link to post
Share on other sites
11 hours ago, mLipok said:

You made my day happy today
Thank you.

Hi @mLipok, I'm happy for that! :)

as regards the effect to be obtained, that is the variable transparency and giving a title to the window, it is necessary to modify both the style of the GUI and the method to make the entire window transparent; also I see that you have also parameterized the window width and height values, and so I think you would like to be able to vary the window size at will, but this cannot be done this way because the window size depends on the font size used. . So what would be better to parameterize is the font size. However, finding the size of the window based on the font, size and the "string" it must contain is not an easy thing. Luckily there is a nice UDF created by @Melba23 that does just that. (thank You Melba)
So I tweaked your 'fork' a bit to get those effects.
Obviously you need to download Melba's StringSize UDF and save it along with the script (https://www.autoitscript.com/forum/topic/114034-stringsize-m23-new-version-16-aug-11/)
I hope the result is what you wanted to achieve .... have fun

#AutoIt3Wrapper_Run_AU3Check=Y
#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7

#include <GUIConstants.au3>
; #include <WinAPISys.au3>
#include <StringSize.au3>
Global $g_hGUI_ChristmasTree
;                      title       Font Size, Delay, BckClr, Transparency (the low the more transp)
_Christmas_Tree_Create('Merry Christmas', 18, 500, 0x000000, 200)

Func _Christmas_Tree_Create($sInfo, $iFontSize = 12, $iSleep = 2000, $iBackgroundColor = 0x000000, $iTransparencyLevel = 255)
    HotKeySet("{ESC}", _Christmas_Tree_End)
    Local $iWidth = 310, $iHeight = 290
    Local Const $aColors[6] = [0x00FF00, 0XFF0000, 0X0040FF, 0XFFFF00, 0X00FFFF, 0XFF00FF] ; 0xRRGGBB
    Local Const $sBall = '♥'
    Local $hLayer[6]
    Local $a[] = ['.', '~', "'", $sBall, "'", '~', '.', '*', '               ']
    Local $tree = $a[8] & $a[7] & @CRLF
    Local $ndx, $sGotString, $sGetString, $ChristmasBalls, $sRandomBalls, $iNrOfBalls
    Local $vDummy
    #forceref $vDummy

    $g_hGUI_ChristmasTree = GUICreate($sInfo, $iWidth, $iHeight, Default, Default, 0, BitOR(0, $WS_EX_TOPMOST)) ;$WS_EX_LAYERED
    GUISetBkColor($iBackgroundColor, $g_hGUI_ChristmasTree)
    ;_WinAPI_SetLayeredWindowAttributes($g_hGUI_ChristmasTree, $iTransparencyColor, $iTransparencyLevel, $LWA_COLORKEY)
    WinSetTrans($g_hGUI_ChristmasTree, "", $iTransparencyLevel)
    GUISetState()
    For $i = 0 To 14
        $tree &= StringRight($a[8], 15 - ($i + 1))
        For $x = 0 To ($i + 1) * 2
            $tree &= $a[Mod($ndx, 7)]
            $ndx += 1
        Next
        $tree &= @CRLF
        If $i < 6 Then
            $hLayer[$i] = GUICtrlCreateLabel("", 0, 0, $iWidth, $iHeight, -1, $GUI_WS_EX_PARENTDRAG)
            $vDummy = GUICtrlSetFont(-1, $iFontSize, 800, 0, "Courier new") + GUICtrlSetColor(-1, $aColors[$i]) + GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
            GUICtrlSetResizing(-1, $GUI_DOCKBORDERS)
        EndIf
    Next ; RegExp thanks to @seadoggie01 https://www.autoitscript.com/forum/topic/200770-how-to-clean-a-string-by-regexp/?do=findComment&comment=1440488
    $ChristmasBalls = StringRegExpReplace($tree, "(*UCP)(?s)[^\Q" & $sBall & @CRLF & "\E]", " ") ; keep only balls
    StringReplace($ChristmasBalls, $sBall, $sBall)
    $iNrOfBalls = @extended
    ;---- _StringSize() by Melba23 ----
    Local $aDims = _StringSize($tree, $iFontSize, 800, 0, "Courier new")
    WinMove($g_hGUI_ChristmasTree, '', Default, Default, $aDims[2], $aDims[3])
    ;----------------------------------
    GUICtrlSetData($hLayer[0], $tree) ; StringRegExpReplace($tree, "(*UCP)(?s)[\Q" & $a[7] & "\E]", " "))
    Local $RemainingBalls
    While Sleep($iSleep)
        $sRandomBalls = $ChristmasBalls
        $RemainingBalls = $iNrOfBalls
        For $i = 1 To Random(5, $RemainingBalls - 5, 1)
            $sRandomBalls = StringReplace($sRandomBalls, StringInStr($sRandomBalls, $sBall, 0, Random(1, $RemainingBalls, 1)), " ")
            $RemainingBalls -= 1
        Next
        For $i = 1 To 5
            $sGetString = GUICtrlRead($hLayer[$i]) ; StringReplace(GUICtrlRead($hLayer[$i]), $a[7], " ")
            $sGotString = $sGetString
            For $ii = 1 To $RemainingBalls
                If StringMid($sGetString, StringInStr($sRandomBalls, $sBall, 0, $ii), 1) = $sBall Then
                    $sGetString = StringReplace($sGetString, StringInStr($sRandomBalls, $sBall, 0, $ii), " ")
                EndIf
            Next
            If $sGotString <> $sGetString Then GUICtrlSetData($hLayer[$i], $sGetString)
        Next
        GUICtrlSetData($hLayer[Random(1, 5, 1)], $sRandomBalls)
    WEnd
EndFunc   ;==>_Christmas_Tree_Create

Func _Christmas_Tree_End()
    If WinActive("[ACTIVE]") = $g_hGUI_ChristmasTree Then Exit GUIDelete($g_hGUI_ChristmasTree)
EndFunc   ;==>_Christmas_Tree_End

 


small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Share this post


Link to post
Share on other sites

... thank you all for the likes received!  :)


small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Share this post


Link to post
Share on other sites

Variation:

#AutoIt3Wrapper_Run_AU3Check=Y
#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7

#include <GUIConstants.au3>
; #include <WinAPISys.au3>
#include <StringSize.au3>
Global $g_hGUI_ChristmasTree
_Christmas_Tree_Create('Merry Christmas SplashScreen', 5000, 500, 18, 0x000000, 210)

Func _Christmas_Tree_Create($sInfo, $iTimeToExit = 5000, $iSleep = 2000, $iFontSize = 12, $iBackgroundColor = 0x000000, $iTransparencyLevel = 255)
    HotKeySet("{ESC}", _Christmas_Tree_End)
    Local $iWidth = 310, $iHeight = 290
    Local Const $aColors[6] = [0x00FF00, 0XFF0000, 0X0040FF, 0XFFFF00, 0X00FFFF, 0XFF00FF] ; 0xRRGGBB
;~  Local Const $sBall = '♥'
    Local Const $sBall = '۝'
;~  Local Const $sBall = 'Ỗ'
    Local $hLayer[6]
    Local $a[] = ['.', '~', "'", $sBall, "'", '~', '.', '*', '               ']
    Local $tree = $a[8] & $a[7] & @CRLF
    Local $ndx, $sGotString, $sGetString, $ChristmasBalls, $sRandomBalls, $iNrOfBalls
    Local $vDummy
    #forceref $vDummy

    $g_hGUI_ChristmasTree = GUICreate($sInfo, $iWidth, $iHeight, Default, Default, 0, BitOR(0, $WS_EX_TOPMOST)) ;$WS_EX_LAYERED
    GUISetBkColor($iBackgroundColor, $g_hGUI_ChristmasTree)
    ;_WinAPI_SetLayeredWindowAttributes($g_hGUI_ChristmasTree, $iTransparencyColor, $iTransparencyLevel, $LWA_COLORKEY)
    WinSetTrans($g_hGUI_ChristmasTree, "", $iTransparencyLevel)
    GUISetState()
    For $i = 0 To 14
        $tree &= StringRight($a[8], 15 - ($i + 1))
        For $x = 0 To ($i + 1) * 2
            $tree &= $a[Mod($ndx, 7)]
            $ndx += 1
        Next
        $tree &= @CRLF
        If $i < 6 Then
            $hLayer[$i] = GUICtrlCreateLabel("", 0, 0, $iWidth, $iHeight, -1, $GUI_WS_EX_PARENTDRAG)
            $vDummy = GUICtrlSetFont(-1, $iFontSize, 800, 0, "Courier new") + GUICtrlSetColor(-1, $aColors[$i]) + GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
            GUICtrlSetResizing(-1, $GUI_DOCKBORDERS)
        EndIf
    Next ; RegExp thanks to @seadoggie01 https://www.autoitscript.com/forum/topic/200770-how-to-clean-a-string-by-regexp/?do=findComment&comment=1440488
    $ChristmasBalls = StringRegExpReplace($tree, "(*UCP)(?s)[^\Q" & $sBall & @CRLF & "\E]", " ") ; keep only balls
    StringReplace($ChristmasBalls, $sBall, $sBall)
    $iNrOfBalls = @extended
    ;---- _StringSize() by Melba23 ----
    Local $aDims = _StringSize($tree, $iFontSize, 800, 0, "Courier new")
    WinMove($g_hGUI_ChristmasTree, '', Default, Default, $aDims[2], $aDims[3])
    ;----------------------------------
    GUICtrlSetData($hLayer[0], $tree) ; StringRegExpReplace($tree, "(*UCP)(?s)[\Q" & $a[7] & "\E]", " "))
    Local $RemainingBalls
    Local $hTimer = TimerInit()
    While Sleep($iSleep)
        If TimerDiff($hTimer) > $iTimeToExit Then ExitLoop
        $sRandomBalls = $ChristmasBalls
        $RemainingBalls = $iNrOfBalls
        For $i = 1 To Random(5, $RemainingBalls - 5, 1)
            $sRandomBalls = StringReplace($sRandomBalls, StringInStr($sRandomBalls, $sBall, 0, Random(1, $RemainingBalls, 1)), " ")
            $RemainingBalls -= 1
        Next
        For $i = 1 To 5
            $sGetString = GUICtrlRead($hLayer[$i]) ; StringReplace(GUICtrlRead($hLayer[$i]), $a[7], " ")
            $sGotString = $sGetString
            For $ii = 1 To $RemainingBalls
                If StringMid($sGetString, StringInStr($sRandomBalls, $sBall, 0, $ii), 1) = $sBall Then
                    $sGetString = StringReplace($sGetString, StringInStr($sRandomBalls, $sBall, 0, $ii), " ")
                EndIf
            Next
            If $sGotString <> $sGetString Then GUICtrlSetData($hLayer[$i], $sGetString)
        Next
        GUICtrlSetData($hLayer[Random(1, 5, 1)], $sRandomBalls)
    WEnd
EndFunc   ;==>_Christmas_Tree_Create

Func _Christmas_Tree_End()
    If WinActive("[ACTIVE]") = $g_hGUI_ChristmasTree Then Exit GUIDelete($g_hGUI_ChristmasTree)
EndFunc   ;==>_Christmas_Tree_End

 


Signature beginning:   Wondering who uses AutoIt and what it can be used for ?
* GHAPI UDF - modest beginning - communication with GitHub REST API Forum Rules *
Include Dependency Tree (Tool for analyzing script relations)
ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  for other useful stuff click the following button

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library *

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) *

PDF Related:How to get reference to PDF object embeded in IE *

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2021-01-03

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

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By JackER4565
      Hi I just wanted to share the tree I've made with all of you.
      Made it myself with a little help of the forum and google.
      This uses an example from @Chimp in this post, then I added the movable part, you exit by pressing 'end'.
      #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Icon=tree.ico #AutoIt3Wrapper_AU3Check_Stop_OnWarning=y #AutoIt3Wrapper_Run_Tidy=y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <WinAPISysWin.au3> #include <GUIConstants.au3> #include <Misc.au3> ; for _IsPressed (23 END key) ;FileInstall("***\tree.gif", @ScriptDir & "\tree.gif") ;<<<<<<<<<< include ur gif file here Local $hDLL = DllOpen("user32.dll"), $oIE = ObjCreate("Shell.Explorer.2") Local $hBackground = GUICreate("", 350, 470, 20, 20, $WS_POPUP, $WS_EX_LAYERED + $WS_EX_TOPMOST) GUISetBkColor(0xffffff) Local $AlphaKey = 0xffffff $hLabel = GUICtrlCreateLabel("", 0, 0, 350, 450, -1, $GUI_WS_EX_PARENTDRAG) _WinAPI_SetLayeredWindowAttributes($hBackground, $AlphaKey, 0, $LWA_COLORKEY) GUISetState(@SW_SHOW, $hBackground) $hIE = GUICtrlCreateObj($oIE, -20, -5, 410, 480) ; <- embedd $oIE in the AutoIt GUI GUICtrlSetBkColor(-1, 0xffffff) $oIE.navigate(@ScriptDir & "\tree.gif") While True If _IsPressed("23", $hDLL) Then ExitLoop ; END key was pressed Sleep(50) WEnd $oIE = "" $hDLL = "" GUIDelete($hBackground) Thanks and happy holidays!

      xmas.au3 xmas.exe tree.ico
    • By Chimp
      A simple endless kaleidoscope made  on a RichEdit control (hit esc to exit)
      Idea is from this link: http://www.calormen.com/jsbasic/ select the "Rod's Color Pattern" demo and run it on the Apple 2 emulator on that web page to see the original Apple II version.
      ; Idea from this link: http://www.calormen.com/jsbasic/ ; get the "Rod's Color Pattern" from the "Select a sample..." combo and run it ; #include <GuiRichEdit.au3> #include <GUIConstants.au3> HotKeySet("{ESC}", "_TheEnd") ; Global $iHwidth = 40, $iVheight = 40; width and height of screen Global $sBuffer = _StringReplay(_StringReplay(" ", $iHwidth + 1) & @CRLF, $iVheight) ;to fill the RichEdit Global $sChar = " " Global Const $aApplesoft_color[16] = [ _ ; LoRes colors in Applesoft basic 0x000000, _ ; 0x0 = 00 = Black 0XFF00FF, _ ; 0x1 = 01 = Magenta 0X0000A0, _ ; 0x2 = 02 = Dark Blue 0X800080, _ ; 0x3 = 03 = Purple 0X006400, _ ; 0x4 = 04 = Dark Green 0X808080, _ ; 0x5 = 05 = Grey 0X0000CD, _ ; 0x6 = 06 = Medium Blue 0XADD8E6, _ ; 0x7 = 07 = Light Blue 0XA52A2A, _ ; 0x8 = 08 = Brown 0XFFA500, _ ; 0x9 = 09 = Orange 0XD3D3D3, _ ; 0xA = 10 = Light Grey 0XFFC0CB, _ ; 0xB = 11 = Pink 0X008000, _ ; 0xC = 12 = Green 0XFFFF00, _ ; 0xD = 13 = Yellow 0X00FFFF, _ ; 0xE = 14 = Aqua 0xFFFFFF]; ; 0xF = 15 = White Global $MyGui = GUICreate("", 335, 630, -1, -1, $WS_POPUPWINDOW, BitOR($WS_EX_DLGMODALFRAME, $WS_EX_CLIENTEDGE, $WS_EX_COMPOSITED, $WS_EX_LAYERED)) $hGlass = GUICtrlCreateLabel("", 0, 0, 335, 630, -1, $GUI_WS_EX_PARENTDRAG) ; Protect the RichEdit and allows to drag the GUI around GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) ; This is like a glass over the underlying RichEdit GUICtrlSetCursor(-1, 2) ; Cursor is an arrow (instead of the default I-beam) ; ; This RichEdit is used to simulate the LoRes Graphic of tha Apple 2 (40x40 pixels) Global $hGR = _GUICtrlRichEdit_Create($MyGui, $sBuffer, 0, 0, 335, 630, BitOR($ES_READONLY, $ES_MULTILINE)) _GUICtrlRichEdit_SetSel($hGR, 0, -1) _GUICtrlRichEdit_SetFont($hGR, 10, "Courier new") _GUICtrlRichEdit_SetBkColor($hGR, 0xffffff) GUISetState() ; Main loop ; --------- While 1 For $W = 3 To 50 For $x = 19 To 1 Step -1 For $y = 19 To 0 Step -1 $xy = $x + $y $iColor = Mod(Int($y * 3 / ($x + 3) + $x * $W / 12), 16) $sChar = ChrW(32 + $iColor) ; comment this if you don't want chars (only color) If $iColor > 15 Then $iColor = 15 Print($sChar, $x, $xy, $iColor) Print($sChar, $xy, $x, $iColor) Print($sChar, 40 - $x, 40 - $xy, $iColor) Print($sChar, 40 - $xy, 40 - $x, $iColor) Print($sChar, $xy, 40 - $x, $iColor) Print($sChar, 40 - $x, $xy, $iColor) Print($sChar, $x, 40 - $xy, $iColor) Print($sChar, 40 - $xy, $x, $iColor) Next Next Next WEnd ; Print a char to Htab (Horiz. pos), Vtab (Vert pos) on the RichEdit ; ------------------------------------------------------------------ Func Print($sChar = "", $iHtab = 1, $iVtab = 1, $iColor = 0xffffff) _GUICtrlRichEdit_SetSel($hGR, GetAbsPos($iHtab, $iVtab), GetAbsPos($iHtab, $iVtab) + 1, True) _GUICtrlRichEdit_SetCharBkColor($hGR, $aApplesoft_color[$iColor]) _GUICtrlRichEdit_ReplaceText($hGR, $sChar, False) EndFunc ;==>Print ; From Htab Vtab (1 based) to Absolute position within the RichEdit ; ----------------------------------------------------------------- Func GetAbsPos($iHtab = 1, $iVtab = 1, $iScreenWidth = $iHwidth) Return ($iVtab - 1) * ($iScreenWidth + 2) + $iHtab EndFunc ;==>GetAbsPos ; returns one or more chars replicated n times ; Example: ConsoleWrite(_StringReplay('*', 5) & @CRLF) Func _StringReplay($sChars = "", $iRepeats = 0) $sChars = String($sChars) $iRepeats = Int(Abs(Number($iRepeats))) Return StringReplace(StringFormat('%' & $iRepeats & 's', ""), " ", $sChars) EndFunc ;==>_StringReplay Func _TheEnd() If WinActive("[ACTIVE]") = $MyGui Then _GUICtrlRichEdit_Destroy($hGR) Exit EndIf EndFunc ;==>_TheEnd  
    • By Chimp
      Just for fun
      Idea from here:
      http://codegolf.stackexchange.com/questions/73259/output-the-current-time-in-ascii-art
      Edit:
      Also added an analogue experimental version in post #11
      #include <GUIConstants.au3> HotKeySet("{ESC}", "End") Local $hClock, $sDelim = ";", $aChar, $sScanLines, $aScanLine[6], $aFont[13] = [ _ ' ___ ; / _ \ ; | | | | ; | | | | ; | |_| | ; \___/ ', _ ; 0 ' __ ; /_ | ; | | ; | | ; | | ; |_| ', _ ; 1 ' ___ ; |__ \ ; ) | ; / / ; / /_ ; |____| ', _ ; 2 ' ____ ; |___ \ ; __) | ; |__ < ; ___) | ; |____/ ', _ ; 3 ' _ _ ; | || | ; | || |_ ; |__ _| ; | | ; |_| ', _ ; 4 ' _____ ; | ____| ; | |__ ; |___ \ ; ___) | ; |____/ ', _ ; 5 ' __ ; / / ; / /_ ; | _ \ ; | (_) | ; \___/ ', _ ; 6 ' ______ ; |____ | ; / / ; / / ; / / ; /_/ ', _ ; 7 ' ___ ; / _ \ ; | (_) | ; > _ < ; | (_) | ; \___/ ', _ ; 8 ' ___ ; / _ \ ; | (_) | ; \__, | ; / / ; /_/ ', _ ; 9 ' ; _ ;(_); _ ;(_); ', _ ; : " ; ; __ _ _ __ ;/ _` | ' \;\__,_|_|_|_|; ", _ ; am " ; ; _ __ _ __ ;| '_ \ ' \;| .__/_|_|_|;|_|"]; pm Global $hAsciiClock = GUICreate("Ascii clock", 390, 80, 10, 10, $WS_POPUPWINDOW, BitOR($WS_EX_DLGMODALFRAME, $WS_EX_CLIENTEDGE, $WS_EX_COMPOSITED)) $hClock = GUICtrlCreateLabel("", 0, 0, 390, 80, -1, $GUI_WS_EX_PARENTDRAG) GUICtrlSetFont(-1, 7, 0, 0, "Courier new") GUISetState() While 1 $sTime = StringFormat("%02s", @HOUR - (12 * (@HOUR > 12))) & "A" & @MIN & "A" & @SEC & Hex(11 + Number(@HOUR > 12), 1) For $x = 1 To StringLen($sTime) $achar = StringSplit($aFont[Dec(StringMid($sTime, $x, 1))], $sDelim, 3) For $i = 0 To 5 If $x = StringLen($sTime) Then ; last char (am or pm) $aScanLine[$i] = StringFormat('%-65s', $aScanLine[$i]) & $achar[$i] Else $aScanLine[$i] &= $achar[$i] EndIf Next Next For $i = 0 To 5 $sScanLines &= $aScanLine[$i] & @CRLF $aScanLine[$i] = "" Next GUICtrlSetData($hClock, $sScanLines) $sScanLines = "" Sleep(1000) WEnd Func End() If WinActive("[ACTIVE]") = $hAsciiClock Then Exit EndFunc ;==>End  
×
×
  • Create New...