Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 08/02/2018 in all areas

  1. Melba23

    String Table To Array?

    toto22, This seems to work: #include <StringConstants.au3> #include <Array.au3> $sInput = "WIFI 13.8 26.59" & @CRLF & _ "BCRX 9.6 13.34" & @CRLF & _ "GTES 8.5 11.15" & @CRLF & _ "DFRG 5.9 33.02" & @CRLF & _ "GIL 5.5 12.08" ; Replace all spaces by "|" $sInput = StringRegExpReplace($sInput, "\h+", "|") ConsoleWrite($sInput & @CRLF) ; Split string on @CRLF $aSplit_1 = StringSplit($sInput, @CRLF, $STR_ENTIRESPLIT) ; Split first line on "|" $aSplit_2 = StringSplit($aSplit_1[1], "|") ; Create suitably sized array Global $aArray[$aSplit_1[0]][$aSplit_2[0]] ; For each line For $i = 1 To $aSplit_1[0] ; Split on "|" $aSplit_2 = StringSplit($aSplit_1[$i], "|") ; Fill array For $j = 1 To $aSplit_2[0] $aArray[$i - 1][$j - 1] = $aSplit_2[$j] Next Next ; And here is the result _ArrayDisplay($aArray, "", Default, 8) M23
    2 points
  2. [BUGFIX VERSION] - 6 Apr 24 Fixed: UDF failed if header colours were initialised but not specifically set. New UDF in the zip below. -------------------------------------------------------------------------------------- Note: This is a new recoded and expanded version of my earlier UDF of the same name. If you move to this new version there might well be several script-breaking changes, particularly when setting which columns are to be editable. Please read the "Beginner's Guide" and look at the included example scripts to see where things have changed. -------------------------------------------------------------------------------------- This UDF allows you to do much more with ListView controls (either native or UDF created): Edit the content with plain text, combos or date-time pickers - and edit the headers too Move rows within the ListView Drag rows both within the ListView and to other ListViews in the same GUI (or not as required) Insert and delete columns and rows Sort columns by simply clicking the header Colour individual ListView items and headers Only select a single cell rather then the entire row Save and load entire ListViews For the advanced user: If you use certain Windows message handlers (In particular WM_NOTIFY) in your script, please read the function headers for the equivalent handlers within the UDF. Here is the UDF, with 6 examples and the guide, in zip format: GUIListViewEx.zip Credit to: martin (basic drag code), Array.au3 authors (array functions), KaFu and ProgAndy (font function), LarsJ (colouring code) Happy to take compliments or criticism - preferably the former! M23
    1 point
  3. ISI360

    ISN AutoIt Studio

    Hi! Thanks for your feedback, and welcome to ISN About the fileextenstions: Yeah i know there are some problemes and i had to readjust that. It´s on the To-Do List... And the parameter Editor: This error message appears because the command is not finished. So GuiCreate() for example should work.
    1 point
  4. This is what i came up with, had to change the id so you can put yours back. #include <AutoItConstants.au3> $WD="C:\Program Files\Wireshark" $CMD='"C:\Program Files\Wireshark\tshark.exe" -i \Device\NPF_{A7456150-8CCA-428A-9DD3-F6EA541249F5}'; -b duration:3000 -b files:600 -w "C:\Users\W10\Desktop\TSHARK-Com-0317_17---LAN-Verbindung___.pcap"' ;$CMD='"C:\Program Files\Wireshark\tshark.exe" -i \Device\NPF_{A7456150-8CCA-428A-9DD3-F6EA541249F5} -b duration:3000 -b files:600 -w "c:\TShark-Ringbuffer\LAN-Verbindung\TSHARK-Com-0317_17---LAN-Verbindung___.pcap"' ;ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $CMD = ' & $CMD & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console $PID=Run($CMD,'',@SW_HIDE, $STDIN_CHILD + $STDOUT_CHILD) While ProcessExists($PID) $output=StdoutRead($PID, False, False);True, False if $output <> "" then $split = StringSplit($output, @CRLF) ConsoleWrite(StringLeft($split[$split[0]],7) &' - '&@MSEC&@CRLF) EndIf Sleep(100) WEnd ConsoleWrite("Process vanished" & @CRLF)
    1 point
  5. Melba23

    String Table To Array?

    toto22, My pleasure as always. M23
    1 point
  6. #include <GUIConstantsEx.au3> #include <Misc.au3> Local $bW = 115, $bH = 25 $RecGUI = GUICreate("Record & Test", 500, 400) $butRec = GUICtrlCreateButton("Record Selected", 10, 10, $bW, $bH) $lblText = GUICtrlCreateLabel("", 10, 50, 300, 25) $lblText2 = GUICtrlCreateLabel("", 10, 100, 300, 25) GUISetState(@SW_SHOW, $RecGUI) While 1 Switch GUIGetMsg() Case $butRec Local $userDLL = DllOpen("user32.dll") GUICtrlSetData($lblText, "Press F2 to exit button loop") GUICtrlSetData($lblText2, "Press F3 to record clicking") Opt("GUIOnEventMode", 1) Do If (_IsPressed("72", $userDLL)) Then ;F3 for clicks $CurrWinName = WinGetTitle("[active]") ConsoleWrite("Before click: " & $CurrWinName & @CRLF) ToolTip("Click on window") Do Sleep(10) Until (_IsPressed("01", $userDLL)) Sleep(50) $CurrWinName = WinGetTitle("[active]") ToolTip("") While _IsPressed("01", $userDLL) Sleep(10) WEnd ConsoleWrite("After click: " & $CurrWinName & @CRLF) EndIf Until (_IsPressed("71", $userDLL)) ;Stop on F2 press Opt("GUIOnEventMode", 0) GUICtrlSetData($lblText, "") GUICtrlSetData($lblText2, "") DllClose($userDLL) ToolTip("") Case $GUI_EVENT_CLOSE ExitLoop (1) EndSwitch WEnd GUIDelete($RecGUI)
    1 point
  7. Well, I don't think we want to discuss these kind of topics around here as it doesn't feel right to me to be "cheating because others do too". Jos
    1 point
  8. TheSaint

    This is a weird one

    Yes I know. You must have missed where we already discussed that. And I am guessing you misunderstood my meaning - if it is essentially the same, but a step or two more than just _FileCreate, then where's the point, especially as the issue seems related somehow. Far better to just use FileDelete. Sure, using FileOpen directly and using the NOBOM flag might solve this rare issue, but I see no way to prove that ... only in theory. So as they say, right tool for the job - INI functions for INI files. And best way to remove everything in a file that is no longer required and will be automatically created again at need, is to just to FileDelete it ... right tool again. EDIT - I thought leaving an empty file behind, saved something needing to be redone, which is why I used _FileCreate (have done for years). I can't see the point in mucking around doing extra function calls. P.S. What can I say. I am just a hobby programmer, who learned mostly by monkey see monkey do, and not a lot of theory involved, as most of it was beyond my understanding and went over my head. Over the years I have gradually picked up certain concepts etc, and still do. I've had no formal training anywhere in coding, and relatively speaking, started late in life. I've made various attempts to educate myself better, but not a lot stuck or was understood ... I'm a simple man who has a penchant for logic ... and not good at remembering names or numbers.
    1 point
  9. Thanks for your reply! The next version will only support CLEAR and UPDATE for single value attributes. Seems APPEND and DELETE do not make much sense in this case. Will soon post some examples to test multi value attributes
    1 point
  10. @careca I see your point, I don't see why @ScriptName cannot be supported if @ScriptFullPath already is. But you can easily work around this by using @ScriptFullPath in the first parameter and @ScriptName in the second parameters since it does allow variable expressions Local $InstallDir = @LocalAppDataDir & '\123' FileInstall(@ScriptFullPath, $InstallDir & "\"&@ScriptName, 1)
    1 point
  11. [NEW VERSION] - 1 Aug18 Added: - Adding items to a native ListView resizes the column to fit the data - the UDF can now retain the original size - look for the $fRetainWidth parameter in _GUIListViewEx_Insert & _GUIListViewEx_InsertSpec. - _GUIListViewEx_EventMonitor now returns 9 when the user changes the ListView selection - the function returns an array contain the ListView index and the row and column selected. New version, examples and guide in the first post. M23
    1 point
  12. The version of AutoIt you run needs a COM error handler to handle such an error. Example: #include <Excel.au3> Global $oExcel = _Excel_Open() Global $oWorkbook = _Excel_BookNew($oExcel) Local $oError = ObjEvent("AutoIt.Error", "__Excel_COMErrFunc") $Column = _Excel_ColumnToLetter(2) If @error Then MsgBox(0, "ColumnToLetter", "Error " & @error & " processing _Excel_ColumnToLetter!") Else MsgBox(0, "ColumnToLetter", $Column) EndIf $Column = _Excel_ColumnToLetter($oWorkbook.Sheets("MySheetName").Range("MyRangeName").Column) If @error Then MsgBox(0, "ColumnToLetter", "Error " & @error & " processing _Excel_ColumnToLetter!") Else MsgBox(0, "ColumnToLetter", $Column) EndIf
    1 point
  13. I just noticed this thread and want to mention that I've been experiencing the same kind of thing when processing right mouse clicks ($GUI_EVENT_SECONDARYUP). About once every 6 or 8 clicks, my script processes what I've termed a bounce click. I have no reason to think it's the mouse, itself because the effect never occurs with other software. This led me to wonder: what's the proper way to clear any pending events for a GUI? Is turning off the mode the correct approach? For my particular case, I'd like to be able to "clear the decks" right before the Wend statement if ANY event has been received and processed.
    1 point
×
×
  • Create New...