-
Posts
42 -
Joined
-
Last visited
About taz742
- Birthday 08/15/1982
Profile Information
-
Location
France
taz742's Achievements

Seeker (1/7)
0
Reputation
-
_SymLink(), for creating Symbolic Links in AutoIt
taz742 replied to RulerOf's topic in AutoIt Example Scripts
Many thanks for the function. It work like a charm. -
SciTE Hopper 0.1 Jump to Any line by one click !!
taz742 replied to Ashalshaikh's topic in AutoIt Example Scripts
Great tool! Adopted & now I can't work without BTW, I've rewrite an internal function because sometime it crash because of not finding the script path. Get it here: Func _SciTEGetFilePath() Local $tTitle = WinGetTitle("[CLASS:SciTEWindow]"), $tSplitBy = '*' If StringInStr($tTitle, 'Untitled') Then SetError(2) ; Not File Return '' EndIf If $tmpSciTETitle == $tTitle Then Return $tmpFileSciTE $tmpSciTETitle = $tTitle Local $SS = StringRegExpReplace ($tTitle, "(.*?)([ ].[ ]SciTE(?i:[ ]\[\d*[ ]of[ ]\d*\])?)\Z","\1") If FileExists($SS) Then $tmpFileSciTE = $SS Return $SS EndIf Return SetError(3, 0, 0) EndFunc ;==>_SciTEGetFilePath -
_GUICtrlListView_AddArray() Bug ?
taz742 replied to taz742's topic in AutoIt General Help and Support
@Bowmore: Thanks for feedback same result here after commented lines related to $LVN_ITEMCHANGED -> No crash at all. Here my last result with 5000 rows : [3.3.4.0-x86] _display(5000) : 2803.02598332793 ms [3.3.4.0-x64] _display(5000) : 2490.92321654795 ms [3.3.5.1-x86] _display(5000) : 11922.7872642731 ms !!!! [3.3.5.1-x64] _display(5000) : 2535.45626555862 ms [3.3.5.3-x86] _display(5000) : 32257.3882287615 ms !!!! from bad to worse [3.3.5.3-x64] _display(5000) : 5542.96872995024 ms !!!! slower too @PsaltyDS: Yes I'm on Win7x64 but I work with AutoIt x86 I've revert back to 3.3.5.1 since 3.3.5.2 is reported buggy on x86 x86 Results are still 4x slower than 3.3.4.0 with the demo from the help or why my fixed script. -
_GUICtrlListView_AddArray() Bug ?
taz742 replied to taz742's topic in AutoIt General Help and Support
Damn you're right the demo from the help wronk like a charm: 2D loads 5000x4 in 2.14sec using v3.3.5.2 2D loads 5000x4 in 0.48sec using v3.3.4.0 so latest beta is around 4 times slower than stable version.... any reason? BTW I find what cause my crash: It's the GUIRegisterMsg($WM_NOTIFY, "_WM_NOTIFY") line So I've made some errors in the _WM_NOTIFY() func: if somebody have idea... -
_GUICtrlListView_AddArray() Bug ?
taz742 replied to taz742's topic in AutoIt General Help and Support
Maybe I've post in the wrong place: _GUICtrlListView_AddArray() can be more suitable here "Graphical User Interface (GUI) Help and Support"... -
Well I've a problem with _GUICtrlListView_AddArray() when array is larger than 1000 items with last stable & beta version So using 1000 items: it work (sometimes very slow but it work) So using more than 1000 items: v3.3.0.0: work finev3.3.2.0: work at very slow speedv3.3.4.0: Failedv3.3.5.1: FailedTest yourself and if somebody know the reason: just let me know #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_UseX64=y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <ListviewConstants.au3> #include <GuiListView.au3> #include <GuiStatusBar.au3> #include <Array.au3> #include <Constants.au3> #include <GUIConstantsEx.au3> #include <Constants.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <ButtonConstants.au3> Global $ProcessTime Global $bSort = 0, $bColumn = 1 $GUI = GUICreate("ListView TEST", 600, 400, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_MAXIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_SIZEBOX)) $Btn_1000 = GUICtrlCreateButton("Populate" & @CRLF & "ListView 1000", 150, 13, 100, 36, BitOR($BS_MULTILINE, $BS_CENTER)) GUICtrlSetResizing(-1, $GUI_DOCKALL) GUICtrlSetCursor(-1, 0) $Btn_1001 = GUICtrlCreateButton("Populate" & @CRLF & "ListView 1001", 350, 13, 100, 36, BitOR($BS_MULTILINE, $BS_CENTER)) GUICtrlSetResizing(-1, $GUI_DOCKALL) GUICtrlSetCursor(-1, 0) $Debug_LV = False $ListView = GUICtrlCreateListView("column1|column2|column3|column4|column5|column6|column7|column8|column9", 1, 60, 598, 314, $LVS_REPORT) _GUICtrlListView_SetExtendedListViewStyle($ListView, BitOR($LVS_EX_CHECKBOXES, $LVS_EX_FULLROWSELECT, $LVS_EX_GRIDLINES)) GUICtrlSetResizing($ListView, $GUI_DOCKBORDERS) For $j = 1 To 8 If $j = 4 Then ContinueLoop _GUICtrlListView_JustifyColumn($ListView, $j, 1) Next Dim $a_ctrl_status_part[7] = [115, 180, 255, 300, 335, 385, -1] Dim $a_ctrl_status_text[10] = [@AutoItVersion, 'by "taz742"', "", "#Items", "Total", "", ""] Global $ctrl_status = _GUICtrlStatusBar_Create($GUI, $a_ctrl_status_part, $a_ctrl_status_text) _GUICtrlStatusBar_SetMinHeight($ctrl_status, 23) GUIRegisterMsg($WM_SIZE, "_WM_SIZE") GUIRegisterMsg($WM_NOTIFY, "_WM_NOTIFY") GUISetState(@SW_SHOW, $GUI) While 1 $nMsg = GUIGetMsg() Switch $nMsg;[0] Case $GUI_EVENT_CLOSE GUIRegisterMsg($WM_SIZE, "") GUIRegisterMsg($WM_NOTIFY, "") If $ProcessTime Then MsgBox("", "ProcessTime Results", "Current ProcessTime Results are copied to ClipBoard" & @CRLF & @CRLF & $ProcessTime) EndIf Exit Case $Btn_1000 _display(1000) Case $Btn_1001 _display(1001) EndSwitch WEnd Func _display($rows) $chrono = TimerInit() GUISetCursor(15, 1, $GUI) Local $a_filelist_ext = "" Dim $a_filelist_ext[$rows][9] For $x = 0 To $rows - 1 $a_filelist_ext[$x][0] = Random(100000000, 9999999999, 1) $a_filelist_ext[$x][1] = Random(1, 365 * 2, 1) $a_filelist_ext[$x][2] = StringFormat("%04d/%02d/%02d %02d:%02d:%02d", Random(2009, 2010, 1), Random(1, 12, 1), Random(1, 31, 1), Random(0, 23, 1), Random(1, 59, 1), Random(1, 59, 1)) $a_filelist_ext[$x][3] = Random(0, 4000, 1) $a_filelist_ext[$x][4] = StringFormat("%x", Random(3, 9999999999, 1)) $a_filelist_ext[$x][5] = Random(1, 210000000, 1) $a_filelist_ext[$x][6] = Random(1, 9999999999) $a_filelist_ext[$x][7] = StringFormat("%08x", Random(3, 9999999999, 1)) $a_filelist_ext[$x][8] = Random(3, 9999999999, 0) Next _ArraySort($a_filelist_ext, $bSort, 0, 0, 2) _UpdateColumnArrowSort(2) ConsoleWrite('@@ Trace(63) : _GUICtrlListView_BeginUpdate($ListView)' & @crlf) ;### Trace Console _GUICtrlListView_BeginUpdate($ListView) ConsoleWrite('>Error code: ' & @error & @crlf & @crlf & '@@ Trace(65) : _GUICtrlListView_DeleteAllItems(GUICtrlGetHandle($ListView))' & @crlf) ;### Trace Console _GUICtrlListView_DeleteAllItems(GUICtrlGetHandle($ListView)) ConsoleWrite('>Error code: ' & @error & @crlf & @crlf & '@@ Trace(67) : _GUICtrlListView_AddArray($ListView, $a_filelist_ext)' & @crlf) ;### Trace Console _GUICtrlListView_AddArray($ListView, $a_filelist_ext) ConsoleWrite('>Error code: ' & @error & @crlf & @crlf & '@@ Trace(69) : _GUICtrlListView_EndUpdate($ListView)' & @crlf) ;### Trace Console _GUICtrlListView_EndUpdate($ListView) ConsoleWrite('>Error code: ' & @error & @crlf & @CRLF) _UpdateColumnWidth($ListView) GUISetCursor(2, 0, $GUI) Local $autoitarch Switch @AutoItX64 Case 0 $autoitarch = "x86" Case 1 $autoitarch = "x64" EndSwitch $ProcessTime &= "[" & @AutoItVersion & "-" & $autoitarch & "] _display(" & $rows & ") : " & TimerDiff($chrono) & " ms" & @CRLF ClipPut($ProcessTime) EndFunc ;==>_display Func _UpdateColumnWidth(ByRef $ListView) GUISetCursor(15, 1, $GUI) For $cw = 0 To _GUICtrlListView_GetColumnCount($ListView) - 1 _GUICtrlListView_SetColumnWidth($ListView, $cw, $LVSCW_AUTOSIZE_USEHEADER) Next GUISetCursor(2, 0, $GUI) EndFunc ;==>_UpdateColumnWidth Func _WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam) #forceref $hWnd, $iMsg, $iwParam Local $hWndFrom, $iCode, $tNMHDR, $hWndListView $hWndListView = $ListView If Not IsHWnd($ListView) Then $hWndListView = GUICtrlGetHandle($ListView) $tNMHDR = DllStructCreate($tagNMHDR, $ilParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hWndListView Switch $iCode Case $NM_DBLCLK Local $tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam) Local $nIndex = DllStructGetData($tInfo, "Index") Switch _GUICtrlListView_GetItemChecked($hWndFrom, $nIndex) Case True _GUICtrlListView_SetItemChecked($hWndFrom, $nIndex, False) Case False _GUICtrlListView_SetItemChecked($hWndFrom, $nIndex, True) EndSwitch Case $LVN_ITEMCHANGED Local $ItemsTotal = _GUICtrlListView_GetItemCount($hWndFrom) If Not (_GUICtrlStatusBar_GetText($ctrl_status, 5) == $ItemsTotal) Then _GUICtrlStatusBar_SetText($ctrl_status, $ItemsTotal, 5) EndSwitch EndSwitch Return $__LISTVIEWCONSTANT_GUI_RUNDEFMSG EndFunc ;==>_WM_NOTIFY Func _WM_SIZE() _GUICtrlStatusBar_Resize($ctrl_status) Return $GUI_RUNDEFMSG EndFunc ;==>_WM_SIZE Func _UpdateColumnArrowSort($nColumn) ; bells and whistles (I): ; mark the sorted column with a grey rectangle GUICtrlSendMsg($ListView, $LVM_SETSELECTEDCOLUMN, GUICtrlGetState($ListView), 0) DllCall("user32.dll", "int", "InvalidateRect", "hwnd", GUICtrlGetHandle($ListView), "int", 0, "int", 1) ; bells and whistles (II): ; create an arrow in the listview header Local $iFormat Local Const $hHeader = _GUICtrlListView_GetHeader($ListView) ; clear existing arrows For $x = 0 To _GUICtrlHeader_GetItemCount($hHeader) - 1 $iFormat = _GUICtrlHeader_GetItemFormat($hHeader, $x) If BitAND($iFormat, $HDF_SORTDOWN) Then _GUICtrlHeader_SetItemFormat($hHeader, $x, BitXOR($iFormat, $HDF_SORTDOWN)) ElseIf BitAND($iFormat, $HDF_SORTUP) Then _GUICtrlHeader_SetItemFormat($hHeader, $x, BitXOR($iFormat, $HDF_SORTUP)) EndIf Next ; set arrow in current column ;~ Local $nColumn = GUICtrlGetState($ListView) $iFormat = _GUICtrlHeader_GetItemFormat($hHeader, $nColumn) If $bSort == 0 And $bColumn == $nColumn Then ; ascending _GUICtrlHeader_SetItemFormat($hHeader, $nColumn, BitOR($iFormat, $HDF_SORTUP)) Else ; descending _GUICtrlHeader_SetItemFormat($hHeader, $nColumn, BitOR($iFormat, $HDF_SORTDOWN)) EndIf $bColumn = $nColumn EndFunc ;==>_UpdateColumnArrowSort Here my timer results (average of 10 run each) using previous script on different AutoIt version: (would know why some of them are so slow or failed...) /----------------------------------------------------+-----------------------------------------------------\ | AutoIt 32 bits | AutoIt 64 bits | |----------------------------------------------------+-----------------------------------------------------| | [3.3.0.0-x86] _display(1000) : 2436.50217791475 ms | [3.3.0.0-x64] _display(1000) : 1317.69232025496 ms | | [3.3.0.0-x86] _display(1001) : 2179.04862337590 ms | [3.3.0.0-x64] _display(1001) : 1126.74880605477 ms | | | | | [3.3.2.0-x86] _display(1000) : 9651.61576311007 ms | [3.3.2.0-x64] _display(1000) : 63151.07472569010 ms | | [3.3.2.0-x86] _display(1001) : 9662.51303599217 ms | [3.3.2.0-x64] _display(1001) : 63430.03399273480 ms | | | | | [3.3.4.0-x86] _display(1000) : 2524.11897690500 ms | [3.3.4.0-x64] _display(1000) : 2111.093483520410 ms | | [3.3.4.0-x86] _display(1001) : Failed at 1000 rows | [3.3.4.0-x64] _display(1001) : Failed at 1000 rows | | | | | [3.3.5.1-x86] _display(1000) : 2459.72735820223 ms | [3.3.5.1-x64] _display(1000) : 2065.324377480340 ms | | [3.3.5.1-x86] _display(1001) : Failed at 1000 rows | [3.3.5.1-x64] _display(1001) : Failed at 1000 rows | \----------------------------------------------------+-----------------------------------------------------/
-
Variable for run output has to be redifined?
taz742 replied to SystemWontAccept's topic in AutoIt General Help and Support
I think that you need to redefine your variable twice on your 1st posted script because you're waiting StdOut data from a process and once you've received data this process die & its handle too. Am I wrong? If I'm right: maybe this script can help you (Done from scratch ) Global $result1 = "", $result2 = "" $result1 = _SNMPget() sleep(1000) $result2 = _SNMPget() If BitAND(IsArray($result1), IsArray($result2)) = 1 Then MsgBox(0, "Octets", StringMid($result2[0], $result2[1] + 10) & StringMid($result1[0], $result1[1] + 10)) MsgBox(0, "works? ", (StringMid($result2[0], $result2[1] + 10) - StringMid($result1[0], $result1[1] + 10)) * 8 / 1000000) Else MsgBox(4096,"Bug", "Are $result# Array?" & @crlf & @crlf & _ "$result1 = " & IsArray($result1) & @crlf & _ "$result2 = " & IsArray($result2)) EndIf ;MsgBox(0, '', StringMid($snmp, 1)) Exit ;-Func _SNMPget() ;- ;-Retrieve the data(s) you want and return them into an array Func _SNMPget() Local $result Dim $result[2] Local $SNMPget = Run(@ComSpec & " /c c:\windows\system32\snmputil.exe get 10.10.10.10 public .1.3.6.1.2.1.2.2.1.10.4", @ScriptDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) While 1 Sleep(100) $result[0] = StdoutRead($SNMPget) If @error Then ExitLoop WEnd $result[1] = StringInStr($result[0], "Counter32") Return $result EndFunc ;==>_SNMPget -
Why using UDF if you need to replace output after? Just rewrite it as you need Here is want you want: $filenameformat = @YEAR & "-" & @MON & "-" & @MDAY & "_" & @HOUR & ";" & @MIN & ";" & @SEC ;output = yyyy-mm-dd_hh;mm;ss ;~ $filenameformat = @YEAR & @MON & @MDAY & "_" & @HOUR & @MIN & @SEC ;output = yyyymmdd_hhmmss $file = $filenameformat & ".txt" $o_file = FileOpen($file, 1+8) FileWriteLine($o_file , "your text here") FileClose($o_file)
-
Nice app BTW I just made little change by replacing: If @OSArch = "X86" Then $sGUITitle = "Icon Configuration Utility - 32bit version" by this one: If @AutoItX64 = 0 Then $sGUITitle = "Icon Configuration Utility - 32bit version"
-
I've a problem when using FileMove function with resulting file permission. I've discover the problem because there is a lock overlayed icon the moved file: Here an example script to reproduce my problem: $file=@TempDir & "\filetest.txt" $filehndl=FileOpen($file,2) FileWriteLine($filehndl, "some text") FileClose($filehndl) FileCopy($file, @SystemDir & "\filetest_copy.txt",1) FileMove($file, @SystemDir & "\filetest_move.txt",1) Run('Explorer.exe "' & @SystemDir & '"') The @SystemDir & "\filetest_copy.txt" has it permissions inherit from the @systemdir folder (which is normal) but the @SystemDir & "\filetest_move.txt" has it own permissions (and this is problematic) So my questions are simple: Is this normal or a bug?If it's a bug how can I solve it?PS: I'm using Win7x64 OS
-
Thanks a lot trancexx for this useful unix timestamp encode/decode functions
-
I use Lazycat's "WM_DROPFILES_FUNC" for a while with no problem but yesterday i've notice a lack in this function: Files with unicode char in their name aren't supported so i've search the unicode function... And i've found it: "DragQueryFileW" instead of DragQueryFile or DragQueryFileA for ANSI #include <GUIConstants.au3> #include <WindowsConstants.au3> Global $WM_DROPFILES = 0x233 Global $gaDropFiles[1], $str = "" ### Koda GUI section start ### $hGUI = GUICreate("Test", 400, 200, 219, 178, -1, BitOR($WS_EX_ACCEPTFILES, $WS_EX_TOPMOST)) $hList = GUICtrlCreateList("", 5, 5, 390, 190) GUICtrlSetState (-1, $GUI_DROPACCEPTED) GUISetState(@SW_SHOW) ### Koda GUI section end ### GUIRegisterMsg ($WM_DROPFILES, "WM_DROPFILES_UNICODE_FUNC") While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $GUI_EVENT_DROPPED $str = "" For $i = 0 To UBound($gaDropFiles) - 1 $str &= "|" & $gaDropFiles[$i] Next GUICtrlSetData($hList, $str) EndSwitch WEnd Func WM_DROPFILES_UNICODE_FUNC($hWnd, $msgID, $wParam, $lParam) Local $nSize, $pFileName Local $nAmt = DllCall("shell32.dll", "int", "DragQueryFileW", "hwnd", $wParam, "int", 0xFFFFFFFF, "ptr", 0, "int", 255) For $i = 0 To $nAmt[0] - 1 $nSize = DllCall("shell32.dll", "int", "DragQueryFileW", "hwnd", $wParam, "int", $i, "ptr", 0, "int", 0) $nSize = $nSize[0] + 1 $pFileName = DllStructCreate("wchar[" & $nSize & "]") DllCall("shell32.dll", "int", "DragQueryFileW", "hwnd", $wParam, "int", $i, "int", DllStructGetPtr($pFileName), "int", $nSize) ReDim $gaDropFiles[$i + 1] $gaDropFiles[$i] = DllStructGetData($pFileName, 1) $pFileName = 0 Next EndFunc ;==>WM_DROPFILES_UNICODE_FUNCMultiDropUnicodeTest.au3 Njoy !
-
All the donwload links are no working... so we can't test it...
-
_FileWriteToLine Deleting ALL Lines
taz742 replied to Redbeard's topic in AutoIt General Help and Support
@Valuter: you're right using a filefullpath without extention for a file is not recommanded. @Redbeard: Replace @LF by @CRLF into your script and it will run as expected.