Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 11/07/2015 in all areas

  1. I built my own libcurl for AutoIt based on BinaryCall UDF. libcurl - the multiprotocol file transfer library The Features: Pure AutoIt script, no DLLs needed.Build with SSL/TLS and zlib support (without libidn, libiconv, libssh2).Full easy-interface and partial multi-interface support.Data can read from or write to autoit variables or files.Smaller code size (compare to most libcurl DLL).The version information of this build: Curl Version: libcurl/7.42.1SSL Version: mbedTLS/1.3.10Libz Version: 1.2.8Protocols: ftp,ftps,http,httpsHere are the helper functions (not include in libcurl library). Curl_DataWriteCallback()Curl_DataReadCallback()Curl_FileWriteCallback()Curl_FileReadCallback()Curl_Data_Put()Curl_Data_Get()Curl_Data_Cleanup()See the example script for detail usage. Curl.zip
    1 point
  2. I think you mean you don't know what all the script file is? You can still use the example I posted (Turn it into a function taking a binary string parameter and returning a broken up string) and parse the file one line at a time. Checking to see if in the current line you've parsed if there is a binary string in there (using StringInStr or some other way to find a binary string). If there is a binary string, break up the current line you're parsing and convert the binary string to a broken up string then piece it back together. I'll post an example later if no one else does.
    1 point
  3. You could use StringLeft, StringTrimLeft, and StringLen Get the length of the string, if it's >100 then use StringLeft to get the left most 100 characters and store them in a dynamic array (store it in the last element in the array, redim the array to add one to the size), and then StringTrimLeft the left most 100 characters #include <Array.au3> Local $binary_string = '0xC3BC394124742EC3BF2E2EE282AC402EE280B9C39646C692C3BA2E7CC398C3AB322EE280BA2E2E2E2EE280A6C39B742A6A2E6A2E6A2E6A2E2E45C3A050C3BFC397E280A6C380752EE280B94DC3BC394124742EC3BF2E2EE282AC402EE280B9C39646C692C3BA2E7CC39833C39B6A2E6A2E6A2E2E45C3A050C3BF2EC388E2809A402EC692C3B8C3BF74C2BDE280A6C38074542E4DC3A051C3BF2E2EE2809A402EC692C3842EE280A6C380752E2E55C3A052C3BF2EC384E2809A402E2E45C3A050C3BF2EC380E2809A402EE280B945C3A43D2E2E2E2E772E74CB86C692C3B82E74C6923DC2A02E2E2EC3AB2E3D2E2E2E2E2EE2809E71C3BFC3BFC3BFC2BB2E2E2E2E33C3B6C3A965C3BFC3BFC3BFE280B94DC3BCE280B92EE280B9422EC3BFC3905F5E33C3805BE280B9C3A55DC383C38CC38C55E280B9C3AC6AC3BF68C3B16D402E64C2A12E2E2E2E50C692C3AC5CC2A134C380402E33C385E280B045C3B0535657502E45C3B464C2A32E2E2E2E2E45C39050C3BF2E6CE2809A402E502E4DC38C33C3B651C2BB50E280A6402EE280B075C3BCC3A8272E2E2EC692C3842EC38645C3BC2EE280B945C390C692C380C3B02E502EC692C389C3BFC3B02EC3812E49E280A6C3892E2EE280B92EE280B92E50E280B9422EC3BFC390E280B94DC38C51C3BF2E30E2809A402EE280A6C3802EE2809EE2809E2E2E2E33C392C38745C3A82E2E2E2EE280B075C3A466E280B055C3942E45C394C38645C3BC2EE280B94DC38C5051C3BF2E5CE2809A402EC692C3842E2E4DC593C3BF2E58E2809A402EE280B075C2BCE280B075C380E280B075C384C2B32ECB865DC3BCC6927DC3A82EE280B94DC394732E2E4DC3942E55C39052C3A8C38E3D2E2E2E4DC2BC516878E280A6402E50C38645C3BC2EC3BF2E50E2809A402ECB865DC3BCE280B945C390C692C380C3B0C692C3842E2E502EC692C389C3BFC3B02EC3812E49E280A6C3892E2EE280B92EE280B92E50E280B9422EC3BFC390E280B94DC380E280B945C2BCE280B93DC2A4E282AC402E2BC388C381C3B92E33C39BE280A6C38974552E2ECB9CE280B92EE280B940C3B4C692C380C3BC2E4DC390C3A8C38B2E2E2EE280B975C39056C3BFC397E280B94DC2BCE280B92EE284A25650C3BF2E58E282AC402E2E46C3B02E502EC692C389C3BFC3B02EC3812E49E280A6C3892E2EE280B92EE280B92E50E280B9422EC3BFC390E280B94DC380E280B945C2BC2BC38843C381C3B92E3BC399722E33C3B6E280B955C38C52C3BFC397C38645C3BC2EE280B945C2BCE280B92EC3942E402E3BC3867442E280B94DC380E280B9C3B9E280B9C3B03BC381742F2EC2A4242E2E2E2EE280B92EC692C3A82E2E482EC692C38AC3BFC3B02EC3812E4AE280A6C3922E2EE280B92EE280B92E50E280B9422EC3BFC390C692C3862E3BC3B775C39BE280B945C2BC50C3BFC393C692C3842E33C3B62E4DC593E280B075C2BCE280B075C380E280B075C384C38645C3BC2EC3BF2E54E2809A402EC6927DC3A82E72' ; Each element stores 100 characters of the binary string Local $data[1] = [Null] ; Will hold the full string with the _ @CRLF characters at the en Local $new_string While (StringLen($binary_string) > 100) Local $100_char_string = StringLeft($binary_string, 100) $binary_string = StringTrimLeft($binary_string, 100) $data[Ubound($data) - 1] = $100_char_string ReDim $data[Ubound($data) + 1] WEnd ; If there still some data left in the binary string If (StringLen($binary_string)) Then $data[UBound($data) - 1] = $binary_string EndIf For $i = 0 to Ubound($data) - 1 $new_string &= "'" & $data[$i] & "'_" & @CRLF Next $new_string = StringTrimRight($new_string, 3) ClipPut($new_string) _ArrayDisplay($data)
    1 point
  4. boththose, To fit the exact OP's requirements your code should be slightly modified For $i = ubound($array) - 1 to 0 step - 1 If stringleft($array[$i], 2) <> "::" Then $array[$i] = "'" & $array[$i] & "' & _ ; " Else $array[$i + 1] = $array[$i + 1] & StringTrimLeft($array[$i], 2) _ArrayDelete($array , $i) EndIf Next Anyway your array method is probably more versatile than a one-liner regex if some adaptations are further needed for 'particular' cases
    1 point
  5. #include <Misc.au3> Local $hDLL = DllOpen("user32.dll") $iCounter = 0 While 1 If _IsPressed("01", $hDLL) Then $iCounter+=1 ConsoleWrite("_IsPressed - clicked." & @CRLF) ; Wait until key is released. While _IsPressed("01", $hDLL) WEnd ConsoleWrite("_IsPressed - click removed." & @CRLF) EndIf If $iCounter >=4 Then ExitLoop WEnd ConsoleWrite("done" & @CRLF)
    1 point
  6. @jdelaney Good idea here is my variation: #include <Date.au3> LoggingStart("Starting Script") Main() LoggingEnd("Ending Script") Func Main() LoggingStart(Main) Step2() LoggingEnd(Main) EndFunc ;==>Main Func Step2() LoggingStart(Step2) InternalOrInner() LoggingEnd(Step2) EndFunc ;==>Step2 Func InternalOrInner() LoggingStart(InternalOrInner) MsgBox(0, 'Test', @ScriptLineNumber) LoggingEnd(InternalOrInner) EndFunc ;==>InternalOrInner #Region Logging Functions Func LoggingStart($sCallersFuncName) __Logging('Starting', $sCallersFuncName, +1) EndFunc ;==>LoggingStart Func LoggingEnd($sCallersFuncName) __Logging('Ending', $sCallersFuncName, -1) EndFunc ;==>LoggingEnd Func __Logging($sCallersLog, $sCallersFuncName, $iIndentation) Local Static $iIndent_static = 0 If $iIndentation = +1 Then $iIndent_static += $iIndentation If IsFunc($sCallersFuncName) Then $sCallersFuncName = FuncName($sCallersFuncName) $sNow = _Now() ConsoleWrite(StringFormat("%-" & $iIndent_static + StringLen($sNow) + 1 & "s", $sNow) & $sCallersLog & ' > ' & $sCallersFuncName & " < " & @CRLF) If $iIndentation = -1 Then $iIndent_static += $iIndentation EndFunc ;==>__Logging #EndRegion Logging Functions
    1 point
  7. jdelaney

    Filesearching question

    #include <Array.au3> ; imagine this populated from _FileListToArray Local $a[5]=["w100","w50","w10000","w53","w66"] Local $temp[UBound($a)][2] For $i = 0 To UBound($temp)-1 $Temp[$i][0]=$a[$i] $Temp[$i][1]=Number(StringRegExpReplace($a[$i],"(w)","")) Next _ArraySort($Temp,0,0,0,1) ; repopulate...or just use Temp moving forward For $i = 0 To UBound($Temp)-1 $a[$i] = $Temp[$i][0] Next _ArrayDisplay($a)output: [0]|w50 [1]|w53 [2]|w66 [3]|w100 [4]|w10000 edit: oops, max to min would use this sort instead: _ArraySort($Temp,1,0,0,1) THAT output would be: [0]|w10000 [1]|w100 [2]|w66 [3]|w53 [4]|w50
    1 point
  8. For this kind of handling, which requires to be fast enough, I use an external program from the CoreUtils for Windows (http://gnuwin32.sourceforge.net/packages/coreutils.htm) : uniq.exe. This tool can quickly extract/remove duplicate lines in a text file. In your case, you just have to put the 2 file contents in 1 file and remove the duplicates (it requires the file to be sorted first) So, using the same idea than BrewManNH with _ArrayUniq, you can do something like this : #Include <Array.au3> Local $sMainFile = @ScriptDir & "\mainFile.txt" Local $sPartialFile = @ScriptDir & "\secondFile.txt" Local $sTempFile = @ScriptDir & "\tempFile.txt", $sResultFile = @ScriptDir & "\resultFile.txt" ; Concatenate the 2 files in 1 Local $sfile = FileWrite($sTempFile, FileRead($sMainFile) & FileRead($sPartialFile) ) ; Sort the file and then remove all duplicate lines RunWait(@ComSpec & ' /c sort "' & $sTempFile & '" | uniq -u > "' & $sResultFile & '"', "C:\Program Files (x86)\GnuWin32\bin", @SW_HIDE) FileDelete($sTempFile) Local $aResult = FileReadToArray($sResultFile) _ArrayDisplay($aResult) I know the problem is solved, but maybe someone else could be interested by this method...
    1 point
  9. A Friend told me about this. so I got interesting in. ¿Did you know I was able to play sound directly from link using soundplay? SoundPlay("http://www.freesfx.co.uk/rx2/mp3s/10/12598_1439008511.mp3",1) should help file talks about it? I work for me a least wit mp3 hot link. with wav it doesn't. Saludos
    1 point
×
×
  • Create New...