Leaderboard
Popular Content
Showing content with the highest reputation on 08/13/2017 in all areas
-
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 Server1 point
-
iamtheky you seem to be a powershell guy. I really love powershell. But must of time I prefer use it out of AutoIt. iamtheky We should talk more about powershell in the forum it really rocks. Saludos1 point
-
if your friend powershell is available: #include <AutoItConstants.au3> Local $sComputer = @ComputerName Local $sKeyname = '"\\' & $sComputer & '\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI" /REG:64' Local $sValuename = "LastLoggedOnUser" Local $sCmd = 'powershell $test = reg query ' & $sKeyname & ' /v ' & $sValuename & '; echo ' & '$test[2].substring(34)' Local $sOut, $hPid = Run($sCmd, "", @SW_HIDE, $STDERR_MERGED) Do $sOut &= StdoutRead($hPid) Until @error ConsoleWrite($sOut & @CRLF)1 point
-
Hmm. Using the findstr /r flag (to allow regex) it seems that this can be used only to do a check As Danyfirex suggested apparently you will have to regex the output ...1 point
-
Hello due to findstr only allows match(It will not extract the matched value) so you need to add something like this at the end. I'm not a RegExp genius. ConsoleWrite(StringRegExp($sOut,"\.\\.+$",1)[0] & @CRLF) between what's wrong with RegRead? Saludos1 point
-
WMI, Nice script!1 point
-
Hello! I have been busy with establishing the IRC Community for AutoIt... I thought that ##AutoIt needs a bot with lot of neat features, I made a simple one using @rcmaehl's UDF but it lacked many features which I wanted so I made a new UDF for myself lol. Features: Lightweight & Simple. Native support for logging. Full compliance with RFC 2812 and IRCv3.1. Fully tested. Ability to parse server messages. Open source and Unlicenced. Coded with Best Coding Practices in mind. Support for major IRC networks. SASL Authentication Supported! ..etc. Planned Features: Support for DCC and Direct P2P file transfer Colors More functions for Atheme services (NickServ, ChanServ etc.) ...etc. Download GitHub https://github.com/TheDcoder/IRC-UDF-for-AutoIt Enjoy! TD P.S I am newbie at GitHub so the repo might look weird1 point
-
Done Thanks again1 point
-
Hello. Welcome to AutoIt forum. Here is an implemetation that I've written for you. #include <Crypt.au3> #include <Base64.au3> #include <SHA224_256.au3> Global Const $CALG_SHA_512 = 0x0000800e #Region Kraken Const Global $g_sKrakenURL = "https://api.kraken.com" Global $g_sKrakenAPIVersion = "0" #EndRegion Kraken Const #Region keys Global Const $g_sAPIKey = "a8/dt1+Sjw6a8/OspaeKgTvQXjVGDa7MTwtkE8U85oJpX+OThqMjLcSf" ;you can use this for testing, it uses a test account Global Const $g_sAPISecret = "gmJASh6IR57seYYJE5z6qEU5sT7OBm+QPzDBp8/89OnaTNydM7rbsKo0hHbHAfMEW1zcPrN6EPDc0PD2hMEWyQ==" ;you can use this for testing, it uses a test account #EndRegion keys #Region API Test _TestAPI() Func _TestAPI() ;Query Public Local $sResult = KrakenQueryPublic("Time") ;Server Time ConsoleWrite("Time: " & $sResult & @CRLF & @CRLF) ;Query Private $sResult = KrakenQueryPrivate("TradeVolume", "&pair=XXBTZUSD,XXBTZEUR") ;Trade Volume ConsoleWrite("TradeVolume: " & $sResult & @CRLF & @CRLF) $sResult = KrakenQueryPrivate("Balance") ;Get Balance ConsoleWrite("Balance: " & $sResult & @CRLF & @CRLF) EndFunc ;==>_TestAPI #EndRegion API Test #Region Kraken Query Func KrakenQueryPublic($sMethod, $sParameters = "") Local $sURL = StringFormat("/%s/public/%s", $g_sKrakenAPIVersion, $sMethod) Local $oHTTP = ObjCreate("winhttp.winhttprequest.5.1") $oHTTP.Open("POST", $g_sKrakenURL & $sURL, False) $oHTTP.Send(Binary($sParameters)) Local $sReceived = $oHTTP.ResponseText Return $sReceived EndFunc ;==>KrakenQueryPublic Func KrakenQueryPrivate($sMethod, $sParameters = "") Local $sNONCE = _GetNonce() $sParameters = "nonce=" & $sNONCE & $sParameters Local $sURL = StringFormat("/%s/private/%s", $g_sKrakenAPIVersion, $sMethod) Local $sSecretDecoded = _Base64Decode($g_sAPISecret) Local $sNonceParams = $sNONCE & $sParameters Local $bURLBytes = Binary($sURL) Local $sHashNonceParams = _SHA256($sNonceParams) Local $bMessage = $bURLBytes & $sHashNonceParams Local $sSignature = HMACSHA512($sSecretDecoded, $bMessage) Local $oHTTP = ObjCreate("winhttp.winhttprequest.5.1") $oHTTP.Open("POST", $g_sKrakenURL & $sURL, False) $oHTTP.SetRequestHeader("API-Key", $g_sAPIKey) $oHTTP.SetRequestHeader("API-Sign", _Base64EncodeMod($sSignature)) $oHTTP.Send(Binary($sParameters)) Local $sReceived = $oHTTP.ResponseText Return $sReceived EndFunc ;==>KrakenQueryPrivate #EndRegion Kraken Query Func _GetNonce() ;~ Return @YEAR & @MON & @MDAY & @HOUR & @MIN & @SEC & @MSEC Return 9 & @YEAR & @MON & @MDAY & @HOUR & @MIN & @SEC & @MSEC ;added 9 at start due while testing I added a big nonce number > (@YEAR & @MON & @MDAY & @HOUR & @MIN & @SEC & @MSEC). With another APIkey Use line above (and comment this) EndFunc ;==>_GetNonce Func _Base64EncodeMod($sData) Return StringReplace(_Base64Encode($sData), @LF, "") EndFunc ;==>_Base64EncodeMod Func HMACSHA512($bKey, $bMessage) Local Const $iBlockSize = (512 / 8) Local Const $oconst = 0x5C, $iconst = 0x36 Local $a_opad[$iBlockSize], $a_ipad[$iBlockSize] Local $opad = Binary(''), $ipad = Binary('') If BinaryLen($bKey) > $iBlockSize Then $bKey = _Crypt_HashData($bKey, $CALG_SHA_512) For $i = 1 To BinaryLen($bKey) $a_ipad[$i - 1] = Number(BinaryMid($bKey, $i, 1)) $a_opad[$i - 1] = Number(BinaryMid($bKey, $i, 1)) Next For $i = 0 To $iBlockSize - 1 $a_opad[$i] = BitXOR($a_opad[$i], $oconst) $a_ipad[$i] = BitXOR($a_ipad[$i], $iconst) Next For $i = 0 To $iBlockSize - 1 $ipad &= Binary('0x' & Hex($a_ipad[$i], 2)) $opad &= Binary('0x' & Hex($a_opad[$i], 2)) Next Local $bRet = _Crypt_HashData($ipad & ($bMessage), $CALG_SHA_512) $bRet = _Crypt_HashData($opad & $bRet, $CALG_SHA_512) Return $bRet EndFunc ;==>HMACSHA512 Includes: Includes.zip Saludos1 point
-
I updated my script to include upload speeds and automatic active network card detection (based on getting part of the name of the active network card). The active network card detection will only work properly if only 1 network card is active when launched but you can adapt it for more network cards later if you understand how it works: #cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.14.2 Author: myName Script Function: Template AutoIt script. #ce ---------------------------------------------------------------------------- ; Script Start - Add your code below here #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1_1 = GUICreate("Network speed info", 467, 331, 192, 124) $Title = GUICtrlCreateLabel("Network speed info", 152, 16, 201, 28) GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif") $Label1 = GUICtrlCreateLabel("Real time download speed:", 16, 72, 386, 24) GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif") $Label2 = GUICtrlCreateLabel("Average download speed:", 16, 240, 392, 24) GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif") $Label3 = GUICtrlCreateLabel("Dont record if download <", 16, 152, 208, 24) GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif") $Label4 = GUICtrlCreateLabel("kB/s", 296, 152, 39, 24) GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif") $Input1 = GUICtrlCreateInput("450", 224, 152, 65, 24) GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") $Label5 = GUICtrlCreateLabel("Real time upload speed:", 16, 112, 394, 24) GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif") $Label6 = GUICtrlCreateLabel("Dont record if upload <", 16, 192, 208, 24) GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif") $Input2 = GUICtrlCreateInput("30", 224, 192, 65, 24) GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") $Label7 = GUICtrlCreateLabel("kB/s", 296, 192, 39, 24) GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif") $update = GUICtrlCreateButton("Update", 360, 168, 81, 33) GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") $Label8 = GUICtrlCreateLabel("Average upload speed:", 16, 280, 416, 24) GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### $objWMIService = ObjGet("winmgmts:\\localhost\root\CIMV2") ;detect the active network card $oSelect_active_network_cards = $objWMIService.ExecQuery('SELECT ProductName FROM Win32_NetworkAdapter WHERE NetConnectionStatus = 2 OR NetConnectionStatus = 9', "WQL") for $oSelect_active_network_card in $oSelect_active_network_cards $active_network_card = stringright($oSelect_active_network_card.ProductName, 10) ;get part of the name of the active network card Next $threshhold_download = 450 $threshhold_upload = 30 $average_download_speed = 0 $average_upload_speed = 0 While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $update $threshhold_download = Guictrlread($Input1) $threshhold_upload = Guictrlread($Input2) EndSwitch update_speeds() sleep(1) WEnd func update_speeds() ;get the download and upload speed $oNetwork_cards = $objWMIService.ExecQuery("SELECT BytesReceivedPerSec, BytesSentPerSec FROM Win32_PerfFormattedData_Tcpip_NetworkInterface WHERE name LIKE '%" & $active_network_card & "%'", "WQL") For $oNetwork_card In $oNetwork_cards $current_download_speed = Round($oNetwork_card.BytesReceivedPerSec / 1024) $current_upload_speed = Round($oNetwork_card.BytesSentPerSec / 1024) GUICtrlSetData($Label1, "Real time download speed: " & $current_download_speed & " kB/s") GUICtrlSetData($Label5, "Real time upload speed: " & $current_upload_speed & " kB/s") ;calculate the average download speed if $current_download_speed > $threshhold_download then $average_download_speed = Round(($current_download_speed + $average_download_speed) / 2) GUICtrlSetData($Label2, "Average download speed: " & $average_download_speed & " kB/s") EndIf ;calculate the average upload speed if $current_upload_speed > $threshhold_upload Then $average_upload_speed = Round(($current_upload_speed + $average_upload_speed) / 2) GUICtrlSetData($Label8, "Average upload speed: " & $average_upload_speed & " kB/s") EndIf Next EndFunc Using the method "ExecQuery" on a WMIService object returns a list of objects that match the query. To browse this list of objects you must use the above syntax, even if there is only 1 object in the list. Well at least that's how I know how to do it. There might be a better way but hey it's working anyway1 point
-
This is a great approach, the values are accurate, but my script still isn't, but this changed my way to look at this issue. I'll be working on this. Many thanks.1 point
-
Untested but should work #Include <Array.au3> #include <File.au3> $sFile = @ScriptDir & '\ForProcessFiles.log' $aFiles = FileReadToArray($sFile) For $i = UBound($aFiles)-1 to 0 step -1 If FileExists("D:\Programs\MyAutoIt\out\" & $aFiles[$i]) Then ; do something _ArrayDelete($aFiles, $i) Next ;_ArrayDisplay($aFiles) _FileWriteFromArray($sFile, $aFiles)1 point
-
GUICtrl_SetOnHover.zip (v2.1) https://mega.co.nz/#!c9o1iJaJ!JDSKxZMHR6rQm-1w5eAdKJNWqtlmDHyUtCbFoEbJEn41 point