Leaderboard
Popular Content
Showing content with the highest reputation on 06/29/2017 in all areas
-
Autoit-Socket-IO - Networking in AutoIt made simple!
Zmy reacted to tarretarretarre for a topic
Version 2.x.x and 3.x.x has been moved to branch 3.x About Autoit-Socket-IO Autoit-Socket-IO is a event driven TCP/IP wrapper heavily inspired from Socket.IO with focus on user friendliness and long term sustainability. I constantly want to make this UDF faster and better, so if you have any suggestions or questions (beginner and advanced) Do not hesitate to ask them, I will gladly help! Key features Simple API 99% data-type serialization thanks to Autoit-Serialize Can easily be extended with your own functionality thanks to Autoit-Events "Educational" examples Data encryption thanks to _<Crypt.au3> Limitations Speed. This UDF will sacrifice some speed for convenience Getting started Download the script from AutoIt or pull it from the official github repo git@github.com:tarreislam/Autoit-Socket-IO.git and checkout the tag 4.0.0-beta Check out the documentaion Take a look in the examples/ folder Changelog To see changes from 3.x.x and 2.x.x please checkout the 3.x branch Version 4.0.0-beta (This update break scripts.) Code base fully rewritten with Autoit-Events and decoupled to improve code quality and reduce bloat. The new UDF is very different from 3.x.x so please checkout the UPGRADE guide to fully understand all changes Added new documentation documentaion Success stories Since December 2017-now I have used version 1.5.0 in an production environment for 150+ clients with great success, the only downtime is planned windows updates and power outages. Newest version (2020-09-15!) Older versions (Not supported anymore) Autoit-Socket-IO-1.0.0.zip Autoit-Socket-IO-1.1.0.zip Autoit-Socket-IO-1.3.0.zip Autoit-Socket-IO-1.4.0.zip Autoit-Socket-IO-1.5.0.zip Autoit-Socket-IO-2.0.0.zip1 point -
Hi mates, well this is my first contribution. a simple UDF to use Virustotal API v2.0 The response return is not parsed|splitted. requires >WinHttp UDF Functions List: Update: Now a Only Function using a flags for respective mode. VT() Use respective flag($Type) VT(ByRef $aAPI, $Type, $sResource, $sAPIkey,$Comments="") flags($Type) $fReport = retrieve a scan report on a given file $fScan = submit a file for Scanning $fRescan = Rescan files in VirusTotal's file store $uReport = retrieve a scan report on a given URL $uScan = submit a URL for Scanning $Comment = Make a commnet on files and URLs Example: #include <Crypt.au3> #include "VT.au3" Example() Func Example() _Crypt_Startup() Local $sFilePath = @WindowsDir & "\Explorer.exe" Local $bHash = _Crypt_HashFile($sFilePath, $CALG_MD5) _Crypt_Shutdown() Local $hVirusTotal = VT_Open() Local $APIkey='Your API key' ConsoleWrite(VT($hVirusTotal, $fReport, '20c83c1c5d1289f177bc222d248dab261a62529b19352d7c0f965039168c0654',$APIkey) & @CRLF) ConsoleWrite(VT($hVirusTotal, $fScan, $sFilePath,$APIkey) & @CRLF) ConsoleWrite(VT($hVirusTotal, $fRescan, hex($bHash),$APIkey) & @CRLF) ConsoleWrite(VT($hVirusTotal, $uReport, "http://www.virustotal.com",$APIkey) & @CRLF) ConsoleWrite(VT($hVirusTotal, $uScan, "http://www.google.com",$APIkey) & @CRLF) ConsoleWrite(VT($hVirusTotal, $Comment, hex($bHash) ,$APIkey,"Hello Word | Hola Mundo") & @CRLF) VT_Close($hVirusTotal) ; EndFunc ;==>Example Saludos VT.au31 point
-
I'm not sure about what you want to achieve. If you want to name the new file according to the name of the original file, you could do it like this ; read file path from input $file = GUICtrlRead($Input1) If $file = "" Then ContinueLoop ; extract filename from full path (assuming that the file has no extension) $filename = StringRegExpReplace($file, '.+\\(.+)', "$1") ; some code here... ;..... ; open dest file in write/overwrite mode, creating path if doesn't exist ; using flag 10 = $FO_OVERWRITE (2) + $FO_CREATEPATH (8) $hFile = FileOpen("C:\Users\Public\Documents\BatchPlots\" & filename & "_new", 10) FileWrite($hFile, $out) FileClose($hFile)1 point
-
You would need something like this to close all open workbooks: #include <Excel.au3> Global $oExcel = _Excel_Open(False) ; Connect to Excel and remain invisible Global $aWorkbooks = _Excel_BookList($oExcel) ; Return a 2D array containing a list of open workbooks For $i = 0 To UBound($aWorkbooks, 1) - 1 ; Close all found workbooks _Excel_BookClose($aWorkbooks[$i][0], False) Next _Excel_Close($oExcel, Default, True) ; Close the Excel instance even when not created by the script1 point
-
count positions in comma delimited string of numbers
asiawatcher reacted to InunoTaishou for a topic
There are actually only two numbers between 5 and 67 #include <String.au3> Global $sString = "5,12,45,67,2,4,50,10,23" Global $sString2 = "Hello AutoIt forum! How's everyone doing today?" ConsoleWrite("Numbers between 5 and 67: " & CountBetween($sString, 5, 67) & @LF) ConsoleWrite("Words between the words 'Hello' and 'everyone': " & CountBetween($sString2, "Hello", "everyone", " ") & @LF) Func CountBetween(Const $sText, Const $sFirst, Const $sSecond, Const $sDelim = ",") ; Get the starting position of the first number Local $iStart = StartingPosition($sText, $sFirst, $sDelim) ; Error getting the first number, set error to 1 If (@Error) Then Return SetError(1, 0, "") Local $iEnd = StartingPosition($sText, $sSecond, $sDelim) ; Error getting the second number, set error to 2 If (@Error) Then Return SetError(2, 0, "") ; Do a RegExpReplace because it will store the number of times it replaces the delimiter in the @Extended macro StringRegExpReplace(StringMid($sText, $iStart, Abs($iStart - $iEnd)), $sDelim, "") ; Return the count ; Subtract one to account for the extra delimiter ; There's only 1 number between 5 and 45, but there are two commas (one on each side) Return @Extended - 1 EndFunc Func StartingPosition(Const $sText, Const $sSearch, Const $sDelim) ; Need the length of the delimiter Local $iDelimLength = StringLen($sDelim) ; Split the string, use the entire delimiter and don't have the count in the [0] element Local $aSplit = StringSplit($sText, $sDelim, $STR_ENTIRESPLIT + $STR_NOCOUNT) Local $iPosition = 1 For $i = 0 to UBound($aSplit) - 1 ; If this is the search, return the starting position of it If ($aSplit[$i] = $sSearch) Then Return $iPosition ; Increment position by the length of the string + the length of the delimiter $iPosition += StringLen($aSplit[$i]) + $iDelimLength Next ; Couldn't find it Return SetError(1, 0, 0) EndFunc As for the other thing, just split the string like I did in StartingPosition, find the first value, then add position you want to the index Local $aSplit = StringSplit($sText, $sDelim, $STR_ENTIRESPLIT + $STR_NOCOUNT) For $i = 0 to UBound($aSplit) - 1 If ($aSplit[$i] = Value to search for) Then Return $aSplit[$i + How many positions ahead?] Next1 point -
1 point
-
Work has progressed far enough, for me to feel happy creating an entry here, so GUIBuilder Project has been added to the first post in this topic. It is a work in progress, solely by me at this point, TheSaint, but based on CyberSlug's original ... and later versions, that were updates by Roy, TheSaint & others. I am dragging GuiBuilder, kicking & screaming, into the 2010's, to be reborn as GUIBuilder or even GUIBuilder Reborn perhaps. Providing all goes to plan of course. I have already fixed/improved a few issues, including upgrading 16 bit icons to 32 bit ones ... even if they do look a bit crappy now ... at least they work.1 point
-
A nice idea and UDF. May I provide some suggestions? ; Firstly, Global variables should be at the top a script and not in a function. ; Secondly, how about removing Global variables and doing something like this? Global Const $__sVirusTotal_Page = 'www.virustotal.com' Func Example() Local $hVirusTotal = VT_Open() ; Pass the 'handle' to the appropriate functions. ConsoleWrite(VT_Url_Scan($hVirusTotal, 'someurl.com', 'API') & @CRLF) VT_Close($hVirusTotal) ; Pass the 'handle' from $hVirusTotal. EndFunc ;==>Example Func VT_Open() ; Pass Local Enum $eAPI_HttpOpen, $eAPI_HttpConnect ; These could be in the Global space too. Local $aAPI[2] = [0, 0] $aAPI[$eAPI_HttpOpen] = _WinHttpOpen() If @error Then $aAPI[$eAPI_HttpOpen] = -1 $aAPI[$eAPI_HttpConnect] = _WinHttpConnect($aAPI[$eAPI_HttpOpen], $__sVirusTotal_Page) If @error Then $aAPI[$eAPI_HttpConnect] = -1 Return $aAPI EndFunc ;==>VT_Open Func VT_Close(ByRef Const $aAPI) Local Enum $eAPI_HttpOpen, $eAPI_HttpConnect ; These could be in the Global space too. _WinHttpCloseHandle($aAPI[$eAPI_HttpOpen]) _WinHttpCloseHandle($aAPI[$eAPI_HttpConnect]) Return True EndFunc ;==>VT_Close Func VT_Url_Scan(ByRef $aAPI, $sURL, $sAPIkey) Local Enum $eAPI_HttpOpen, $eAPI_HttpConnect ; These could be in the Global space too. If $aAPI[$eAPI_HttpConnect] = -1 Then $aAPI = VT_Open() ; Check if HttpConnect isn't -1, if it is then connect to VirusTotal. Return _WinHttpSimpleRequest($aAPI[$eAPI_HttpConnect], 'POST', '/vtapi/v2/url/scan', Default, 'url=' & $sURL & '&key=' & $sAPIkey) EndFunc ;==>VT_Url_Scan1 point