Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 02/14/2016 in all areas

  1. jpm

    AU4 Library

    Why not to name it AU3++
    2 points
  2. Hi guys, I often need zipping\unzipping function within my scripts, so I've decided to do a systematic research about it to understand which options I had. I'm sharing with you these results because I think it can save some time to somobody Autoit coders produced much material from 2005 till now, most of it consists of UDF wrappers of 3rd parts libraries, but there are some exception. Let's start: ZIP from scratch UDF: written by joakim. You can retrieve some info from a zip file, but it is just a PoC script, as I can see. LZ UDF: written by trancexx: another exception. It use native windows compression, so it doesn't need anything. It can work with memory, it doesn't work with files. LZMA UDF: written by Ward. He writes a dll which can be directly included or can be embedded within an au3 file. It can work with memory, it doesn't work with files. [it needs LZMA.dll or LZMA.dll.au3](link missing) Package UDF: written by Yashied. It is useful for dealing with package (.pkr) file. ZIP UDF: written by Wraithdu (yet torels UDF): the exception! Based on zipfldr.dll, a native library of Windows, so it does not need to include an external library into the script. It is its strenght, but its weak point too: if zipfldr.dll is corrupted or is missing, your script will not do what you expect. gZip UDF: written by Zinthose. Based on the parsing of gZip.exe output. It can work with memory, it doesn't work with files. [it needs gZip.exe] ZLib UDF: written by monoceres. Based on ZLib.dll. It can compress\uncompress data in memory, it doesn't work with files. [it needs ZLib.dll] pZip UDF: written by asdf8. Based on ZLib.dll. It can extract\add\overwrite file into archives. [it needs pZip.dll] ZLib and gZip UDF: written by Ward. Based on ZLib.dll but it does not need the dll file, because it is written directly in the UDF! It can compress\uncompress data in memory, and it can work with files. It works with gZip format too. (link missing) XZip UDF: written by eltorro, KXM and erifash. Based on XZip.dll, a COM dll. [it needs XZip.dll] XZip UDF: written by mLipok. Based on XZip.dll, a COM dll. A more complete alternative to previous UDF. [it needs XZip.dll] unRAR UDF: written by rasim. Based on unRAR.dll. You can just uncompress rar files with this one (the only method for new v5 RAR files). [it needs unRAR.dll] Parsing unRAR.exe output: you can just uncompress rar files in this way (the only method for new v5 RAR files). [it needs unRAR.exe] 7Zip: I spent a lot of time with it, because I think it is the most useful, there are different approaches: Parsing 7za.exe output, it is the simplest (and in my opinion the best) way, some UDFs can help with it, as jennico UDF (thanks to Screen Scrape script by Valik, it seems it doesn't work in Windows 10) [it needs 7za.exe] Using 3rd part dll, as rasim UDF (yet jak UDF). He rewrites a dll which can be simply invoked by his UDF [it needs 7-zip32.dll and\or 7-zip64.dll]. With Decipher UDF you doesn't need to include the dll in your project, because it is compiled into the script and loaded in memory directly at runtime. Invoking 7za.dll. This is the most complicated approach because the library doesn't use standard COM interfaces. Anyway dany, Starg, milky, trancexx, Mugen and finally Biatu had spent some time with it and they reach a sort of partial result. [it needs 7za.dll] Comment here to add suggestions\links\UDF I forgot and I'll update this post with them!
    1 point
  3. mLipok

    CrowdinAPI UDF

    Thanks @trancexx Some searching and I found this: http://lists.alioth.debian.org/pipermail/pkg-mozext-commits/2014-July/005861.html https://github.com/EFForg/trackerlab/blob/master/buildtools/localeTools.py def postFiles(files, url): boundary = '----------ThIs_Is_tHe_bouNdaRY_$' body = '' for file, data in files: body += '--%s\r\n' % boundary body += 'Content-Disposition: form-data; name="files[%s]"; filename="%s"\r\n' % (file, file) body += 'Content-Type: application/octet-stream\r\n' body += 'Content-Transfer-Encoding: binary\r\n' body += '\r\n' + data + '\r\n' body += '--%s--\r\n' % boundary body = body.encode('utf-8') request = urllib2.Request(url, StringIO(body)) request.add_header('Content-Type', 'multipart/form-data; boundary=%s' % boundary) request.add_header('Content-Length', len(body)) result = urllib2.urlopen(request).read() if result.find('<success') < 0: raise Exception('Server indicated that the operation was not successful\n' + result) I think this is it, or something similar .... So its time to practice - back to work on it. See you later.
    1 point
  4. Update : Version 1.0.0.1 Optimized whole code, added redim step var. Hi, I had to create Excel files for my needs, but I wondered how to do it because xlsx files are not raw editable; so I searched for a way do it. Excel can open multiple files type, and the XML is a good way to do it so here it is. It creates an Excel XML file, with which you will be able to : -Create Rows -Create Cells and set it's color -Set column width -Set global text horizontal align -Set XML author -Set XML creation date -Set XML compagny And of course you can easily add features. Here is an example : #include "Excel_XML.au3" $iRow = _ExcelXML_Row_Add() _ExcelXML_Column_SetWidth(1, 100) _ExcelXML_Cell_Add($iRow, "Row 1, Cell 1") _ExcelXML_Column_SetWidth(2, 200) _ExcelXML_Cell_Add($iRow, "Column width set to 200px") $iRow = _ExcelXML_Row_Add() $iCell = _ExcelXML_Cell_Add($iRow, "Cell color red") _ExcelXML_Cell_SetColor($iCell, 0xFF0000) _ExcelXML_Cell_Add($iRow, "Excel XML UDF") $hFile = FileOpen(@ScriptDir & "\Excel_XML test.xml", 2) FileWrite($hFile, _ExcelXML_Assemble()) FileClose($hFile) _ExcelXML_Destroy() And what you are waiting for : Excel_XML.au3 (Previous : 53 downloads) Enjoy !
    1 point
  5. IIRC 7zip header contains the archive size.
    1 point
  6. TheDcoder

    AU4 Library

    AU3# is also an option
    1 point
  7. TheSaint

    AU4 Library

    @Alzri - Welcome to the forum. So when AutoIt 4 comes out (not saying it is or ever will ... not my department), are you going to rename your Library to AU5 Library? Or just leave as AU4, to confuse everyone?
    1 point
  8. AZJIO

    Text Progress Bar

    Text Progress Bar Using symbols as a progress bar example #NoTrayIcon Opt("GUIResizeMode", 802) Opt("GUIDataSeparatorChar", ChrW('0x00A4')) Global $Color=0x00ccff, $BkColor=0xf7f7f7 ; En $Lng1='Used symbol :' $LngSt='Start' $LngSz='Size :' $LngDl='Delay :' $LngSty='Style :' $LngSel='Choose' $LngAdd='Add' ; Ru If @OSLang = 0419 Then $Lng1='Используемый символ :' $LngSt='Старт' $LngSz='Размер бара (кол. симв.) :' $LngDl='Задержка :' $LngSty='Стиль :' $LngSel='Выбрать' $LngAdd='Добавить' EndIf $hForm = GUICreate("Text Progress Bar", 380, 160+30, -1, -1, 0x00040000) $hButton1 = GUICtrlCreateButton($LngSt, 260,115, 80, 30) GUICtrlCreateLabel($Lng1, 10, 43, 130, 17) $symbol = GUICtrlCreateCombo('', 140,40, 60) GUICtrlSetData(-1,' '&ChrW('0x2588')&'¤|¤/¤\¤*¤(¤)¤'&ChrW('0x25CF')&'¤'&ChrW('0x25AA')&'¤'&ChrW('0x2022')&'¤'&ChrW('0x2039')&'¤'&ChrW('0x203A')&'¤'&ChrW('0x2206')&'¤'&ChrW('0x20AC')&'¤!¤.', ' '&ChrW('0x2588')) GUICtrlCreateLabel($LngSz, 10, 73, 130, 17) $kol_sim = GUICtrlCreateCombo('', 140,70, 60) GUICtrlSetData(-1,'20¤30¤50¤100¤120¤200', '20') GUICtrlCreateLabel($LngDl, 10, 103, 130, 17) $Delay = GUICtrlCreateCombo('', 140,100, 60) GUICtrlSetData(-1,'10¤20¤50¤100¤200', '20') GUICtrlCreateLabel($LngSty, 10, 133, 130, 17) $Style= GUICtrlCreateCombo('', 140,130, 60) GUICtrlSetData(-1,'1¤2¤3¤4¤5', '1') GUICtrlCreateGroup('', 205, 28, 160, 72) $hSelect = GUICtrlCreateButton($LngSel, 210, 40, 60, 25) $hAdd = GUICtrlCreateButton($LngAdd, 210, 70, 60, 25) $Un = GUICtrlCreateCombo('', 280,40, 60) GUICtrlSetData(-1,'2588¤25A0¤F031¤25B2¤25BA¤25BC¤2590¤2666¤25D8¤263B', '2588') GUISetState() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case -3 Exit Case $hButton1 $symbol0 = GUICtrlRead($symbol) $Delay0 = GUICtrlRead($Delay) $kol_sim0 = GUICtrlRead($kol_sim) $aStartTPB=_TPB_ProgressOn(10, 5, $kol_sim0, 21, $symbol0) For $i = 0 To 100 Sleep($Delay0) _TPB_ProgressSet($aStartTPB, $i) ; GUICtrlSetData($hButton1, $i & " %") Next ; GUICtrlDelete($aStartTPB[0]) ; _TPB_ProgressClose($aStartTPB) Case $hSelect Run('charmap.exe') Case $hAdd, $Un $Un0 = ChrW('0x'&GUICtrlRead($Un)) GUICtrlSetData($symbol, $Un0, $Un0) Case $Style Switch GUICtrlRead($Style) Case 1 $Color=0x00CCFF $BkColor=0xF7F7F7 Case 2 $Color=0xFF8700 $BkColor=0xFFFF8D Case 3 $Color=0xFF0361 $BkColor=0xFFDEDA Case 4 $Color=0x00A272 $BkColor=0xE8EED8 Case 5 $Color=0x515151 $BkColor=0xF1F1F1 Case Else $Color=0x00CCFF $BkColor=0xF7F7F7 EndSwitch EndSwitch WEnd Func _TPB_ProgressOn($left, $top, $amount, $height, $symbol) If IsDeclared('aStartTPB') And IsArray($aStartTPB) Then GUICtrlDelete($aStartTPB[0]) ; Delete Local $aStartTPB[3], $String=' ' For $i = 1 to $amount $String&=$symbol Next GUISetFont (12, 700) $aStartTPB[0] = GUICtrlCreateLabel($String, $left, $top, -1, $height) GUICtrlSetData(-1, '') GUICtrlSetColor(-1, $Color) GUICtrlSetBkColor(-1, $BkColor) ; GUICtrlSetColor(-1, 0xff8700) ; GUICtrlSetBkColor(-1, 0xffff8d) $aStartTPB[1] = $amount $aStartTPB[2] = $symbol Return $aStartTPB EndFunc Func _TPB_ProgressSet($aStartTPB, $Prosent = 0) If $Prosent < 0 Or $Prosent > 100 Then Return SetError(1, 0, 0) Local $kol=Int($Prosent*($aStartTPB[1]/100)), $String=' ' For $i = 1 to $kol $String&=$aStartTPB[2] Next If GUICtrlRead($aStartTPB[0])=$String Then Return GUICtrlSetData($aStartTPB[0], $String) EndFunc ; Func _TPB_ProgressClose($aStartTPB) ; GUICtrlDelete($aStartTPB[0]) ; EndFunc
    1 point
  9. spudw2k

    Traversing array ...

    ;#include <Array.au3> Local $arr[5]=["Never","Gonna","Give","You","Up"] _DynEnumArray($arr) Local $arr[6][2]=[["Penn", "Teller"],["Gilbert", "Sullivan"],["Sonny", "Cher"],["Stone", "Parker"],["Fischbacher", "Horn"],["Plant", "Page"]] _DynEnumArray($arr) Local $arr[2][3][2]=[[["All","Your"],["Base","Are"],["Belong","To Us"]],[["Is","This"],["The","Way"],["Back","Home"]]] _DynEnumArray($arr) Func _DynEnumArray($arr) Local $arrDims[1][2]=[["ElementIdx","ElementCount"]] ;Create an Array to Track Dimensions and Elements For $x = 1 to UBound($arr,0) ReDim $arrDims[$x+1][2] $arrDims[$x][0]=0 $arrDims[$x][1]=UBound($arr,$x) Next Do ;Loop Through Array Elements $var = "$arr" For $x = 1 to UBound($arrDims)-1 $var &= "[" & $arrDims[$x][0] & "]" Next ConsoleWrite($var & " " & Execute($var) & @CRLF) ;Output Subscript and Value $arrDims[UBound($arrDims)-1][0] += 1 ;Increment Last Dimension Element For $y = UBound($arrDims)-2 To 1 Step -1 ;Increment Dimension Element If $arrDims[$y+1][0] = $arrDims[$y+1][1] Then $arrDims[$y+1][0]=0 $arrDims[$y][0]+=1 EndIf Next Until $arrDims[1][0]=$arrDims[1][1] Return ConsoleWrite(@CRLF) EndFunc My solution. Looks very similar to Malkey's, but his example has a whole lot of extra calculations in it...I'm not sure/convinced they're needed. I certainly don't understand why they would be. I get it. He's converting an integer into array index. Similar to the "mapping" here; pretty neat. Essential for his _Array1DToMultiD function, but not required for a straight-up iterating traversal/enumeration function...no?
    1 point
  10. For a standard #32768 class context/popup menu you can get the information with this code. Works for the desktop too. #include <GuiMenu.au3> #include <SendMessage.au3> #include <WindowsConstants.au3> Example() Func Example() ConsoleWrite( "5 seconds to open a menu ..." & @CRLF ) Sleep( 5000 ) ; 5 seconds to open a menu Local $hMenu = GetMenuHandle() If Not $hMenu Then Return Local $iCount = _GUICtrlMenu_GetItemCount( $hMenu ), $sText, $iState For $i = 0 To $iCount - 1 $sText = _GUICtrlMenu_GetItemText( $hMenu, $i ) $iState = _GUICtrlMenu_GetItemState( $hMenu, $i ) If $sText <> "" Then ConsoleWrite( $sText ) If BitAND( $iState, 16 ) Then ConsoleWrite( " <-- Selected" ) ConsoleWrite( @CRLF ) Next EndFunc Func GetMenuHandle() Local $hDesktop = _WinAPI_GetDesktopWindow(), $i = 0 Local $hChild = _WinAPI_GetWindow( $hDesktop, $GW_CHILD ) While $hChild And $i < 50 If _WinAPI_GetClassName( $hChild ) = "#32768" Then ExitLoop $hChild = _WinAPI_GetWindow( $hChild, $GW_HWNDNEXT ) $i += 1 WEnd If $i = 50 Then Return 0 Local $hMenu = _SendMessage( $hChild, $MN_GETHMENU ) If $hMenu > 0 Then Return $hMenu Return 0 EndFunc Information is printed in SciTE console. See this post to get the information for a non-standard menu. The script is based on IU Automation code.
    1 point
  11. Does this work? $sFile = "test.xml" $sCID = "16F8B262D5B9C561D8899E638D3B3D8C" $sOutFile = "YourAttachment.txt" GetCIDAttachment($sFile, $sCID, $sOutFile) If @error Then $sErrDesc = "You can't use this method because " Switch @error Case 1 $sErrDesc &= "it sucks for you." Case 2 $sErrDesc &= "getting stream failed." Case 3 $sErrDesc &= "loading EML failed." Case 4 $sErrDesc = "Saving to file failed." Case 5 $sErrDesc = "No such attachment exists." EndSwitch MsgBox(4096, "Error", $sErrDesc & @CRLF) Else MsgBox(4096, "Yay!", "Attachment with Content-Id <" & $sCID & '> extracted to "' & $sOutFile & '"' & @CRLF) EndIf Func GetCIDAttachment($sPath, $sCID, $sOutFile = Null) Local $oErrHandler = ObjEvent("AutoIt.Error", GetAttachmentSize) ; Red Jon fucked up COM Local $oMessage = ObjCreate("{CD000001-8B95-11D1-82DB-00C04FB1625D}") If @error Then Return SetError(1, 0, 0) Local $oMessageStream = $oMessage.GetStream() If @error Then Return SetError(2, 0, 0) $oMessageStream.LoadFromFile($sPath) If @error Then Return SetError(3, 0, 0) $oMessageStream.Flush() ; this is essential For $oBodyPart In $oMessage.BodyPart.BodyParts For $oField In $oBodyPart.Fields If $oField.Name = "urn:schemas:mailheader:content-id" And $oField.Value = "<" & $sCID & ">" Then If $sOutFile Then Return $oBodyPart.GetDecodedContentStream().SaveToFile($sOutFile, 2) ; adSaveCreateOverWrite If @error Then Return SetError(4, 0, 0) Return $oBodyPart.GetDecodedContentStream().Read() EndIf Next Next Return SetError(5, 0, 0) EndFuncIt should extract "attachment" with Content-Id <16F8B262D5B9C561D8899E638D3B3D8C> from "test.xml" to file named "YourAttachment.txt". All located in the script's folder.
    1 point
  12. mesale0077 1. http://u.to/hFwxBA 2. http://rghost.ru/48061477 Look at the beginning of the file UDF_Help_Builder.au3. Now you can change the language.
    1 point
×
×
  • Create New...