#cs ------------------------------------------------------------------------------------------- Script: ClipList Date Started ...: [04.19.22] Author (orig)...: Jeffrey Lee Treat (for LISTVIEW) Edited for List.: K.Wright Script Function: Loads Clipboard Data (copied from LibreOffice Calc) into an array. In a dialog (window), a LIST is created. The LIST is then populated from the array and displayed. Data is sorted and any duplicates are ignored. An "ENTER" key or a double-click is detected and then the 1 line choice is compaired to the array to determine its element number or result. Script Notes: MS-Windows User32.dll file can be used in either (x86) or (x64) mode. #ce ------------------------------------------------------------------------------------------- #include #include ;-------------------------- Global $getMessage = 0 Global $windHandle = 0 Global $listCtrlID = 0 Global $pick = "" Global $lastPress = 0 Global $listChoiceMade = False Global $User32Dll1 = @WindowsDir& "\System32\user32.dll" Global $aClipString = StringSplit(ClipGet(),@CRLF,1) ;---------------------------------------------------------------------------------------------- $windHandle = GUICreate("List Selection Demo", 300, 500);----->> Create the window (dialog) $listCtrlID = GuiCtrlCreateList("", 10, 20, 380, 450);-------->>Create the LIST control $i = 1 While $aClipString[$i] <> "" GUICtrlSetData($listCtrlID,$aClipString[$i]) $i += 1 WEnd ;MsgBox(0,"Progress",$i & " elements processed.") GUISetState(@SW_SHOW) $HUser32DLL = DllOpen($User32Dll1) ;-------------------------->> Open MS-Win User32.dll File While Not $listChoiceMade $getMessage = 0 $getMessage = GUIGetMsg() If $getMessage = -3 Then ExitLoop ;----------------------->> -3 = $GUI_EVENT_CLOSE If _IsPressed("01",$HUser32DLL) Then ;------------------->> Is Left mouse button down? If TimerDiff($lastPress) < 350 Then ;---------------->> If less than 400ms since last down $listChoiceMade = True EndIf While _IsPressed("01",$HUser32DLL) ;----------------->> Delay until mouse button is lifted (up). Sleep(50) WEnd $lastPress = TimerInit() endif If _IsPressed("0D", $HUser32DLL) Then ;------------------->> OD = The [Enter] key Do Sleep(10) ;--------------------------------------->> Loop Until IsPressed Resets Until _IsPressed("0D", $HUser32DLL) = 0 If WinActive($windHandle) <> 0 Then $listChoiceMade=True ;>> If Active Set D-Click = TRUE EndIF WEnd If $listChoiceMade = True Then ;----------------------------->> Test IF a choice has been made. $pick = GUICtrlRead($listCtrlID) ;----------------------->> Retrieve our choice For $i = 1 to $aClipString[0] if $pick = $aClipString[$i] Then $pick = $i + 1 ;--------------------------------->> skipped the header entry (A1) $i = $aClipString[0] EndIf Next Msgbox(0,"Result","Line No. " & $pick & " was picked.") EndIf DllClose($HUser32DLL) ;--------------------------------------->> Close MS-Win User32.dll File GUIDelete() Exit ;-------------------------------------------------------->> Terminate the script (-Exit-)