Leaderboard
Popular Content
Showing content with the highest reputation on 12/06/2020 in all areas
-
Brendzt, Use the SciTE #region...#endregion directives - details are in the SciTE help file. M232 points
-
I must admit, it is quite confusing at first, as there is 4 types of ID in ListView : 1- GUI IDs : all controls get a separate ID in a given moment. But a specific ID can be reuse if another control got deleted. 2- LV Index : all list view items get a separate ID in a given moment based on its position in the LV. If items get inserted then all indexes after insertion point are modified. 3- LV ID : all list view items get a unique internal ID (within the LV, starting at 0) that do not change over lifetime of the GUI. 4- LV Param : all list view items get a place to register a parameter. If the LV item is created by native GUI function, parameter is automatically assign to the GUI ID of the item. If the LV item is created by UDF function, parameter is unassigned (0 by default) but is managed by script. To illustrate this you may take a look at this : #include <GUIConstantsEx.au3> #include <GuiListView.au3> #include <MsgBoxConstants.au3> Example() Func Example() Local $iID, $idListview GUICreate("ListView Map ID To Index", 400, 300) $idListview = GUICtrlCreateListView("", 2, 2, 394, 268) GUISetState(@SW_SHOW) ; Add column _GUICtrlListView_AddColumn($idListview, "Items", 100) ConsoleWrite ("GUI ID " & GUICtrlCreateListViewItem ("Item 0", $idListview) & @CRLF) ; Add items For $i = 1 to 4 ConsoleWrite ("Creation index " & _GUICtrlListView_AddItem($idListview, "Item " & $i, -1, $idListview+$i+1) & @CRLF) Next ConsoleWrite ("Insertion index " & _GUICtrlListView_InsertItem($idListview, "Item 2-3", 3) & @CRLF) ConsoleWrite ("****************" & @CRLF) For $i = 0 to 5 ConsoleWrite ("LV ID " & _GUICtrlListView_MapIndexToID($idListview, $i) & @CRLF) Next ConsoleWrite ("****************" & @CRLF) _GUICtrlListView_DeleteItem($idListview, 2) ConsoleWrite ("Insertion index " & _GUICtrlListView_InsertItem($idListview, "Item 3-4", 4) & @CRLF) ConsoleWrite ("GUI ID " & GUICtrlCreateListViewItem ("Item 5", $idListview) & @CRLF) For $i = 0 to 6 ConsoleWrite ("LV ID " & _GUICtrlListView_MapIndexToID($idListview, $i) & @CRLF) Next ConsoleWrite ("****************" & @CRLF) For $i = 0 to 6 ConsoleWrite ("Param " & _GUICtrlListView_GetItemParam($idListview, $i) & @CRLF) Next Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>Example2 points
-
HotKeySet("{F1}", "RunFunc") #Region runfunc While (1) Sleep(100) WEnd Func RunFunc() Local $aFuncs[3] = [camera1, camera2, camera3] $aFuncs[Random(0, 2, 1)]() EndFunc ;==>RunFunc #endregion #Region camera1 Func camera1() MsgBox(0, 0, "camera1") EndFunc ;==>camera1 #endregion #Region camera2 Func camera2() MsgBox(0, 0, "camera2") EndFunc ;==>camera2 #endregion #Region camera3 Func camera3() MsgBox(0, 0, "camera3") EndFunc ;==>camera3 #endregion1 point
-
It is a @CRLF (@Cr & @LF)1 point
-
Like I said just strip last 2 chars : Local $sExcelData = StringTrimRight(ClipGet(),2)1 point
-
Here : #include <Array.au3> #include <AutoItConstants.au3> Opt("sendkeydelay", 25) Local $sExcelData = ClipGet() MsgBox ($MB_SYSTEMMODAL,"",$sExcelData) StringReplace(StringMid($sExcelData, 1, StringInStr($sExcelData,@CRLF)), @TAB, @TAB) Local $aExcel2D[0][@extended+1] _ArrayAdd($aExcel2D, $sExcelData, 0, @TAB, @CRLF) _ArrayDisplay($aExcel2D) Run("notepad.exe") WinWaitActive("[CLASS:Notepad]") For $i = 0 To UBound($aExcel2D, 2) Send($aExcel2D[0][$i]) Send(" color. ") send($aExcel2D[1][$i]) Send(" quantity. ") send($aExcel2D[2][$i]) Send(" size. ") send($aExcel2D[3][$i]) Send(" number. ") send($aExcel2D[4][$i]) Send(" treat.") Send("{ENTER}") Next That works for both of your examples1 point
-
Is it possible to find the index from ID-Control in ListView?
Musashi reacted to pixelsearch for a topic
Well... maybe one you'll need your listview sorted, who knows... If it happens, please have a look at the 3 pics below : The pic above could represent a 2D array of your listview items just after it has been created (with only one data column on the right, to make these explanations simpler) 11 rows, 1 column in LV, content of the column (unsorted) => "CC" , "MM" ... "HH" Gui ID's for your items start at 7 because : * Gui ID's always start at 3 and... * ...you already created 4 controls before ($sLb, $nImp, $idButton, $idListview) which were assigned to GUI ID's 3, 4, 5, 6 LV ID and LV Index got the same value just after the LV is created (from 0 to 10) The pic above shows what happens when you sort using the _GUICtrlListView_SimpleSort() function : Content of cells is now sorted "AA" , "CC" ... "ZZ" LV ID = LV index because Windows didn't make the sort, all the sorting part is included in the UDF's (it would be same if you ever use one day ArrayMultiColSort() from Melba23 : LV ID = LV Index after the MultiColSort) The pic above shows what happens when you sort using _GUICtrlListView_SortItems() Content of cells is sorted "AA" , "CC" ... "ZZ" but all LV indexes have changed (they're no more equals to LV ID's) because Windows did the sort when LVM_SORTITEMSEX message was called (MSDN's explanations in my precedent post) So if you ever use this way of sorting, then you'll need _GUICtrlListView_MapIndexToID() and _GUICtrlListView_MapIDToIndex() to update your array accordingly. I think the quickest way to access a value directly in an Array is to use ArrayBinarySearch() but if you do this, the search column must be sorted in ascending order before the search is done (help file, topic ArrayBinarySearch) As you're saying that you won't sort the LV, why don't you just use ArrayBinarySearch() in the 1st pic, where both GUI ID column and LV Index column are already sorted ? Checking quickly a value in the GUI ID column will indicate you its corresponding LV index value... and vice-versa Hope it helps and good luck1 point -
Lengthy URL doesnt copy from excel to a web page - (Moved)
cpradeep22 reacted to GokAy for a topic
Hey, Maybe you need to read text instead of value of range("B33")? $iReturn parameter https://www.autoitscript.com/autoit3/docs/libfunctions/_Excel_RangeRead.htm [optional] What to return from the specified cell: 1 - Value (default) 2 - Formula 3 - The displayed text 4 - Value2. The only difference between Value and Value2 is that the Value2 property doesn’t use the Currency and Date data types1 point -
(?i): ignore case. So the pattern matches "template" and "Template" ^: Only matches at the start of the line |: matches multiple patterns More details can be found in the help file for StringRegExp.1 point
-
You add browser check for IE only if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4)) // IE (4+) only You can add for FireFox function ClipBoard(NumBlok) { var input = document.createElement('textarea'); input.innerHTML = NumBlok.innerText; document.body.appendChild(input); input.select(); document.execCommand('copy'); document.body.removeChild(input); } Add to online documentation... universally: function ClipBoard(NumBlok) { var input = document.createElement('textarea'); if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4)) // IE (4+) only input.innerText = NumBlok.innerText; else input.innerHTML = NumBlok.innerText; document.body.appendChild(input); input.select(); document.execCommand('copy'); document.body.removeChild(input); }1 point