Jump to content
Sign in to follow this  
EmilyLove

[UDF] Rollbar Error Reporting v0.2

Recommended Posts

What is Rollbar?

Rollbar provides real-time error alerting & debugging tools for developers. Learn more about it at https://rollbar.com/product/

Demo: https://rollbar.com/demo/demo/

Screenshot:

Spoiler

image.thumb.png.5c26313057911c5004969e938536a51c.png

Instructions: (RollbarTest.au3)

; Include RollbarSDK
#include "RollbarSDK.au3"

;Turns on ConsoleWrite debugging override.
;Global $Rollbar_Debug=False

; Initialize RollbarSDK with the project's API key.
; Parameters ....:  $__Rollbar_sToken   - [Required] Go to https://rollbar.com/<User>/<ProjectName>/settings/access_tokens/ for your project. Use the token for post_server_item.
_Rollbar_Init("eaa8464a4082eeabd9454465b8f0c0af")

; Write code that causes an error you want to catch, then call

; _Rollbar_Send
; Parameters ....:  $__Rollbar_sErrorLevel      - [Required] Must be one of the following values: Debug, Info, Warning, Error, Critical.
;                   $__Rollbar_sMessage         - [Required] The message to be sent. This should contain any useful debugging info that will help you debug.
;                   $__Rollbar_sMessageSummary  - [Optional] A string that will be used as the title of the Item occurrences will be grouped into. Max length 255 characters. If omitted, Rollbar will determine this on the backend.
_Rollbar_Send("Debug", "This is an debug message. If you received this, you were successful!", "Debug Message")
_Rollbar_Send("Info", "This is a test message. If you received this, you were successful!", "Info Message")
_Rollbar_Send("Warning", "This is an warning message. If you received this, you were successful!", "Warning Message")
_Rollbar_Send("Error", "This is an error message. If you received this, you were successful!", "Error Message")
_Rollbar_Send("Critical", "This is an critical message. If you received this, you were successful!", "Critical Message")
_Rollbar_Send("Info", "This is a test message. If you received this, you were successful!") ;No Message

; Rollbar_Send's helper functions
; Parameters ....:  $__Rollbar_sMessage         - [Required] The message to be sent. This should contain any useful debugging info that will help you debug.
;                   $__Rollbar_sMessageSummary  - [Optional] A string that will be used as the title of the Item occurrences will be grouped into. Max length 255 characters. If omitted, Rollbar will determine this on the backend.
_Rollbar_SendDebug("This is an debug message. If you received this, you were successful!", "Debug Message")
_Rollbar_SendInfo("This is a test message. If you received this, you were successful!", "Info Message")
_Rollbar_SendWarning("This is an warning message. If you received this, you were successful!", "Warning Message")
_Rollbar_SendError("This is an error message. If you received this, you were successful!", "Error Message")
_Rollbar_SendCritical("This is an critical message. If you received this, you were successful!", "Critical Message")

; Usable Example
Local $sImportantFile = "C:\NOTAREALFILE_1234554321.txt"
Switch FileExists($sImportantFile)
    Case True
        MsgBox(0, "Example Script", "An important file was found. Continuing...")
    Case Else
        _Rollbar_SendCritical('An important file was missing. Halting... File: "' & $sImportantFile & '"', 'Important file "' & $sImportantFile & '" is missing.')
EndSwitch

Notes: Please comment your feedback, advice, & suggestions below. While this is only a proof of concept, I will expand its feature set for everyone to use. 

Right now, it is fully functional but not tested in production.

 

 

Changelog:

RollbarSDK.au3

RollbarTest.au3

v0.2

Spoiler

https://www.autoitscript.com/forum/topic/198704-rollbar/?do=findComment&comment=1427145

This update contains massive script breaking changes.

Added:

  • Multilingual support. See #CONSTANTS# section.
    Note: I won't be able to provide translations.

Changed/Fixed:

  • All functions and variables have been renamed to align with UDF best practices.

 

 

v0.1.1

Spoiler

https://www.autoitscript.com/forum/topic/198704-rollbar/?do=findComment&comment=1426743

This update contains script breaking changes. See RollbarInit (2 Parameters ==> 1)

Added:

  • Main Function: RollbarInit_Ask (Asks for user permission to send automatic bug reports, saves preference in ScriptName_Debug.ini) (For devs who respect user privacy)
  • Helper Function: Rollbar_CreateItem (same as RollbarCreateItem)
  • Helper Function: Rollbar_Send (same as RollbarCreateItem)
  • Helper Function: Rollbar_SendDebug (Rollbar_Send as Debug)
  • Helper Function: Rollbar_SendInfo (Rollbar_Send as Info)
  • Helper Function: Rollbar_SendWarning (Rollbar_Send as Warning)
  • Helper Function: Rollbar_SendError (Rollbar_Send as Error)
  • Helper Function: Rollbar_SendCritical (Rollbar_Send as Critical)
  • ConsoleWrite Debugging Override: $Rollbar_Debug = True / False

Changed/Fixed:

  • Split RollbarCreateItem into 2 functions: RollbarCreateItem & RollbarSendItem
  • ConsoleWrite Debugging is now Opt-In on compiled builds only. 
  • Decreased number of parameters for RollbarInit.
  • Cleaned up some comments
  • RollbarCreateItem & RollbarSendItem now properly sets a reasonably expectable return value (True when successful, False when failed)

Removed:

  • Removed optional write token.

 

Edited by BetaLeaf

 

 

Share this post


Link to post
Share on other sites

Thanks  for sharing.

Will look closer.

Edited by mLipok

Signature beginning:
Please remember: "AutoIt".....  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-03-17

Share this post


Link to post
Share on other sites
4 minutes ago, mLipok said:

Thanks  for sharing.

Will look closer.

Thanks for checking it out. Let me know what you think and what I can do to improve it.


 

 

Share this post


Link to post
Share on other sites

I like where this is going and I have some suggestions, which you don't have to agree with

  • Rename RollbarCreateItem to Rollbar_Send
    • I understand what you are trying to convey, by having the API item as part of the name, but "CreateItem" in this case is also sending data to Rollbar
  • Create help functions e.g.
    • Rollbar_SendDebug
    • Rollbar_SendInfo
    • ....
  • Writing to the console should be opt-in and not on by default, either by using a flag or by asking for a logging function
  • RollbarCreateItem is quite big, and can be broken down into smaller functions
  • Validation of the API token would be good

Keep it up!


UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_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: 22/04/2018

Share this post


Link to post
Share on other sites
5 hours ago, guinness said:

Validation of the API token would be good

How do you recommend I handle this when it fails? 

I feel that before a production release that the developer should make sure the API keys are working. You can already tell from ConsoleWrite messages if the key is working or not. I don't think it would be a good idea to let user's know API key is broken or even ask them to fill it in. This should all be handled by the developer. I don't even think it is a good idea to warn the user that API keys are invalid. Advice?


 

 

Share this post


Link to post
Share on other sites

Updated to v0.1.1

This update contains script breaking changes. See RollbarInit (2 Parameters ==> 1)

Added:

  • Main Function: RollbarInit_Ask (Asks for user permission to send automatic bug reports, saves preference in ScriptName_Debug.ini) (For devs who respect user privacy)
  • Helper Function: Rollbar_CreateItem (same as RollbarCreateItem)
  • Helper Function: Rollbar_Send (same as RollbarCreateItem)
  • Helper Function: Rollbar_SendDebug (Rollbar_Send as Debug)
  • Helper Function: Rollbar_SendInfo (Rollbar_Send as Info)
  • Helper Function: Rollbar_SendWarning (Rollbar_Send as Warning)
  • Helper Function: Rollbar_SendError (Rollbar_Send as Error)
  • Helper Function: Rollbar_SendCritical (Rollbar_Send as Critical)
  • ConsoleWrite Debugging Override: $Rollbar_Debug = True / False

Changed/Fixed:

  • Split RollbarCreateItem into 2 functions: RollbarCreateItem & RollbarSendItem
  • ConsoleWrite Debugging is now Opt-In on compiled builds only. 
  • Decreased number of parameters for RollbarInit.
  • Cleaned up some comments
  • RollbarCreateItem & RollbarSendItem now properly sets a reasonably expectable return value (True when successful, False when failed)

Removed:

  • Removed optional write token.
Edited by BetaLeaf

 

 

Share this post


Link to post
Share on other sites

Some suggestions:

- https://www.autoitscript.com/wiki/Best_coding_practices
- https://www.autoitscript.com/wiki/UDF-spec
- Remove AutoIt3Wrapper directives from UDF (even if just AU3Check; remove on release or add to RollbarTest.au3 instead).
- Replace .ini operations by a 2D array (set from function like _Rollbar_Set($iAttr, $nValue) ).
- Remove MsgBox() -calls and saving as .ini or move to separate function (so main script controls MsgBox(), .ini file path and choice to load or not; configuration, permission and GUI-notification being calling/including script's responsibility, UDF itself to be concerned with maintaining valid internal state only).
- Accept output from dedicated error logger function/UDF instead (or split into separate UDF's). Error loggers ideally enable registering custom functions on Exit, for COM Object errors, for custom date/time format and item output (console, file, Beep(), etc.), and auto-elevate level if @error (level error), if @extended (level debug), or if @exitCode (level critical/fatal), inclusion of @ScriptLineNumber, transparently passing @error/@extended, etc.; which (along with other error-logger's functionality) although necessary, seems out of scope for a Rollbar transmission UDF specifically.
- Rollbar_Send...() et al. seem redundant; single function could accept level parameter as int (using Enum instead of quoted str has SciTE suggest auto-completion too). Generally error level depends on outcome logged; naming functions after parameters introduces hard coded specificity as (unless used with Call() ) it's valid within pre-defined (foreseen) context only (specific If/Else branch for example).
- Hard coded text messages don't sit well with German, French, Russian, etc. AutoIt communities (of consideration if widespread adoption is a goal).

Share this post


Link to post
Share on other sites
On 5/5/2019 at 11:18 AM, user4157124 said:

Replace .ini operations by a 2D array (set from function like _Rollbar_Set($iAttr, $nValue) ).

Do you have a specific use case in mind? The only reason to set Ini is to save user preference rather or not they want to allow or disallow automatic bug reporting. I don't see a good reason to create a function just to set values once.

On 5/5/2019 at 11:18 AM, user4157124 said:

Remove MsgBox() -calls and saving as .ini or move to separate function (so main script controls MsgBox(), .ini file path and choice to load or not; configuration, permission and GUI-notification being calling/including script's responsibility, UDF itself to be concerned with maintaining valid internal state only).

Can you please be a bit clearer so I can better understand what you are requesting?

On 5/5/2019 at 11:18 AM, user4157124 said:

Accept output from dedicated error logger function/UDF instead (or split into separate UDF's). Error loggers ideally enable registering custom functions on Exit, for COM Object errors, for custom date/time format and item output (console, file, Beep(), etc.), and auto-elevate level if @error (level error), if @extended (level debug), or if @exitCode (level critical/fatal), inclusion of @ScriptLineNumber, transparently passing @error/@extended, etc.; which (along with other error-logger's functionality) although necessary, seems out of scope for a Rollbar transmission UDF specifically.

This is too jumbled for me to understand. Can you please be a bit clearer so I can better understand what you are requesting?

On 5/5/2019 at 11:18 AM, user4157124 said:

Rollbar_Send...() et al. seem redundant; single function could accept level parameter as int (using Enum instead of quoted str has SciTE suggest auto-completion too). Generally error level depends on outcome logged; naming functions after parameters introduces hard coded specificity as (unless used with Call() ) it's valid within pre-defined (foreseen) context only (specific If/Else branch for example).

[Rejected]  Rollbar_Send is redundant, however, as you said, "Generally error level depends on outcome logged". This allows devs to be more flexible.
[Rejected]  ErrorLevel must be a string, because Rollbar REST API expects a string. I cannot send as int.

On 5/5/2019 at 11:18 AM, user4157124 said:

https://www.autoitscript.com/wiki/Best_coding_practices
https://www.autoitscript.com/wiki/UDF-spec
Remove AutoIt3Wrapper directives from UDF (even if just AU3Check; remove on release or add to RollbarTest.au3 instead).
Hard coded text messages don't sit well with German, French, Russian, etc. AutoIt communities (of consideration if widespread adoption is a goal).

Done and coming soon in v0.2
 
@user4157124 If I misunderstood anything, please clarify by being clear and concise. 
Edited by BetaLeaf
Clarification

 

 

Share this post


Link to post
Share on other sites

I just updated my previous comment. I posted too early by accident (hotkey). If you are currently replying, please review the edits before submitting your comment.


 

 

Share this post


Link to post
Share on other sites

Updated to v0.2
Now aligned with UDF best practices!

This update contains massive script breaking changes.

Added:

  • Multilingual support. See #CONSTANTS# section.
    Note: I won't be able to provide translations.

Changed/Fixed:

  • All functions and variables have been renamed to align with UDF best practices.

 

RollbarSDK.au3 RollbarTest.au3


 

 

Share this post


Link to post
Share on other sites

"Do you have a specific use case in mind?"

UDF settings in general (the individual global vars). Including script should decide how to configure UDF (and where to get settings from). File path is hard-coded currently (location requires administrative rights to modify if used in compiled script installed to \Program Files\). Array enables setting options like:

Func Rollbar_Set($iAttr, $nValue)
$__g_aRollbar_Opt[$iAttr] = $nValue
...
EndFunc


"Can you please be a bit clearer so I can better understand what you are requesting?"

UDF accepts user choices and outputs information, but including script should control presentation (MsgBox(), GUI, etc.). Including this UDF to scripts compiled as console for example, forces display of GUI elements (mixes logic and presentation; scripts can't control its behavior).

"This is too jumbled for me to understand. Can you please be a bit clearer so ..."

Too concise probably. Error loggers require quite some functionality to be considered useful (but most of that seems out of scope for this UDF). Some users posted dedicated error logging UDF's; yours could take their output as input.

"This allows devs to be more flexible."

Design choice being (opinion based, current way is fine too):

Rollbar_SendWarning('Msg')
Rollbar_SendError('Msg')

or:

Rollbar_Send($ROLLBAR_LVL_WARNING, 'Msg')
Rollbar_Send($ROLLBAR_LVL_ERROR, 'Msg')


"... Rollbar REST API expects a string."

That's what UDF's are for (to make sure what gets input is output as required). Example (no out of bounds -check):

Func Rollbar_Send($iLevel, $sMsg = '')
Local $aLevel = ['trace', 'debug', 'info', 'warning', 'error', 'fatal']
Local $sLevel = $aLevel[$iLevel]
...
EndFunc


2D arrays are ideal for localization:

Enum $ROLLBAR_LANG_EN, $ROLLBAR_LANG_DE, ..., $ROLLBAR_LANG__ENUM
Enum $ROLLBAR_TEXT_TEST, ..., $ROLLBAR_TEXT__ENUM
Global $__g_aRollbar_Txt[$ROLLBAR_TEXT__ENUM][$ROLLBAR_LANG__ENUM]
$__g_aRollbar_Txt[$ROLLBAR_TEXT_TEST][$ROLLBAR_LANG_EN] = 'Example text.'
$__g_aRollbar_Txt[$ROLLBAR_TEXT_TEST][$ROLLBAR_LANG_DE] = 'Beispieltext.'

$g_iLang = $ROLLBAR_LANG_EN
MsgBox($MB_OK, @ScriptName, $__g_aRollbar_Txt[$ROLLBAR_TEXT_TEST][$g_iLang])

Edited by user4157124

Share this post


Link to post
Share on other sites

@user4157124 Thank you for clarifying. I'll work on it a bit later today or tomorrow. I spend all day working on v0.2 yesterday and I'm only one guy haha. I did have a few more questions.

You mentioned that my design decisions are opinion based. You have an opinion as well. I'd like to hear it. Get your perspective on things. Mind discussing this with me?

You also mentioned that I have a hard coded path. Which path are you talking about? I'm pretty sure the only file being written to is the SCRIPTNAMENOEXT_Debugging.ini and the only reason I write this file is to save user preference when _Rollbar_Init_Ask is used. Using _Rollbar_Init won't ask the user, which means no saved ini file, and force it on. I can't see your use case having any relevance here. Your set variables would be lost when the app is closed. Can you provide a use case for this?

I'm going to look up these error reporting UDFs you mentioned. Did you have any specific ones in mind?

Is there a best practices page for regarding localization in autoit? You are clearly more knowledgeable regarding this topic, so I'd like to take this opportunity to learn something new. 


 

 

Share this post


Link to post
Share on other sites

I meant my design suggestion is opinion based (function level name vs. level parameter). Seeing different settings (onoff/debug -state, file path, API key) I suggested formalization (set -function could do what _Init, _Init_Ask, $__G_Rollbar_bDebug and hard coded .ini file path do). Availability throughout runtime has no particular advantage to that specific option no. MsgBox() -choice and IniRead() is nice to have, but generally including script's responsibility.

The .ini file is referenced relative to @ScriptDir, so when C:\Program Files\MBP\MyBigProgram.exe (compiled AutoIt script having #include "RollbarSDK.au3") wants to let RollbarSDK do its IniWrite(), then MyBigProgram.exe needs admin rights (because @ScriptDir is a folder in C:\Program Files). That is the hard coded path (despite @ScriptDir being relative). It is distinct from @WorkingDir additionally (line 48).

I am not aware of documented localization best-practices for AutoIt (but wouldn't differ from other languages). Simply returning @error (not generating messages) enables including script to relate as required.
May be as simple as $sError = $aError[@error][$iLang] (if @error from _Rollbar_SendItem() is of Enum instead of HTTP code). Or as formal as separate text files (so changes require restart/reload rather than recompile). Also, StringFormat('HTTP Status %i - %s', $iCode, $sMsg) may save a few constants.

Error loggers :
https://www.autoitscript.com/forum/topic/195862-loga-a-logging-library/
https://www.autoitscript.com/forum/topic/195882-errorlogau3-udf-a-logging-library/

I use another (not sure how it compares, may release if anyone cares).

Share this post


Link to post
Share on other sites
3 hours ago, user4157124 said:

I use another (not sure how it compares, may release if anyone cares).

Would be nice to take a look...


Signature beginning:
Please remember: "AutoIt".....  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-03-17

Share this post


Link to post
Share on other sites

@user4157124
Both of those error loggers don't  seem to really offer anything different than what I already offer with Rollbar UDF. You can easily create a variable to hold the message and send it to both Rollbar UDF and your error logger of choice. 

5 hours ago, user4157124 said:

The .ini file is referenced relative to @ScriptDir, so when C:\Program Files\MBP\MyBigProgram.exe (compiled AutoIt script having #include "RollbarSDK.au3") wants to let RollbarSDK do its IniWrite(), then MyBigProgram.exe needs admin rights (because @ScriptDir is a folder in C:\Program Files). That is the hard coded path (despite @ScriptDir being relative). It is distinct from @WorkingDir additionally (line 48).

When you #Include "RollbarSDK.au3" and use _Rollbar_Init_Ask, then it will write to @ScriptDir. This ensures that the user preference for automatic reporting (either enabled or disabled) can always be found. @ScriptDir ensures that the ini file writes to the same directory as the program that included it. This has a couple of added benefits/protections: 

1) If you install your program to a protect folder that needs admin to read/write, then you should also probably protect the user preference. If you want to disable this, you can simply change the permissions (Windows ACL) of the ini file to allow Users or Everyone to read/write the file. This gives the end user a degree of control from limited users on their systems. (A guest account, maybe malicious, might find it a good idea to disable logging so they don't get reported, and a sysadmin might want to prevent this from happening) 
2) For multiple projects, this ensures that each program's preference is easily identifiable.
3) A badly written UDF that changes the working directory would cause unintended side effects when trying to save the user preference
(saving in the wrong directory, but shouldn't effect reading the file back in this case, just harder to find because it isn't where you expect it to be).
4) Prevents the end user from setting a different working directory (from a desktop shortcut, for example) and causing unintended side effects when trying to save the user preference.

5 hours ago, user4157124 said:

Also, StringFormat('HTTP Status %i - %s', $iCode, $sMsg) may save a few constants.

I didn't know about this. I'll take a look into this and implement it.

P.S. This was all meant to be a Proof-Of-Concept and not so much a UDF. It was my mistake to label it a UDF. I'm not super excited to continue working on this project and would rather work on the next project on my list. I will still continue to work on it, as long as there is interest and people make suggestions or requests. If I am too slow to get your request out, then the source code (RollbarSDK.au3) is there and anyone can continue my work under the MIT license. All I really care about is being credited for my work. Just include my name somewhere and we're good. My MIT License


 

 

Share this post


Link to post
Share on other sites

No need to rename (it's a UDF, good one too). And serves a purpose.

@WorkingDir was not a suggestion; line 48 describes @ScriptDir as "Working Directory". The predefined path isn't a problem (non asking function available too) but illustrates limitations introduced by a solution implemented on different level/scope than it affects.

@mLipok

Could do something like :

#AutoIt3Wrapper_AU3Check_Parameters=-q -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7
#include "auerlo.au3"
#include "RollbarSDK.au3"

Main()

Func Main()
    Local $aArray

    _AUERLO_Set($AUERLO_OPT_LOGSTD,     True)
    _AUERLO_Set($AUERLO_OPT_LVLSTD,     $AUERLO_LVL_ALL)
    _AUERLO_Set($AUERLO_OPT_LOGCUSTOM,  True)
    _AUERLO_Set($AUERLO_OPT_LVLCUSTOM,  $AUERLO_LVL_WARNING)
    _AUERLO_Set($AUERLO_OPT_FUNCCUSTOM, __AUERLO_OutputRollbar)
    _AUERLO_Set($AUERLO_OPT_FUNCEXIT,   Default)
    _AUERLO_Set($AUERLO_OPT_FUNCCOM,    Default)
    _AUERLO_Set($AUERLO_OPT_TIMEUTC,    True); Consistency on collective deployment.

    _Rollbar_Init('RollbarAPIkeyhere')
    _AUERLO_Log()

    For $i1 = $AUERLO_LVL_TRACE To $AUERLO_LVL_FATAL

        _AUERLO_Log('Message #' & $i1 + 1, $i1)

    Next

    _AUERLO_Read($aArray)
    _AUERLO_View($aArray)

;   Exit
EndFunc

Volatile Func __AUERLO_OutputRollbar($aData)
    Local       $aLvl[$AUERLO_LVL__ENUM]
                $aLvl[$AUERLO_LVL_TRACE]   = 'Debug'
                $aLvl[$AUERLO_LVL_DEBUG]   = 'Debug'
                $aLvl[$AUERLO_LVL_INFO]    = 'Info'
                $aLvl[$AUERLO_LVL_WARNING] = 'Warning'
                $aLvl[$AUERLO_LVL_ERROR]   = 'Error'
                $aLvl[$AUERLO_LVL_FATAL]   = 'Critical'
    Local Const $sLvl = $aLvl[ $aData[$AUERLO_ATR_LEVEL] ], _
                $sMsg = $aData[$AUERLO_ATR_DATETIME] & ($__g_aAUERLO_OptCur[$AUERLO_OPT_TIMEUTC] ? 'UTC' : 'loc') _
                      & $aData[$AUERLO_ATR_MESSAGE] ? ' - ' : '' _
                      & $aData[$AUERLO_ATR_MESSAGE], _
                $sCat = __AUERLO_GetTxtLevel($aData[$AUERLO_ATR_LEVEL]); Or other category -determining function.
    Local Const $iRet = _Rollbar_CreateItem($sLvl, $sMsg, $sCat)

;   _AUERLO_Log('_AUERLO_AuerloToRollbar()'); Infinite regress on _Rollbar_CreateItem() @error?

    Return SetError(@error, @extended, $iRet)
EndFunc

 

Edited by user4157124

Share this post


Link to post
Share on other sites
On 5/14/2019 at 11:25 AM, user4157124 said:

No need to rename (it's a UDF, good one too). And serves a purpose.

@WorkingDir was not a suggestion; line 48 describes @ScriptDir as "Working Directory". The predefined path isn't a problem (non asking function available too) but illustrates limitations introduced by a solution implemented on different level/scope than it affects.

On your suggestion, I renamed it back to UDF.

I see what you mean about line 48. This clarified my confusion. With my current level of understanding, I don't know how to get a running program's working directory. I use @scriptdir because it will always be the same folder as the rollbar enabled program. Since most programs usually have a working directory of the executable file, I figured it was good enough. If you know how to get a running program's working directory, please enlighten me.

Sorry for the late reply. I have been battling some crippling/suicidal depression. I had to step away from things and take care of myself for a bit. I'm good now though. 

 

If you have any suggestions or feedback for me, I'd be more than happy to tackle them.


 

 

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By JiBe
      Hi to all,
       
       
      I only am accustomed pas has posted on the forum (coz, I'm french). But I use it a lot.
      So first of all, thank you all to participate in the evolution of this wonderful product.
      Today is not one day like any other, I myself am decide has posted a UDF that I myself create and developed (there may be some bug) for some months.
      So here it is:
      This UDF allows to use the SSH protocol very easily in your code.
      It uses the syntax as the TCPxxx() function.
      Your code will be easier to convert :-).
       
      excused my English, I'm French.
       
      Example:
       
      #cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.4.0 Author: Joseph Barone 2010-2015 Script Function: Modele pour l'utilisation de la fonction ssh (plink). #ce ---------------------------------------------------------------------------- ; Script Start - Add your code below here #include #include #include #include #include #include "SSH_udf.au3" _SSHStartup() Global $butt[6] $Gui = GUICreate("SSH Console",550,400) $label1 = GUICtrlCreateLabel("Adresse IP:",10,10,150,20) ; ip $input1 = GUICtrlCreateInput("",10,25,150,20) ; ip $label2 = GUICtrlCreateLabel("Tcp port:",170,10,150,20) ; port $input2 = GUICtrlCreateInput("",170,25,60,20) ; port $label6 = GUICtrlCreateLabel("Protocol:",240,10,40,20) ; port $input6 = GUICtrlCreateInput("ssh",240,25,60,20) ; port $butt[0] = GUICtrlCreateButton("Connect0",310,5,80,20,$BS_DEFPUSHBUTTON) $butt[1] = GUICtrlCreateButton("Connect1",390,5,80,20) $butt[2] = GUICtrlCreateButton("Connect2",470,5,80,20) $butt[3] = GUICtrlCreateButton("Connect3",310,25,80,20) $butt[4] = GUICtrlCreateButton("Connect4",390,25,80,20) $butt[5] = GUICtrlCreateButton("Connect5",470,25,80,20) $Checkbox = GUICtrlCreateCheckbox("RSA, Fingerprint, Alert AutoValidate", 330, 45, 205, 25) $label4 = GUICtrlCreateLabel("Login:",10,45,150,20) ; login $input4 = GUICtrlCreateInput("",10,60,150,20) ; login $label5 = GUICtrlCreateLabel("Mot de passe:",170,45,150,20) ; password $input5 = GUICtrlCreateInput("",170,60,150,20,$ES_PASSWORD) ; password $label3 = GUICtrlCreateLabel("Commande a envoyer:",10,85,150,20) ; send command $input3 = GUICtrlCreateInput("",10,100,310,20) ; send commande vers l'hote $butt2 = GUICtrlCreateButton("Send",330,100,80,20,$BS_DEFPUSHBUTTON) GUICtrlSetState($butt2,$GUI_DISABLE) $edit = GUICtrlCreateEdit("",10,130,530,260,$WS_VSCROLL);,$WS_DISABLED)) GUISetState() Global $ConnectedSocket[6] = [-1,-1,-1,-1,-1,-1] Global $msg, $recv, $ret ; GUI Message Loop ;============================================== While 1 $nmsg = GUIGetMsg() If $nmsg = $GUI_EVENT_CLOSE Then ExitLoop ;;; connect part: $b = 0 While 1 If $nMsg = $butt[$b] Then If GUICtrlRead($butt[$b]) = "Connect"&$b Then _SSHParametreSet("yesall",GUICtrlRead($Checkbox)) _SSHParametreSet("protocol",GUICtrlRead($input6)) _SSHParametreSet("login",GUICtrlRead($input4)) _SSHParametreSet("passwd",GUICtrlRead($input5)) $ConnectedSocket[$b] = _SSHConnect(GUICtrlRead($input1),GUICtrlRead($input2)) If $ConnectedSocket[$b] = 0 Then MsgBox(0,"Erreur", "Impossible de ce connecter!!") Else GUICtrlSetData($butt[$b],"Close"&$b GUICtrlSetState($butt2,$GUI_ENABLE) EndIf DisplayArray($_config) ConsoleWrite("nb config:"&$_nbconf&@CRLF) Else _SSHCloseSocket($ConnectedSocket[$b]) GUICtrlSetData($butt[$b],"Connect"&$b GUICtrlSetState($butt2,$GUI_DISABLE) DisplayArray($_config) ConsoleWrite("nb config:"&$_nbconf&@CRLF) EndIf EndIf ;;; send part: If $nMsg = $butt2 Then $ret = _SSHSend( $ConnectedSocket[$b] , GUICtrlRead($input3)&@crlf) GUICtrlSetData($input3,"") GUICtrlSetState($input3,$GUI_FOCUS) EndIf ;;; receive part: $recv = _SSHRecv( $ConnectedSocket[$b]) If $recv <> "" Then GUICtrlSetData($edit, GUICtrlRead($edit) & $recv ) EndIf GUICtrlSendMsg($edit, $EM_SCROLL, $SB_PAGEDOWN, 0) $b += 1 If $b = UBound($butt) Then ExitLoop WEnd WEnd _SSHCloseSocket($ConnectedSocket) _SSHShutdown() Exit Func DisplayArray($array) $i = 0 $j = 0 if UBound($array,1) = 0 Then Return While 1 ConsoleWrite("(["&UBound($array,1)&"]["&UBound($array,2)&"]) ") While 1 ConsoleWrite("["&$j&"]"&$array[$i][$j]&" ") $j += 1 if UBound($array,2)<=$j Then ExitLoop WEnd ConsoleWrite(@CRLF) $i += 1 $j = 0 if UBound($array,1)<=$i Then ExitLoop WEnd EndFunc   
      I join with UDF version of modified putty myself.  🙂 LoL
      but, it is not used with the UDF, it is included in the UDF.
       
      putty-04012015- 92453+lic.zip
      ssh_udf.zip
      New version (contains the latest version of plink (0.74) edited by http://jakub.kotrla.net/putty/) 
      ssh_udf-v2.zip
      Same as the v2 but supports all putty/plink settings
      ssh_udf-v2.1.zip
    • By rcmaehl
      A UDF to connect to IRC using TCP Functions, as well as perform actions once connected.
      WANTED: Technical Writer able to create / maintain a helpfile (.chm) using the Autoit helpfile layout for an negotiated rate.

      Notes:
      Originally created by Chip.
      UDF Headers updated compared to old script.
      Error and Parameter Handling updated compared to old script.
      If you need to bypass the RFC compliance of this UDF, use _IRCRaw.
      The majority of the old functions have been modified. It will break most, if not all, scripts using the old UDF.
      These commands should work on every server following either RFC 1459 (legacy) or RFC 2812 (preferred).
       
      Potential Uses:
      IRC Chat Clients
      Chatroom Integration for software
      IRC Bots for Channel / Server Administration
      IRC Bots for Games such as Hangman, Mafia, and WereWolf
      Remote Administration without having to setup your own AutoIt server


      Functions:
      _IRCChannelInvite
      _IRCChannelJoin
      _IRCChannelKick
      _IRCChannelPart
      _IRCChannelTopic
      _IRCConnect
      _IRCDisconnect
      _IRCGetMsg
      _IRCMultiMode
      _IRCMultiSendMsg
      _IRCRaw
      _IRCSelfOper
      _IRCSelfSetNick
      _IRCSelfSetStatus
      _IRCServerPing
      _IRCServerPong
      _IRCServerTime
      _IRCServerVersion
       
      Extra Functions:
      _IRCReplyTo (IRCExtras.au3)
      _IRCStripSpecial (IRCExtras.au3)
       
      Downloads:
       
      Additional Links:
      Chips' Old UDF Topic:

       
      DISCLAIMER:
      While these downloads are more stable than the ones above, I do not have time to thoroughly test all functions and variable entries. If something doesn't work as expected or gives you an error please check @error and @extended variables then create a reply to this topic.

      Changelog:
      09/06/2016: IRC.au3 Fixed : Updated Headers to UDF-spec (- instead of =) _IRCGetMsg Fixed : Incorrect Return Value On Error _IRCStripSpecial Added : Better documentation of Flags _IRCMultiSendMsg Added : Better documentation of Flags _IRCMultiSendMsg Fixed : Max Message Size based on https://forums.unrealircd.org/viewtopic.php?t=6811 Updated all files to consider themselves a standalone install by default All Functions that didn't Return anything now return Number of bytes sent Slight Performance Improvements by using Parameter Gating instead of Single Input Single Output 07/21/2016: Example.au3 Fixed : Includes Example.au3 Renamed: IRC_Example.au3 IRC.au3 Changed: Minor Performance Improvements 04/18/2016: IRCConstants.au3 Updated: A Ton of New Constants added IRCMultiSendMsg Added : Color Example Increased TCP Timeout in all Examples 04/13/2016: CUI.au3 Updated: Errors now output to Error Stream in Console (C/G)UI.au3 Fixed : Userlists (FOR REAL THIS TIME) by being sure to get the current channel Removed: Duplicate Constants File Include Removed: Local Declaration inside of While loop for Performance Updated: TCPTimeout Increased Updated: $sTemp renamed $sStrip for Readibility Example.au3 Updated: TCPTimeout Increased GUI_Client.au3 Renamed: GUI.au3 _IRCStripSpecial Added : Parameter Checking Updated: Documentation _IRCMultiSendMsg Added : Additional flags for Message Type (POSSIBLY SCRIPT BREAKING if using $_bTrim!) Updated: Example to show new flags Updated: Increase Max Message Size from 368 To 436 04/09/2016: IRC.au3 Updated: All Documentation Added : Now has a Constaznts file _IRCConnnect Fixed : Now PROPERLY returns any errors _IRCGetMsg Removed: $_iChars parameter since it gets one packet at a time and parsing is easier _IRCReplyTo Fixed : Now properly returns username _IRCStripSpecial Added : Now uses Constants File All files are now in a single ZIP Includes 2 basic IRC "clients", a CUI, and a GUI 07/15/2015: Example.au3 Added : Improved Debugging   Updated: All Space Indents to Tab Idents   IRC.au3 Removed: Exception skipping @error = -1 in IRCGetMsg() as 3.3.14.0 fixed it 07/15/2015: Example.au3 Added : Ping Timeout Fixed : Userlist clipping of last user IRC.au3 Fixed : IRCGetMsg() Hang 07/08/2015: Example.au3 Fixed : User Lists   Fixed : Nickname now switches to backup nickname if first choice is already in use IRC.au3 Added : UDF Index Added : #include-once Updated: All Functions updated to Single Entry, Single Exit Updated: Now passes Au3Check on -q -d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w- 7 01/15/2015: Example.au3 Fixed : Ampersand channels causing a crash 12/20/2014: Example.au3 Fixed : Nicks not updating on all channel lists when a user changed their nick Fixed : Nicks not deleting on all channel lists when a user quits the network 12/19/2014: Example.au3 Added : User lists Added : Channel lists Added : Bot keeps track of own nick Added : Secondary nick in case first nick choice is in use. Added : Extremely Minor performance improvements _IRCConnect Added : Improved parameter checking _IRCGetMsg Updated: Now only retrieves one packet by default (MAY be script breaking) 10/14/2014: Example.au3 Added : Shutdown TCP on exit Fixed : $Recipient now gets the actual Recipient instead of the 3rd message Added : Now exits when told to quit. IRC.au3 Added : Improved Error Reporting (Includes @extended on error) _IRCDisconnect Added : Close Socket on Disconnect _IRCStripSpecial Added : Improved Color Stripping 09/28/2014: _IRCConnect Fixed : Checking if Mode was blank. _IRCGetMsg Fixed : Spamming of 0 and incorrectly thinking there was an error. 09/28/2014: IRC.au3 Fixed : All functions now return when errors are encountered instead of continuing _IRCConnect Added : Now returns an error if optional password failed to send _IRCGetMsg Added : Now returns an error if it failed to receive a custom amount of data _IRCServerVersion Fixed : Capitalized "Version" 09/26/2014: Example.au3 Fixed : Pings not ending with @CRLF IRCExtras.au3 Added : _IRCStripSpecial(), Cleans special characters sometimes seen in IRC 09/24/2014: Example.au3 Added : Checking for PrivMsg Fixed : Infinite loop if you removed _IRCDisconnect Updated: Bot now disconnects when receiving "!quit" instead of automatically Discontinuted BETA UDF project. 04/20/2014: IRCExtras.au3 Added : Additional IRC Functions _IRChangeNick Renamed: _IRCSelfSetNick (SCRIPT BREAKING! Fix: Replace _IRCChangeNick with _IRCSelfSetNick) _IRCGetMsg Fixed : Now no longer Splits Packets if Default option is used _IRCChannelInvite Added : Invites a User to a Channel _IRCChannelKick Added : Kick a User from a channel _IRCJoinChannel Renamed: _IRCChannelJoin (SCRIPT BREAKING! Fix: Replace _IRCJoinChannel with _IRCChannelJoin) _IRCMode Renamed: _IRCMultiMode (SCRIPT BREAKING! Fix: Replace _IRCMode with _IRCMultiMode) _IRCOper Renamed: _IRCSelfOper (SCRIPT BREAKING! Fix: Replace _IRCOper with _IRCSelfOper) _IRCPartChannel Renamed: _IRCChannelPart (SCRIPT BREAKING! Fix: Replace _IRCPartChannel with _IRCChannelPart) _IRCPing Renamed: _IRCServerPing (SCRIPT BREAKING! Fix: Replace _IRCPing with _IRCServerPing) _IRCPong Renamed: _IRCServerPong (SCRIPT BREAKING! Fix: Replace _IRCPong with _IRCServerPong) _IRCSelfSetStatus Added : Sets you AFK and un-AFK _IRCSendMessage Renamed: Renamed _IRCMultiSendMsg. (SCRIPT BREAKING Fix: Replace IRCSendMessage with IRCMultiSendMsg) _IRCSendMessageRaw Renamed: Renamed _IRCRaw (SCRIPT BREAKING! Fix: Replace _IRCSendMessageRaw with _IRCRaw) _IRCServerTime Added : Get time from a Server _IRCServerVersion Added : Get Software Version from a Server _IRCTopic Renamed: _IRCChannelTopic (SCRIPT BREAKING! Fix: Replace _IRCTopic with _IRCChannelTopic) Improved Parameter detection in all Functions Renamed Functions to show who/what they effect, MASSIVE Script Breaking. Sorry! :/ 04/06/2014: _IRCGetMsg Added : Use to get IRC Messages. _IRCSetTopic Changed: Now named _IRCTopic (SCRIPT BREAKING! Fix: Replace _IRCSetTopic with _IRCTopic) Changed: Can now be used to query topic and does so by default. Use "" to blank the topic All functions now thoroughly check their parameters Updated all functions to use @extended to some errors Fixed @error returning 0 by starting all errors at 1 instead of 0 03/20/2014: _IRCChangeMode Changed: Now named _IRCMode (SCRIPT BREAKING! Fix: Replace _IRCChangeMode with _IRCMode) Changed: $_sMode is now OPTIONAL. Allowing the command to be used to Query current mode as well _IRCConnect Fixed : Missing Colon Before $_sRealName. It should now allow Real Names with spaces _IRCDisconnect Fixed : Issue with Blank Messages. Should now properly blank to Default _IRCPing Changed: $_Server is now REQUIRED. (SCRIPT BREAKING! Fix: Specify a server as Parameter 2) _IRCSendMessage Added : $_bTrim, Trims message if too long instead of breaking up the message, Default is true _IRCSetTopic Added : Command for setting a Channel Topic Updated Most Functions to include better error checking Updated Most Channel Related Functions to check for valid channels 03/16/2014: _IRCChangeMode Added : Optional parameters for channel modes Changed: Parameter ordering Target is now before Mode (SCRIPT BREAKING! Fix: Swap Parameters 2 and 3) _IRCConnect Changed: No longer exits the script on error, instead returns TCPConnect Error Code _IRCJoinChannel Added : Now Supports Channel Passwords _IRCOper Added : Command for IRC Server Operator Login Updated All Functions to have UDF standard error codes 02/24/2014: _IRCSendMessage Changed: Split Into _IRCSendMessage and _IRCSendMessageRaw (SCRIPT BREAKING! No Simple Fix Available) 02/23/2014: Made variables comply to UDF Standards http://www.autoitscript.com/autoit3/udfs/UDF_Standards.htm Removed MsgBoxes left over from old UDF Updated / Uploaded IRC.au3 Known and Reported Bugs:
      Message output only displays ANSI characters in CUI. (Can't Fix) Freenode requires registration for part messages thus the part message in example doesn't show up (Can't fix) Messages (e.g. PRIVMSG) are not forwarded?, when it contains umlauts/german mutations and when the message only contains a dot '.' (Unconfirmed) Warnings:
      Do NOT send a lot of messages at once. MOST networks will disconnect you. SOME networks will permanently ban you. A MINORITY will harshly retailiate. Do NOT use the Sleep() function in your scripts. It prevents you from receiving any new data, can disconnect your from the network, and have other undesired consequences. Use the TimerInit() and TimerDiff() functions and possibly a message queue. To Do:
      Possibly add in SSL functionality Create More Functions for IRC commands An entire IRC daemon written in AutoIt Possibly Include Kips TCP UDF for ASync Port Listening in Example Create Additional UDFs for extras such as CTCP, DCC, and Error Lookup Experiment with having functions check for the reply and see if reliable. Upcoming Changes:
      To Be Decided Support:
      Support for this UDF can be obtained in my Discord Server
    • By mLipok
      A new quick/small UDF.
      #include-once #include <AutoItConstants.au3> #include <MsgBoxConstants.au3> Global $RUN_WRAPPER_PID Global Enum _ $RUNWRAPPER_ERR_SUCCESS, _ $RUNWRAPPER_ERR_GENERAL, _ $RUNWRAPPER_ERR_COUNTER Global Enum _ $RUNWRAPPER_EXT_DEFAULT, _ $RUNWRAPPER_EXT_NOT_FINISHED_YET, _ $RUNWRAPPER_EXT_COUNTER If Not @Compiled And @ScriptName = 'Run_Wrapper.au3' Then _Example_for_Run_Wrapper() Func _Example_for_Run_Wrapper() _Run_Wrapper('ping 8.8.8.8') If @error then Return SetError(@error, @extended, 0) While $RUN_WRAPPER_PID Sleep(10) _Run_Wrapper_GetStdout() If @error Then _Run_Wrapper_GetStderr() If @error Then ExitLoop EndIf WEnd MsgBox($MB_OK + $MB_TOPMOST + $MB_ICONINFORMATION, 'Information #' & @ScriptLineNumber, _ _Run_Wrapper_GetStdout() & @CRLF & _ _Run_Wrapper_GetStderr() _ ) EndFunc ;==>_Example_for_Run_Wrapper Func _Run_Wrapper($sCommand) _Run_Wrapper_GetStdout(Null) _Run_Wrapper_GetStderr(Null) $RUN_WRAPPER_PID = Run(@ComSpec & " /c " & $sCommand, @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) If @error Then Return SetError($RUNWRAPPER_ERR_GENERAL, $RUNWRAPPER_EXT_DEFAULT, 0) Return $RUN_WRAPPER_PID EndFunc ;==>_Run_Wrapper Func _Run_Wrapper_GetStdout($v_Reset = Default) Local Static $s_StdOut = "" If IsKeyword($v_Reset) And $v_Reset = Null Then $s_StdOut = '' $s_StdOut &= StdoutRead($RUN_WRAPPER_PID) If @error Then Return SetError(@error, $RUNWRAPPER_EXT_DEFAULT, $s_StdOut) Return SetExtended($RUNWRAPPER_EXT_NOT_FINISHED_YET, $s_StdOut) EndFunc ;==>_Run_Wrapper_GetStdout Func _Run_Wrapper_GetStderr($v_Reset = Default) Local Static $s_StdErr = '' If IsKeyword($v_Reset) And $v_Reset = Null Then $s_StdErr = '' $s_StdErr &= StderrRead($RUN_WRAPPER_PID) If @error Then Return SetError(@error, $RUNWRAPPER_EXT_DEFAULT, $s_StdErr) Return SetExtended($RUNWRAPPER_EXT_NOT_FINISHED_YET, $s_StdErr) EndFunc ;==>_Run_Wrapper_GetStderr  
       
    • By mLipok
      Yeasterday I found this:
      https://stackoverflow.com/questions/496751/base64-encode-string-in-vbscript
      https://www.motobit.com/tips/detpg_quoted-printable-encode/
      https://www.motobit.com/tips/detpg_quoted-printable-decode/
      Here is AutoIt Version:
      #Region - QuotedPrintableEncode_Binary ;~ https://www.motobit.com/tips/detpg_quoted-printable-encode/ ; This article contains a short function for quoted printable encoding, using CDO.Message object. ; You can use this function in ASP or .VBS files (wsh - windows scripting host files), or directly in VBA (visual basic 5, 6, Word, Excel, Access and Outlook scripting). ; A source data of this function is a String variable and charset parameter of destination data. ; The source string (16bit VBScript BSTR variable) is first converted to a destination charset, using ADODB.Stream (GetDecodedContentStream). ; If the destination charset is not specified, the ADODB.Stream uses "iso-8859-1" by default. ; The EncodedContentStream then converts the binary data to a Quoted-Printable output string. ; VBScript QuotedPrintable encoding ; 2005 Antonin Foller http://www.motobit.com ; $s_SourceString - string variable with source data, BSTR type ; $s_CharSet - $s_CharSet of the destination data Func _QuotedPrintable_Encode($s_SourceString, $s_CharSet) ;Create CDO.$oCDOMessage object For the encoding. Local $oCDOMessage = ObjCreate("CDO.Message") ; Set the encoding $oCDOMessage.BodyPart.ContentTransferEncoding = "quoted-printable" ; Get the data $oStream To write source string data ; As ADODB.$oStream Local $oStream = $oCDOMessage.BodyPart.GetDecodedContentStream ; Set the $s_CharSet For the destination data, If required If StringLen($s_CharSet) > 0 Then $oStream.CharSet = $s_CharSet ; Write the VBScript string To the $oStream. $oStream.WriteText($s_SourceString) ; Store the data To the $oCDOMessage BodyPart $oStream.Flush ; Get an encoded $oStream $oStream = $oCDOMessage.BodyPart.GetEncodedContentStream ; read the encoded data As a string Return $oStream.ReadText ; You can use Read method To get a binary data. ; $oStream.Type = 1 ; Return $oStream.Read EndFunc ;==>QuotedPrintableEncode ; Next is a binary variant of the function, with bytearray (VT_UI1 VT_ARRAY) as input and output. ; You can simply modify these two functions for combination of binary and string input and output parameters. ; This Func is used on Quoted-printable encoder online sample page. ; VBScript QuotedPrintableEncode_Binary encoding ; 2005 Antonin Foller http://www.motobit.com Func _QuotedPrintable_Encode_Binary($dSourceBinary) ; Create CDO.$oCDOMessage object For the encoding. Local $oCDOMessage = ObjCreate("CDO.Message") ; Set the encoding $oCDOMessage.BodyPart.ContentTransferEncoding = "quoted-printable" ; Get the data $oStream To write source string data ; As ADODB.$oStream Local $oStream = $oCDOMessage.BodyPart.GetDecodedContentStream ; Set the type of the $oStream To adTypeBinary. $oStream.Type = 1 ; Write the VBScript string To the $oStream. $oStream.Write($dSourceBinary) ; Store the data To the $oCDOMessage BodyPart $oStream.Flush ; Get an encoded $oStream $oStream = $oCDOMessage.BodyPart.GetEncodedContentStream ; Set the type of the $oStream To adTypeBinary. $oStream.Type = 1 ; You can use Read method To get a binary data. Return $oStream.Read EndFunc ;==>QuotedPrintableEncode_Binary #EndRegion - _QuotedPrintable_Encode_Binary #Region - _QuotedPrintable_Decode_Binary ;~ https://www.motobit.com/tips/detpg_quoted-printable-decode/ ; This article contains a short Func for quoted printable decoding, using CDO.Message object. ; You can use this Func in ASP or .VBS files (wsh - windows scripting host files), or directly in VBA (visual basic 5, 6, Word, Excel, Access and Outlook scripting). ; VBScript QuotedPrintableDecode decoding Function ; 2005 Antonin Foller http://www.motobit.com Func _QuotedPrintable_Decode($s_SourceData, $s_CharSet) ; Create CDO.Message object For the encoding. Local $oCDO_Message = ObjCreate("CDO.Message") ; Set the encoding $oCDO_Message.BodyPart.ContentTransferEncoding = "quoted-printable" ; Get the data $oStream To write source string data ; As ADODB.$oStream Local $oStream = $oCDO_Message.BodyPart.GetEncodedContentStream If VarGetType($s_SourceData) = 'String' Then ; Set $s_CharSet To base windows $s_CharSet $oStream.CharSet = "windows-1250" ; Write the VBScript string To the $oStream. $oStream.WriteText($s_SourceData) Else ; Set the type of the $oStream To adTypeBinary. $oStream.Type = 1 ; Write the source binary data To the $oStream. $oStream.Write($s_SourceData) EndIf ; Store the data To the $oCDO_Message BodyPart $oStream.Flush ; Get an encoded $oStream $oStream = $oCDO_Message.BodyPart.GetDecodedContentStream ; Set the type of the $oStream To adTypeBinary. $oStream.CharSet = $s_CharSet ; You can use Read method To get a binary data. Return $oStream.ReadText EndFunc ;==>_QuotedPrintable_Decode ; Next is a binary variant of the function, with bytearray (VT_UI1 VT_ARRAY) as output. ; The _QuotedPrintable_Decode_Binary then converts the binary data to a Quoted-Printable output string. ; Output of this Func are binary decoded data (you can use it, for example, as a data parameter of Response. ; BinaryWrite method) You can simply modify these two functions for combination of binary and string input and output parameters. ; This Func is used on Quoted-printable decoder online sample page. ; VBScript _QuotedPrintable_Decode_Binary decoding Function ; 2005 Antonin Foller http://www.motobit.com Func _QuotedPrintable_Decode_Binary($s_SourceData) ; Create CDO.Message object For the encoding. Local $oCDO_Message = ObjCreate("CDO.Message") ; Set the encoding $oCDO_Message.BodyPart.ContentTransferEncoding = "quoted-printable" ; Get the data $oStream To write source string data ; As ADODB.$oStream Local $oStream = $oCDO_Message.BodyPart.GetEncodedContentStream If VarGetType($s_SourceData) = 'String' Then ; Write the VBScript string To the $oStream. $oStream.Write($s_SourceData) Else ; Set the type of the $oStream To adTypeBinary. $oStream.Type = 1 ; Write the source binary data To the $oStream. $oStream.Write($s_SourceData) EndIf ; Store the data To the $oCDO_Message BodyPart $oStream.Flush ; Get an encoded $oStream $oStream = $oCDO_Message.BodyPart.GetDecodedContentStream ; Set the type of the $oStream To adTypeBinary. $oStream.Type = 1 ; You can use Read method To get a binary data. Return $oStream.Read EndFunc ;==>_QuotedPrintable_Decode_Binary #EndRegion - _QuotedPrintable_Decode_Binary  
      REMARK: License note from: https://www.motobit.com/tips/detpg_quoted-printable-decode/ and https://www.motobit.com/tips/detpg_quoted-printable-encode/:
       
    • By kurtykurtyboy
      GuiFlatButton is a UDF to easily create regular buttons with different colors for background, foreground, border, hover, focus, etc..
      This started as an effort to change the background color of a button and eventually grew into a full UDF.
      If you've looked around forums for changing button background colors, you have probably noticed that each proposed workaround has its own set of issues/side-effects. The answers usually circle back to 'use ownerdrawn buttons' and 'not worth it'. Well, now it is possible for anyone to easily create ownerdrawn buttons - totally worth it!
      Some issues with other workarounds such as drawing with GDI+ or using a colored label as a 'button':
      Not 'real' buttons so you lose built-in functionality that windows gives to buttons Messy / inefficient code in the main while loop to check for mouse position Slow to respond to click, paint, etc... Having to deal with GUIRegisterMsg messages Not straight-forward to implement GuiFlatButton is not a workaround; it is a technique to respond to Windows' built-in owner-drawn button events.
      With minimal effort, we can now create true simple colored buttons.
      The idea is to create an owner-drawn button using GUICtrlCreateButton then subclass the GUI and controls to handle the button-specific events to paint it however we want.
      This UDF magically does all of this for us! No need to worry about event handling or main while loop logic.
       
      How to use
      It couldn't be any easier! Simply create a new button using the familiar syntax. This creates an ownerdrawn button with default colors.
      $mybutton1 = GuiFlatButton_Create("Button 1", 78, 20, 120, 40) If you want to change the background and text colors:
      GuiFlatButton_SetBkColor(-1, 0x5555FF) GuiFlatButton_SetColor(-1, 0xFFFFFF) Advanced Usage
      Set background/text/border all at once
      GuiFlatButton_SetColors(-1, 0x0000FF, 0xFFFFFF, 0x9999FF) Set ALL colors for ALL button states! (normal, focus, hover, selected)
      Local $aColorsEx = [0x0000FF, 0xFFFFFF, -2, 0x4444FF, 0xFFFFFF, 0xAAAAFF, 0x6666FF, 0xFFFFFF, 0xCCCCFF, 0x0000EE, 0xFFFFFF, 0x7777EE] GuiFlatButton_SetColorsEx(-1, $aColorsEx) Set default colors to apply to any future buttons
      ;set colors GuiFlatButton_SetDefaultColors(0x0000FF, 0xFFFFFF, 0x9999FF) ;create buttons $mybutton1 = GuiFlatButton_Create("Button 1", 12, 20, 120, 40) $mybutton2 = GuiFlatButton_Create("Button 2", 143, 20, 120, 40) Set ALL color defaults
      ;set colors Local $aColorsEx = [0x0000FF, 0xFFFFFF, -2, 0x4444FF, 0xFFFFFF, 0xAAAAFF, 0x6666FF, 0xFFFFFF, 0xCCCCFF, 0x0000EE, 0xFFFFFF, 0x7777EE] GuiFlatButton_SetDefaultColorsEx($aColorsEx) ;create buttons $mybutton1 = GuiFlatButton_Create("Button 1", 12, 20, 120, 40) $mybutton2 = GuiFlatButton_Create("Button 2", 143, 20, 120, 40)  
      Available Functions
       
      Simple Example

      #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> #include "GuiFlatButton.au3" Example() ;GUI with one button Func Example() Local $hGUI, $mybutton1 $hGUI = GUICreate("GuiFlatButton Ex0", 275, 120) GUISetBkColor(0x333333) $idLabel = GUICtrlCreateLabel("Click the button", 10, 100, 150, 30) GUICtrlSetColor(-1, 0xFFFFFF) ;create new button then set the background and foreground colors $mybutton1 = GuiFlatButton_Create("Button 1", 78, 20, 120, 40) GuiFlatButton_SetBkColor(-1, 0x5555FF) GuiFlatButton_SetColor(-1, 0xFFFFFF) GUISetState(@SW_SHOW, $hGUI) Local $i = 0 Local $iMsg While 1 $iMsg = GUIGetMsg() Switch $iMsg Case $GUI_EVENT_CLOSE ExitLoop Case $mybutton1 $i += 1 GUICtrlSetData($idLabel, $i) ConsoleWrite($i & @CRLF) EndSwitch Sleep(10) WEnd GUIDelete() EndFunc ;==>Example
      Menu/Toolbar Example

      #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> #include "GuiFlatButton.au3" Example() ;Example GUI with toolbar Func Example() Local $hGUI, $idLabel, $aButtons, $iTbSize $hGUI = GUICreate("GuiFlatButton Ex2", 300, 200) GUISetBkColor(0x444444) $idLabel = GUICtrlCreateLabel("Click a button", 10, 180, 150, 30) GUICtrlSetColor(-1, 0xFFFFFF) $aButtons = createToolbar() $iTbSize = UBound($aButtons) GUISetState(@SW_SHOW, $hGUI) Local $i = 0 Local $iMsg While 1 $iMsg = GUIGetMsg() Switch $iMsg Case $GUI_EVENT_CLOSE ExitLoop Case $aButtons[0] To $aButtons[$iTbSize - 1] ConsoleWrite("1") GUICtrlSetData($idLabel, GuiFlatButton_Read($iMsg)) EndSwitch Sleep(10) WEnd GUIDelete() EndFunc ;==>Example Func createToolbar() Local $aButtons[6] Local $bkColor = 0x777777 Local $textColor = 0xFFFFFF Local $borderColor = 0x999999 Local $aBtnClrs[12] = [0x777777, 0xFFFFFF, $GUI_BKCOLOR_TRANSPARENT, 0x888888, 0xFFFFFF, $GUI_BKCOLOR_TRANSPARENT, 0x999999, 0xFFFFFF, $GUI_BKCOLOR_TRANSPARENT, 0x666666, 0xFFFFFF, $GUI_BKCOLOR_TRANSPARENT] For $i = 0 To UBound($aButtons) - 1 $aButtons[$i] = GuiFlatButton_Create("B" & $i, $i * 50, 0, 50, 17) GuiFlatButton_SetColorsEx($aButtons[$i], $aBtnClrs) Next Return $aButtons EndFunc ;==>createToolbar  
      Icon Example
      You can even easily add icons to your buttons -- just create a new button and send it an icon!

      #include <GDIPlus.au3> #include "GuiFlatButton.au3" Example() ;buttons with Icon images Func Example() ;get images for demonstration _GDIPlus_Startup() ;initialize GDI+ Local $hIcon = _WinAPI_ShellExtractIcon(@SystemDir & '\shell32.dll', 258, 24, 24) ;extract the 'Save' icon Local $hBitmap = _GDIPlus_BitmapCreateFromHICON($hIcon) ;Create Bitmap from Icon (for demonstration) Local $hHBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap) ;Create HBitmap from Bitmap _GDIPlus_BitmapDispose($hBitmap) ;dispose the bitmap _GDIPlus_Shutdown() ;done with GDI+ Local $hGUI = GUICreate("GuiFlatButton Ex5", 255, 400) GUISetBkColor(0xEEEEEE) ;set default colors of future buttons Local $aColorsEx = _ [0xE2E5E8, 0X000000, 0x888888, _ ; normal : Background, Text, Border 0xE2E5E8, 0X000000, 0x333333, _ ; focus : Background, Text, Border 0xE8E8E8, 0X000000, 0x666666, _ ; hover : Background, Text, Border 0xDDDDDD, 0X000000, 0xAAAAAA] ; selected : Background, Text, Border GuiFlatButton_SetDefaultColorsEx($aColorsEx) ;normal button with icon $label1 = GUICtrlCreateLabel( "$BS_TOOLBUTTON -->", 5, 10) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) Local $mybutton1 = GuiFlatButton_Create("Save", 130, 5, 50, 48, $BS_TOOLBUTTON) _WinAPI_DeleteObject(_SendMessage(GUICtrlGetHandle($mybutton1), $BM_SETIMAGE, $IMAGE_ICON, $hIcon)) ;align top Local $mybuttonT = GuiFlatButton_Create("Top", 5, 65, 120, 55, $BS_TOP) _WinAPI_DeleteObject(_SendMessage(GUICtrlGetHandle($mybuttonT), $BM_SETIMAGE, $IMAGE_ICON, $hIcon)) ;align top-left Local $mybuttonTL = GuiFlatButton_Create("Top-Left", 5, 125, 120, 55, BITOR($BS_TOP, $BS_LEFT)) _WinAPI_DeleteObject(_SendMessage(GUICtrlGetHandle($mybuttonTL), $BM_SETIMAGE, $IMAGE_ICON, $hIcon)) ;align top-right Local $mybuttonTR = GuiFlatButton_Create("Top-Right", 5, 185, 120, 55, BITOR($BS_TOP, $BS_RIGHT)) _WinAPI_DeleteObject(_SendMessage(GUICtrlGetHandle($mybuttonTR), $BM_SETIMAGE, $IMAGE_ICON, $hIcon)) ;align left Local $mybuttonL = GuiFlatButton_Create("Left", 5, 245, 120, 55, $BS_LEFT) _WinAPI_DeleteObject(_SendMessage(GUICtrlGetHandle($mybuttonL), $BM_SETIMAGE, $IMAGE_ICON, $hIcon)) ;align bottom Local $mybuttonB = GuiFlatButton_Create("Bottom", 130, 65, 120, 55, $BS_BOTTOM) _WinAPI_DeleteObject(_SendMessage(GUICtrlGetHandle($mybuttonB), $BM_SETIMAGE, $IMAGE_ICON, $hIcon)) ;align bottom-left Local $mybuttonBL = GuiFlatButton_Create("Bottom-Left", 130, 125, 120, 55, BITOR($BS_BOTTOM, $BS_LEFT)) _WinAPI_DeleteObject(_SendMessage(GUICtrlGetHandle($mybuttonBL), $BM_SETIMAGE, $IMAGE_ICON, $hIcon)) ;align bottom-right Local $mybuttonBR = GuiFlatButton_Create("Bottom-Right", 130, 185, 120, 55, BITOR($BS_BOTTOM, $BS_RIGHT)) _WinAPI_DeleteObject(_SendMessage(GUICtrlGetHandle($mybuttonBR), $BM_SETIMAGE, $IMAGE_ICON, $hIcon)) ;align right Local $mybuttonR = GuiFlatButton_Create("Right", 130, 245, 120, 55, $BS_RIGHT) _WinAPI_DeleteObject(_SendMessage(GUICtrlGetHandle($mybuttonR), $BM_SETIMAGE, $IMAGE_ICON, $hIcon)) GuiFlatButton_SetState($mybuttonR, $GUI_DISABLE ) ;disabled Local $mybuttonDisable = GuiFlatButton_Create("Disabled", 130, 310, 120, 55, $BS_TOOLBUTTON) _WinAPI_DeleteObject(_SendMessage(GUICtrlGetHandle($mybuttonDisable), $BM_SETIMAGE, $IMAGE_BITMAP, $hHBitmap)) GuiFlatButton_SetState($mybuttonDisable, $GUI_DISABLE ) ;clean up! _WinAPI_DestroyIcon( $hIcon ) _WinAPI_DeleteObject( $hHBitmap ) GUISetState(@SW_SHOW, $hGUI) Local $iMsg While 1 $iMsg = GUIGetMsg() Switch $iMsg Case $GUI_EVENT_CLOSE ExitLoop EndSwitch Sleep(10) WEnd GUIDelete() EndFunc ;==>Example  
      I'm sure there are some use-cases I've forgotten, so feedback is welcome!
       
      Download the latest UDF and several more examples: GuiFlatButton20210102.zip
      Update 2021-01-02
      Fixed bug, not drawing correctly after deleting GUI with GUIDelete()
      Fixed bug, changing default colors changed all buttons, even previously created buttons
      Made some internal functions more efficient
      Update 2019-04-14 GuiFlatButton_20190414.zip
      Fixed bug, not showing pressed down state when clicking rapidly
      Added Icon/Bitmap support!
      Added function GuiFlatButton_SetPos to change the position and/or size of a button
      Update 2019-02-09
      Added 2 new functions to set the button colors globally for all future buttons.
      GuiFlatButton_SetDefaultColors 
      GuiFlatButton_SetDefaultColorsEx

      Credits to:
      Melba23 (UDF template)
      LarsJ (general subclassing code)
      4ggr35510n (TrackMouseEvent example)
      binhnx (disable dragging with $WS_EX_CONTROLPARENT)
      GUIRegisterMsg in AutoIt Help (owner-draw button example)
      funkey (_WinAPI_DrawState example)
×
×
  • Create New...