Jump to content
kurtykurtyboy

GuiFlatButton UDF : Change Colors of Regular Buttons

Recommended Posts

Looks great! Should be part of the default button creation. :P


Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Share this post


Link to post
Share on other sites

Impressive!   Thanks for this.

The only "improvement" that comes to mind is to add a two-button example that makes clear (by direct comparison) the capabilities of GuiFlatButton_SetColorsEx ... and maybe include a couple of commented-out alternative lines that show some of the more effective uses you've tested.

 

Share this post


Link to post
Share on other sites

In working with the UDF, I've settled on a default (my default) look for buttons that will work on many screens. As a test, I've edited the Button_Create function as follows:

;fill the array with the default values
    $aGuiFlatButton[$i][0] = $i
    $aGuiFlatButton[$i][4] = False
    $aGuiFlatButton[$i][5] = 13357056               ; bk color
    $aGuiFlatButton[$i][6] = 0x00000000             ; color of text
    $aGuiFlatButton[$i][17] = $sText
    For $j = 7 To 16
        $aGuiFlatButton[$i][$j] = -1
    Next

Should I be looking at a different method for this? Have you thought of adding some sort of SetTheme function that can predefine several of the settings prior to any Button_Create calls?

5c5bb8c5e31e1_DefaultButton.PNG.10d6eb4d7966c633e51c86473886a6ce.PNG

Edited by qwert

Share this post


Link to post
Share on other sites

Thanks for adding those.  I haven't had time to delve into the code, so can you spot the reason these two buttons come up with different colors?

In my simple way of thinking, the two create calls would use the same colors.

5c60b3b00b30c_Defaultcolortest.thumb.PNG.4a5da39e5ff2a19926665599390d7000.PNG

Share this post


Link to post
Share on other sites

Well, yes, I can see that now.

While you're still looking at this, can you tell me where the white border is coming from (on a hover), when I've set all the border colors to 0x000000?

5c619ca18a409_BorderDifference.PNG.e952a02078ff5abfcd8f430428482f5d.PNG

Share this post


Link to post
Share on other sites
Quote

I hope you don't mind

Not at all.  Thanks for keeping at it.  This is going to be a very useful UDF!  Styles and such on websites have led users to expect this sort of thing ... which Autoit scripts are now going to be able to deliver.

Share this post


Link to post
Share on other sites

First post updated.

Changes include:
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

Share this post


Link to post
Share on other sites
Quote

I specifically want to commend you for placing the file date in the file name. Most files are posted without any indication. (Worse, of course, is posting a later version down in the thread!)

I've lost count of the number of times I'd had to figure out which version of a zip or au3 was the latest.

Thanks for your good work. These are nice features.

 

Share this post


Link to post
Share on other sites

Hello,

I have two questions, 

Is there anyway to set and manipulate the text on buttons? (Font, size and position)

When it comes to icons on buttons, can I use an ico file (and can the position be set)? Does it only support icons? 
If you can give some examples, I would be grateful,

Thank you again for this beautiful work.

 

Share this post


Link to post
Share on other sites
On 4/15/2019 at 4:33 AM, kurtykurtyboy said:

First post updated.

Changes include:
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

Hello,

I have two questions, 

Is there anyway to set and manipulate the text on buttons? (Font, size and position)

When it comes to icons on buttons, can I use an ico file (and can the position be set)? Does it only support icons? 
If you can give some examples, I would be grateful,

Thank you again for this beautiful work.

Share this post


Link to post
Share on other sites

hi, i have a problem whit new button style after use GUIDelete() 

;-----------------------------------------------------
;#includes
#include-once
#include <MsgBoxConstants.au3>
#include <GuiFlatButton.au3>
;-----------------------------------------------------


_Main()


Func _Main()
    $GUI_Main = GUICreate("Main " & FileGetVersion(@ScriptFullPath), 200, 200, 10, 10, $WS_POPUPWINDOW)
    $BTN_Show_Page_2 = GuiFlatButton_Create("Show Page 2", 10, 10, 100, 38)
    Local $Param_1[12] = [0x0096a1, 0xFFFFFF, 0x0096a1, 0x0096a1, 0xFFFFFF, 0x0096a1, 0xE43D35, 0xFFFFFF, 0xE43D35, 0xFF3D35, 0xFFFFFF, 0xFF3D35]
    GuiFlatButton_SetColorsEx($BTN_Show_Page_2, $Param_1)
    GUISetState()
    While 1
        $iMsg_Main = GUIGetMsg()
        Select
            Case $iMsg_Main = $GUI_EVENT_CLOSE 
                Continueloop
            Case $iMsg_Main = $BTN_Show_Page_2
                GUIDelete()
                _Page_2()
                ExitLoop
        EndSelect
    WEnd
EndFunc


Func _Page_2()
    $GUI_HWNDPARENT2 = GUICreate("Page 2 " & FileGetVersion(@ScriptFullPath), 200, 200, 80, 80-1, $WS_POPUPWINDOW)
    $BTN_Exit = GuiFlatButton_Create("Exit", 10, 10, 100, 38)
    Local $Param_2[12] = [0x0096a1, 0xFFFFFF, 0x0096a1, 0x0096a1, 0xFFFFFF, 0x0096a1, 0xE43D35, 0xFFFFFF, 0xE43D35, 0xFF3D35, 0xFFFFFF, 0xFF3D35]
    GuiFlatButton_SetColorsEx($BTN_Exit, $Param_2)
    GUISetState()
    While 1
        $iMsg_Main = GUIGetMsg()
        Select
            Case $iMsg_Main = $GUI_EVENT_CLOSE 
                Continueloop
            Case $iMsg_Main = $BTN_Exit 
                Exit
        EndSelect
    WEnd
EndFunc

 

after show page 2 the new button style Loss of color !!!

i most use GUIDelete() and afterthat  open another form

what is the problem???

 

Share this post


Link to post
Share on other sites
5 hours ago, r2du-soft said:

hi, i have a problem whit new button style after use GUIDelete() 

;-----------------------------------------------------
;#includes
#include-once
#include <MsgBoxConstants.au3>
#include <GuiFlatButton.au3>
;-----------------------------------------------------


_Main()


Func _Main()
    $GUI_Main = GUICreate("Main " & FileGetVersion(@ScriptFullPath), 200, 200, 10, 10, $WS_POPUPWINDOW)
    $BTN_Show_Page_2 = GuiFlatButton_Create("Show Page 2", 10, 10, 100, 38)
    Local $Param_1[12] = [0x0096a1, 0xFFFFFF, 0x0096a1, 0x0096a1, 0xFFFFFF, 0x0096a1, 0xE43D35, 0xFFFFFF, 0xE43D35, 0xFF3D35, 0xFFFFFF, 0xFF3D35]
    GuiFlatButton_SetColorsEx($BTN_Show_Page_2, $Param_1)
    GUISetState()
    While 1
        $iMsg_Main = GUIGetMsg()
        Select
            Case $iMsg_Main = $GUI_EVENT_CLOSE 
                Continueloop
            Case $iMsg_Main = $BTN_Show_Page_2
                GUIDelete()
                _Page_2()
                ExitLoop
        EndSelect
    WEnd
EndFunc


Func _Page_2()
    $GUI_HWNDPARENT2 = GUICreate("Page 2 " & FileGetVersion(@ScriptFullPath), 200, 200, 80, 80-1, $WS_POPUPWINDOW)
    $BTN_Exit = GuiFlatButton_Create("Exit", 10, 10, 100, 38)
    Local $Param_2[12] = [0x0096a1, 0xFFFFFF, 0x0096a1, 0x0096a1, 0xFFFFFF, 0x0096a1, 0xE43D35, 0xFFFFFF, 0xE43D35, 0xFF3D35, 0xFFFFFF, 0xFF3D35]
    GuiFlatButton_SetColorsEx($BTN_Exit, $Param_2)
    GUISetState()
    While 1
        $iMsg_Main = GUIGetMsg()
        Select
            Case $iMsg_Main = $GUI_EVENT_CLOSE 
                Continueloop
            Case $iMsg_Main = $BTN_Exit 
                Exit
        EndSelect
    WEnd
EndFunc

 

after show page 2 the new button style Loss of color !!!

i most use GUIDelete() and afterthat  open another form

what is the problem???

 

also i use from GuiFlatButton_SetDefaultColorsEx but i need chage a button style blue and blue light and another button gree and red but all buttons set a style color like:

;-----------------------------------------------------
;#includes
#include-once
#include <MsgBoxConstants.au3>
#include <GuiFlatButton.au3>
;-----------------------------------------------------


_Main()

Func _Main()
    ;------------
    $GUI_Main = GUICreate("Main " & FileGetVersion(@ScriptFullPath), 200, 200, 10, 10, $WS_POPUPWINDOW)
    ;------------
    ;Green | Red
    Local $aColorsEx = _
    [0x0096a1, 0xFFFFFF, 0x0096a1, _    ; normal    : Background, Text, Border
     0x0096a1, 0xFFFFFF, 0x0096a1, _    ; focus     : Background, Text, Border
     0xE43D35, 0xFFFFFF, 0xE43D35, _    ; hover     : Background, Text, Border
     0xFF3D35, 0xFFFFFF, 0xFF3D35]      ; selected  : Background, Text, Border
    GuiFlatButton_SetDefaultColorsEx($aColorsEx)
    ;---
    $BTN_Show_Page_2 = GuiFlatButton_Create("Show Page 2", 10, 10, 100, 38)
    ;------------
    GUISetState()
    While 1
        $iMsg_Main = GUIGetMsg()
        Select
            Case $iMsg_Main = $GUI_EVENT_CLOSE 
                Continueloop
            Case $iMsg_Main = $BTN_Show_Page_2
                GUIDelete()
                _Page_2()
                ExitLoop
        EndSelect
    WEnd
EndFunc

Func _Page_2()

    $GUI_HWNDPARENT2 = GUICreate("Page 2 " & FileGetVersion(@ScriptFullPath), 200, 200, 80, 80-1, $WS_POPUPWINDOW)
    ;------------
    ;Green | Red
    Local $aColorsEx = _
    [0x0096a1, 0xFFFFFF, 0x0096a1, _    ; normal    : Background, Text, Border
     0x0096a1, 0xFFFFFF, 0x0096a1, _    ; focus     : Background, Text, Border
     0xE43D35, 0xFFFFFF, 0xE43D35, _    ; hover     : Background, Text, Border
     0xFF3D35, 0xFFFFFF, 0xFF3D35]      ; selected  : Background, Text, Border
    GuiFlatButton_SetDefaultColorsEx($aColorsEx)
    ;---
    $BTN_Back = GuiFlatButton_Create("Back", 10, 10, 100, 38,1)
    ;------------
    ;Blue | BlueLight
    Local $aColorsEx = _
    [0x4aa5d2, 0xFFFFFF, 0x4aa5d2, _    ; normal    : Background, Text, Border
     0x4aa5d2, 0xFFFFFF, 0x4aa5d2, _    ; focus     : Background, Text, Border
     0x4aa5d2, 0xFFFFFF, 0x4aa5d2, _    ; hover     : Background, Text, Border
     0x54aedb, 0xFFFFFF, 0x54aedb]      ; selected  : Background, Text, Border
    GuiFlatButton_SetDefaultColorsEx($aColorsEx)
    ;---
    $BTN_Exit_2 = GuiFlatButton_Create("Exit 2", 20, 60, 100, 38,1)
    ;------------
    GUISetState()
    While 1
        $iMsg_Main = GUIGetMsg()
        Select
            Case $iMsg_Main = $GUI_EVENT_CLOSE 
                Continueloop
            Case $iMsg_Main = $BTN_Back
                GUIDelete()
                _Main()
                MsgBox(0, "", "END 1")
                ExitLoop
            Case $iMsg_Main = $BTN_Exit_2
                Exit
        EndSelect
    WEnd
EndFunc

 

how  can fix this?

Share this post


Link to post
Share on other sites

@kurtykurtyboy

Greate UDF, thank you!

I have found some minor flaws:

"D:\_\AUTOIT\Include\kurtykurtyboy\GuiFlatButton_20210102\GuiFlatButton.au3" (152) : ==> Variable used without being declared.:
$buttonID = GUICtrlCreateButton("", 0, 0, $w, $h)
^ ERROR

"D:\_\AUTOIT\Include\kurtykurtyboy\GuiFlatButton_20210102\GuiFlatButton.au3" (157) : ==> Variable used without being declared.:
$idIndex = GuiFlatButton_FindControlId($buttonID)
^ ERROR

"D:\_\AUTOIT\Include\kurtykurtyboy\GuiFlatButton_20210102\GuiFlatButton.au3" (181) : ==> Variable used without being declared.:
$aColors = $aGuiFlatButton[0][3]
^ ERROR

... if using Opt("MustDeclareVars", 1) .

Would be great if you could fix it.

Share this post


Link to post
Share on other sites

@kurtykurtyboy

I hope it's not too late to add to this thread, but I've encountered a problem using flat buttons that I just can't get a handle on.

Under some circumstances, the flat buttons disappear from the GUI I'm using them on. (Minimizing and restoring the GUI doesn't being them back.)

It's so rare that I haven't been able to isolate a cause. (I suspect it might be related to my use of SplashTextOn windows as overlays.) And the flat buttons work fine, up until they go away. Once they're gone, they're completely gone ... hovering ... tooltips ... everything.

MSDN has a detailed description of window type here ... but it's hard to follow how all the variations might interact.

So my questions are: 1) should my main GUI be created as a Layered window? and 2) are flat buttons considered Child windows?

Those answers will help me decipher what might be happening.

Thanks in advance for help.

Share this post


Link to post
Share on other sites
Posted (edited)
On 4/22/2021 at 7:00 PM, qwert said:

@kurtykurtyboy

I hope it's not too late to add to this thread, but I've encountered a problem using flat buttons that I just can't get a handle on.

Under some circumstances, the flat buttons disappear from the GUI I'm using them on. (Minimizing and restoring the GUI doesn't being them back.)

It's so rare that I haven't been able to isolate a cause. (I suspect it might be related to my use of SplashTextOn windows as overlays.) And the flat buttons work fine, up until they go away. Once they're gone, they're completely gone ... hovering ... tooltips ... everything.

MSDN has a detailed description of window type here ... but it's hard to follow how all the variations might interact.

So my questions are: 1) should my main GUI be created as a Layered window? and 2) are flat buttons considered Child windows?

Those answers will help me decipher what might be happening.

Thanks in advance for help.

 

I have same problem With GuiFlatButton in MetroGUI or Layerd Windows 

Edited by Parsix

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 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 mLipok
      This UDF was created for give any/some kind of support for GDPR solutions in AutoIt.
      This is a modest attempt at implementation.
       
      More details in support topic:
       
×
×
  • Create New...