Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 06/24/2019 in all areas

  1. Corollary of the First rule of a RegEx user: "be prepared to unexpected variations likely to suddenly appear in the string"
    2 points
  2. In this post I take the opportunity to show the awesome capabilities of AutoIt and its libraries. My open source project Peace is a long running AutoIt based app located on SourceForge. It provides users with a system-wide equalizer and effects machine. It's an interface using the power of Equalizer APO, an audio processing object software. Peace has been download over 2,600,000 times by various kind of users. Amongst others it gives them possibilities like these: Hearing impaired - Amplify the gain of frequencies which are impaired. Home Theatre - Create Equalizer presets for watching movies and listening to music. Music lovers & audiophiles - Create presets for listening to music on their high quality speakers and headphones. Gamers - Enhance frequencies to get an edge over other gamers. Headphones - Improve the sound quality of cheap headphones and get the max out of expensive ones. Bass lovers - Boost low frequencies for extra bass. Voice - Make a microphone sound better and improve the voice, for instance for YouTube usage. Low audio - Boost low audio of an input source to a comfortable level. This list covers the main needs of the Peace user. Many people have contacted me over the years asking for new features and telling me how they use Peace for their (sometimes specific) needs. I was able to use AutoIt and its libraries for all of their needs. So what are the main features of Peace? Equalize your computer audio by using up to 31 sliders. Support of equalizing 9 speakers : left/right, center, subwoofer, left/right rear, left/right side. Per slider a filter can be chosen such as peak, low/high pass, shelving. The graph windows shows your equalization so you see exactly what you're doing. Apply an effect such as crossfeed simple/Jan Meier/Chu Moy, stereo balance, bass/treble, upmix/downmix, channel routing. Save presets (called configurations) and activate by mouse click, hotkey, desktop shortcut or Peace system tray. Select a target device to equalize, microphone as input can also be equalized. Automate: you can let Peace automatically activate presets on a switch to another device and another process. Peace is available in these languages: English, Czech, Deutsch, Français, Italiano, Nederlands, Pусский, Українська So who am I? I'm a Dutch programmer who happens the stumble upon AutoIt 5 years ago and created a small Equalizer interface app of less than 400 program lines with it. Nowadays Peace has grown to more than 18,000 lines as many features were added. Although Peace is open source, the program code isn't of the best possible quality. The reason being that I didn't expect it to become so popular. It caught me by supprise. I've created a Library of functions called Pal (link to forum post) which quality is up to the AutoIt community standard as counterpart to the Peace program code. I want to state here that AutoIt is a mature program language as Peace obviously shows. I wish it to be used more extensively for professional or semi-professional apps. In my view AutoIt deserves a place amongst the major programming languages for Windows computers. Regards, Peter Verbeek
    1 point
  3. MySQL UDFs using libmysql.dll functions: most functions from MySQL API all are prefixed with an underscore: _MySql... e.g.: _MySQL_Real_Query( sometimes parameters are chaged - read function descriptions in include file MySQL.au3 If you do not need the power of these UDFs and you simple want to use basic SQL commands, then have a look at not included: MySQL_Connect - This function is deprecated. Use _MySQL_Real_Connect instead. MySQL_Create_DB - This function is deprecated. Use mysql_query() to issue an SQL CREATE DATABASE statement instead. MySQL_Drop_DB - This function is deprecated. Use mysql_query() to issue an SQL DROP DATABASE statement instead. MySQL_Escape_String - You should use _mysql_real_escape_string() instead! MySQL_Kill - This function is deprecated. Use mysql_real_query() to issue an SQL KILL statement instead mysql_library_end - Called by _MySQL_EndLibrary. mysql_library_init - Called by _MySQL_InitLibrary. I included a fallback-libmysql.dll: yoou can include libMySQLDLL.au3 and set $Use_EmbeddedDLL=True when calling _MySQL_InitLibrary an example for XAMPP / cdcol is also included in ZIP. #cs ---------------------------------------------------------------------------- AutoIt Version: 3.2.8.1 (beta) Author: Prog@ndy Script Function: MySQL-Plugin Demo Script #ce ---------------------------------------------------------------------------- #include <array.au3> #include "mysql.au3" ; MYSQL starten, DLL im PATH (enthält auch @ScriptDir), sont Pfad zur DLL angeben. DLL muss libmysql.dll heißen. _MySQL_InitLibrary() If @error Then Exit MsgBox(0, '', "could nit init MySQL") MsgBox(0, "DLL Version:",_MySQL_Get_Client_Version()&@CRLF& _MySQL_Get_Client_Info()) $MysqlConn = _MySQL_Init() ;Fehler Demo: MsgBox(0,"Error-demo","Error-Demo") $connected = _MySQL_Real_Connect($MysqlConn,"localhostdfdf","droot","","cdcol") If $connected = 0 Then $errno = _MySQL_errno($MysqlConn) MsgBox(0,"Error:",$errno & @LF & _MySQL_error($MysqlConn)) If $errno = $CR_UNKNOWN_HOST Then MsgBox(0,"Error:","$CR_UNKNOWN_HOST" & @LF & $CR_UNKNOWN_HOST) Endif ; XAMPP cdcol MsgBox(0, "XAMPP-Cdcol-demo", "XAMPP-Cdcol-demo") $connected = _MySQL_Real_Connect($MysqlConn, "localhost", "root", "", "cdcol") If $connected = 0 Then Exit MsgBox(16, 'Connection Error', _MySQL_Error($MysqlConn)) $query = "SELECT * FROM cds" $mysql_bool = _MySQL_Real_Query($MysqlConn, $query) If $mysql_bool = $MYSQL_SUCCESS Then MsgBox(0, '', "Query OK") Else $errno = _MySQL_errno($MysqlConn) MsgBox(0,"Error:",$errno & @LF & _MySQL_error($MysqlConn)) EndIf $res = _MySQL_Store_Result($MysqlConn) $fields = _MySQL_Num_Fields($res) $rows = _MySQL_Num_Rows($res) MsgBox(0, "", $rows & "-" & $fields) ; Access2 1 MsgBox(0, '', "Access method 1- manual") Dim $array[$rows][$fields] For $k = 1 To $rows $mysqlrow = _MySQL_Fetch_Row($res,$fields) $lenthsStruct = _MySQL_Fetch_Lengths($res) For $i = 1 To $fields $length = DllStructGetData($lenthsStruct, 1, $i) $fieldPtr = DllStructGetData($mysqlrow, 1, $i) $data = DllStructGetData(DllStructCreate("char[" & $length & "]", $fieldPtr), 1) $array[$k - 1][$i - 1] = $data Next Next _ArrayDisplay($array) ; Access 2 MsgBox(0, '', "Access method 2 - row for row") _MySQL_Data_Seek($res, 0) ; just reset the pointer to the beginning of the result set Do $row1 = _MySQL_Fetch_Row_StringArray($res) If @error Then ExitLoop _ArrayDisplay($row1) Until @error ; Access 3 MsgBox(0, '', "Access method 3 - read whole result in 2D-Array") $array = _MySQL_Fetch_Result_StringArray($res) _ArrayDisplay($array) ; fieldinfomation MsgBox(0, '', "Access fieldinformation") Dim $arFields[$fields][3] For $i = 0 To $fields - 1 $field = _MySQL_Fetch_Field_Direct($res, $i) $arFields[$i][0] = _MySQL_Field_ReadValue($field, "name") $arFields[$i][1] = _MySQL_Field_ReadValue($field, "table") $arFields[$i][2] = _MySQL_Field_ReadValue($field, "db") Next _ArrayDisplay($arFields) ; free result _MySQL_Free_Result($res) ; Close connection _MySQL_Close($MysqlConn) ; exit MYSQL _MySQL_EndLibrary() MySQL UDf Downloads: (including x86 and x64)</array.au3>
    1 point
  4. I have already published a lot of AutoIt UDF about algorithm, but all of them only support 32 bits or so called X86 system. Recently I got a computer with Windows 7 64 bits, so I finally added X64 support to most of my old projects. Besides, I also added some new. For example, some compression algorithm and SHA3 Candidates. Following are the algorithms list: Checksum CRC16 CRC32 ADLER32 Compression FastLZ LZF LZMA LZMAT MiniLZO QuickLZ Encode Base64 ARC4 XXTEA DES AES Hash Checksums (CRC16/CRC32/ADLER32) MD2 MD4 MD5 SHA1 SHA2 (SHA224/256/384/512) SHA3 Candidates BLAKE BMW (Blue Midnight Wish) CUBEHASH ECHO SHABAL SKEIN Some points to mention: All of the subroutines have one or more examples to demonstrate the usage. Since the function and usage of subroutine are easy to understand. A complete subroutines and parameters list are unavailability now. Sorry for my lazy. All of the subroutines here invoked by Lazycat's method (through CallWindowProc API). My MemoryDLL UDF is not necessary this time. Although MemoryFuncCall (part of MemoryDLL) is still good, but inevitably, it is slower than CallWindowProc. Some subroutines have the same name with my old machine code version UDF. But for some reason, I rearrange the position of the parameters. Please not mix up. If you notice, yes, checksums are duplicated. But they receive different parameters. One is the old style, and another use the same interface as other hashes. Choose what you like, but don't use them in the same time. Some algorithm already supported by the standard UDF "Encryption.au3". But I still provide them, because some system lack of the full support of Windows Crypt Library. If you are looking for only one hash algorithm, for example, used in encryption, I suggested "SHABAL_TINY.au3". Although it is a bit slower then SHABAL, but it is smaller, and it supports different size of output (from 32 to 512 bits).AutoIt Machine Code Algorithm Collection.zip
    1 point
  5. Hi guys! A pretty simple UDF to convert HTML to PDF using wkHTMLtoPDF. It uses the C API of the tool (DLL), so no external process, no ActiveX or COM sh*t. See the example, and the documentation of wkHTMLtoPDF. Cheers https://github.com/matwachich/wkhtmltopdf-au3
    1 point
  6. This is for mac address spoofing. Before a mod gives me the ban hammer for posting code such as this, id like to explain I recently had a necessity for it. A lot of places use mac addresses to identify devices/machines and control internet permissions. I myself love the xfinity wifi hotspots placed all around where I live as I can connect to them and save data usage instead of tethering my phone. BUT! They use a captive portal with a webpage interface in javascript and (not too much to my surprise), wifey says some of her crap wont open that page. I explained she can disable wifi on the device, use computer and spoof to the mac address of what she wants to use. Then sign into the portal as she would normally with computer. Once connected, shut the computer down and enable wifi for that device again. Once enabled shes got net access. edit: Wife looked at me like I was speaking latin.....lol ; ; ; Function: Set_Mac() ; ; Parameter(s): $s_Desired_Mac = Need I really explain? ; $s_Target_Net_Adapter = Network adapter name (one can use the adapter index as well but thats less "user friendly" ; $b_Toggle_Device = For my wife cuz it needs full automation for her to stop bothering me ; ; Author(s): KingOfNothing credz to google & autoitscript.com members ; ; ;===================================================================== Opt('MustDeclareVars', 0) ;cause its late in the morning and im just gonna trust this should still fly #include <WinApi.au3> $MacAddressRegKey = "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}\0007" ; ^^^ After making this I read online that this should be some "CurrentControlSet" ; key instead. However, I watched registry while changing things in adapter properties ; to see that key, which works fine on my 3 test machines.... ;easy example Set_Mac("Wireless Network Connection","",true) ;msgbox(0,"",Get_Mac()) Func Set_Mac($s_Targeted_Adapter, $s_Desired_Mac = "D20000000000", $b_Toggle_Device = true ) Local $sMac, $s_Tmp, $val, $sVar = "" $sMac = Get_Mac() while stringlen($s_Desired_Mac)< 12 and stringlen($s_Desired_Mac)> 0 ;this will append zeros if mac length is too short $s_Desired_Mac = $s_Desired_Mac & "0" wend if stringlen($s_Desired_Mac)> 12 then ;likewise if too many characters entered to function, then we should truincate some $s_Desired_Mac = StringLeft ($s_Desired_Mac,12) endif ;this creates a random mac address with very little actual thought behind it. ;Im sure theres some formal means to devising a valid mac address but this simple crap suits my needs atm.... if $s_Desired_Mac = "" then For $i = 1 To 10 $sVar= Chr(Random(48, 57, 1)) ;0-9 $s_Tmp = $s_Tmp & $sVar Next $s_Desired_Mac = "D2" & $s_Tmp $s_Desired_Mac = StringUpper($s_Desired_Mac) endif $val = RegWrite($MacAddressRegKey, "NetworkAddress", "REG_SZ", $s_Desired_Mac) if $val =0 then MsgBox(0,"Mac Address Changer ","Could not write to registry as needed to change your mac address!" & @CRLF & "Please restart this program with administrator rights!") Exit endif ;in order to benifit from changing the registry, one must disable/re-enable the adapter. ;This cmd line query to wmic prevents the need to do so in device manager manually if $b_Toggle_Device = true then ShellExecuteWait ("C:\Windows\System32\wbem\wmic.exe", "path win32_networkadapter where NetConnectionID=" & chr(34) & $s_Targeted_Adapter & chr(34) & " call disable" ,"",$SHEX_OPEN,@SW_HIDE) ShellExecuteWait ("C:\Windows\System32\wbem\wmic.exe","path win32_networkadapter where NetConnectionID=" & chr(34) & $s_Targeted_Adapter & chr(34) & " call enable" ,"",$SHEX_OPEN,@SW_HIDE) endif ;Would be smart to catch the return of the function there in some varible for error handling, but its too late for me to give a crap atm.... MsgBox(0,"Mac Address Changer", "Old Mac = " & $sMac & @crlf & "New Mac = " & $s_Desired_Mac) clipput($s_Desired_Mac) endfunc Func Get_Mac() Local $xRet $xRet= RegRead($MacAddressRegKey, "NetworkAddress") return $xRet EndFunc Sorry bout the messy penmenship. Aint looked at the tidy thing yet....🧐
    1 point
  7. Hehe it's better, and close to this one based on youtuber's pattern StringRegExpReplace($strString, '(?s).*?((?:\d{1,3}\.){3}\d{1,3})\s(\d{1,4}).*', '$1:$2')
    1 point
  8. @mikell #include <MsgBoxConstants.au3> #include <StringConstants.au3> Global $strString = '<div class="' & @CRLF & _ 'bla1234 5blablablabla Your IP Proxy blabla 127.0.0.1 8080 123A123' & @CRLF & _ '<\div>' MsgBox($MB_ICONINFORMATION, '', "Before: " & $strString & @CRLF & @CRLF & _ "After : " & StringRegExpReplace($strString, '(?s)(?:.*?)(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\s(\d+)(?:.*)', '$1:$2'))
    1 point
  9. Global $strString = '<div class="' & @CRLF & _ 'bla1234 5blablablabla Your IP Proxy blabla 127.0.0.1 8080 123A123' & @CRLF & _ '</div>'
    1 point
  10. @mikell First rule of a RegEx user: "Know your string". Since there were no \d before the wanted ones, I used [^\d]; indeed, a .*? can be used to avoid such problems: #include <MsgBoxConstants.au3> #include <StringConstants.au3> Global $strString = '<div class="' & @CRLF & _ 'blablablabla5 Your IP Proxy blabla 127.0.0.1 8080 123A123' & @CRLF & _ '</div>' MsgBox($MB_ICONINFORMATION, '', "Before: " & $strString & @CRLF & @CRLF & _ "After : " & StringRegExpReplace($strString, '(?s)(?:.*?)((?:\d{1,3}\.?){4})\s(\d+)(?:.*)', '$1:$2'))
    1 point
  11. Because youtuber posts a lot about regex, so I assume that he wants to learn regex, and it is a way to show that his own pattern is nearly good Of course there are many ways to skin this cat Edit BTW you might test your pattern against these strings Global $strString = '<div class="' & @CRLF & _ 'blablablabla5 Your IP Proxy blabla 127.0.0.1 8080 123A123' & @CRLF & _ '</div>' Global $strString = '<div class="' & @CRLF & _ 'blablablabla Your IP Proxy blabla 5555 127.0.0.1 8080 123A123' & @CRLF & _ '</div>'
    1 point
  12. Why don't you do something that is simpler and shorter? #include <MsgBoxConstants.au3> #include <StringConstants.au3> Global $strString = '<div class="' & @CRLF & _ 'blablablabla Your IP Proxy blabla 127.0.0.1 8080 123A123' & @CRLF & _ '</div>' MsgBox($MB_ICONINFORMATION, '', "Before: " & $strString & @CRLF & @CRLF & _ "After : " & StringRegExpReplace($strString, '(?s)(?:[^\d]*)((?:\d{1,3}\.?){4})\s(\d+)(?:.*)', '$1:$2'))
    1 point
  13. Your code was correct (one closing parenthesis to move only) $YourIPProx = '<div class="' & @CRLF & _ 'blablablabla Your IP Proxy blabla 127.0.0.1 8080 123A123' & @CRLF & _ '</div>' $regex = StringRegExp($YourIPProx, '((?:\d{1,3}\.){3}\d{1,3}\s\d{1,4})', 3) ; MsgBox(0, "", $regex[0]) If IsArray($regex) Then $IPProxy = StringReplace($regex[0], " ", ":") MsgBox(0, "", $IPProxy) EndIf
    1 point
  14. @youtuber Try this pattern directly with with your test string (<div>...</div>) in StringRegExpReplace() function: ; Test Pattern: '(?s)(?:.*?)(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\s(\d+)(?:.*)' ; Replace Pattern: '$1:$2' With this pattern and replace strings, you can do what you're trying to do in one shot
    1 point
  15. Not too hard to come up with something for this, How about: $regex = StringRegExp($YourIPProx, '(\d.*[.]\d+\s)(\d+)', 3) MsgBox(0, "", StringTrimRight($regex[0], 1) & ":" & $regex[1]) Deye
    1 point
  16. Hello. It seems to be an array of values. I wrote this example to illustrate it better. Local $tvarlist = DllStructCreate("ptr[3]") Local $sString="Croacia" Local $tstring = DllStructCreate("wchar string[" & StringLen($sString) +2 & "]") $tstring.String =$sString DllStructSetData($tvarlist, 1, 10, 1) DllStructSetData($tvarlist, 1, 1856, 2) DllStructSetData($tvarlist, 1, DllStructGetPtr($tstring), 3) Local $tOutput = DllStructCreate("wchar Value[1024]") Local $sString = "Nikola Tesla nació el %ld de julio de %ld en Smiljan, %s." Local $aCall = DllCall("User32.dll", "int", "wvsprintfW", "ptr", DllStructGetPtr($tOutput), "wstr", $sString, "ptr", DllStructGetPtr($tvarlist)) ConsoleWrite($tOutput.Value & @CRLF) Saludos
    1 point
  17. For example: Put your cursor on a variable and press Alt+d to a an Console Debug line for that variable. Do that for multiple things you like to get console debug information on. Press Alt+Shift+d to comment all these Debug lines. Press Alt+Ctrl+d to uncomment all these Debug lines again. Press Alt+Ctrl+z to Delete all these Debug lines again. (Wondering why I made that helpfile as it is all in there or this nifty Tools dropdown box which contain all of these functions) Jos
    1 point
  18. c.haslam, You are correct - I have amended the Help file. M23
    1 point
  19. Jon

    AutoIt Source Code

    The public source code for AutoIt can be found at http://www.autoitscript.com/autoit3/files/archive/autoit/ - look for a file called autoit-v3.n.n-src.exe The public version of the source code will be similar to the private/binary version but with some functionality removed. The source code is intended for those who wish to learn how AutoIt works and to contribute to its development. Please read the license that accompanies the source for more details and feel free to PM me or any member of the dev team with any questions. Here are the code submission guidelines: http://www.autoitscript.com/autoit3/files/...ission_spec.txt and an example: http://www.autoitscript.com/autoit3/files/...ion_example.txt
    1 point
×
×
  • Create New...