Leaderboard
Popular Content
Showing content with the highest reputation on 09/09/2021 in all areas
-
The Webdriver executables resided in C:\Program Files (x86)\AutoIt\Include so I copied them to the working directory and that program ran OK. I then copied the executable to the working directories of my own programs. They still failed to work but there was a crucial difference in the console report: Instead of "_WD_Startup ==> General Error: Error launching web driver!", I got "__WD_Post ==> Webdriver Exception: {"value":{"error":"session not created","message":"session not created: This version of ChromeDriver only supports Chrome version 91\nCurrent browser version is 93.0.4577.63 with ... " Downloaded the right version and everything is hunky dory. That's the first time ever that Chrome's automatic, behind-the-scenes, updating has caused me a problem! Many thanks for your reply, I just didn't know where to start looking. Your clue this time, and those in the past, have been invaluable.1 point
-
NassauSky, Good fun getting that to work: #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include <Array.au3> #include <GuiMenu.au3> #Include "GUIListViewEx.au3" Opt("GUIOnEventMode", 1) Global Enum $iThis = 1000, $iThat Global $fRightClick = False, $aHit, $fUDF = False ; Create GUI $hGUI = GUICreate("ContextMenu NATIVE vs UDF", 640, 510) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") ;--------------------------------------------------LEFT NATIVE SETUP-------------------------------------------------------------------------- $cListView_Left = GUICtrlCreateListView("", 30, 40, 200, 300, BitOR($LVS_DEFAULT, $WS_BORDER)) _GUICtrlListView_AddColumn($cListView_Left, "Column 1", 83) _GUICtrlListView_AddColumn($cListView_Left, "Column 2", 83) $iLV_Left_Index = _GUIListViewEx_Init($cListView_Left, "", 0, 0, True) $ContextMenu = GUICtrlCreateContextMenu($cListView_Left) GUICtrlCreateMenuItem("Run This", $ContextMenu, 1) GUICtrlSetOnEvent(-1, "_myRoutine1") GUICtrlCreateMenuItem("Run That", $ContextMenu, 2) GUICtrlSetOnEvent(-1, "_myRoutine2") ;-------------------------------------------------RIGHT UDF SETUP------------------------------------------------------------------------------ $hListView_Right = _GUICtrlListView_Create($hGUI, "", 330, 40, 200, 300, BitOR($LVS_DEFAULT, $WS_BORDER)) ;UDF version _GUICtrlListView_AddColumn($hListView_Right, "Column 1", 83) _GUICtrlListView_AddColumn($hListView_Right, "Column 2", 83) $iLV_Right_Index = _GUIListViewEx_Init($hListView_Right, "", 0, 0, True) _GUIListViewEx_MsgRegister(False) GUIRegisterMsg($WM_NOTIFY, "_WM_NOTIFY") GUISetState() ;-------------------------------------------------COMMON ITEM INSERTION------------------------------------------------------------------------- _GUIListViewEx_InsertSpec($iLV_Left_Index, 0, "Row 1a Manual Wait| Test 1b") _GUIListViewEx_InsertSpec($iLV_Left_Index, 1, "Row 2a Manual Wait| Test 2b") _GUIListViewEx_InsertSpec($iLV_Right_Index, 0, "Row 1a Manual Wait| Test 1b") _GUIListViewEx_InsertSpec($iLV_Right_Index, 1, "Row 2a Manual Wait| Test 2b") While 1 Sleep(10) WEnd Func _Exit() Exit EndFunc Func _myRoutine1() If $fUDF Then MsgBox($MB_SYSTEMMODAL, "RClick", "Running This" & @CRLF & $aHit[0] & "-" & $aHit[1]) $fUDF = False Else $aContext =_GUIListViewEx_ContextPos() MsgBox($MB_SYSTEMMODAL, "RClick", "Running This" & @CRLF & $aContext[1] & "-" & $aContext[2]) EndIf EndFunc Func _myRoutine2() If $fUDF Then MsgBox($MB_SYSTEMMODAL, "RClick", "Running That" & @CRLF & $aHit[0] & "-" & $aHit[1]) $fUDF = False Else $aContext =_GUIListViewEx_ContextPos() MsgBox($MB_SYSTEMMODAL, "RClick", "Running That" & @CRLF & $aContext[1] & "-" & $aContext[2]) EndIf EndFunc Func _LV_Right_RClick() ; Called inside _WM_NOTIFY $aHit = _GUICtrlListView_SubItemHitTest($hListView_Right) If $aHit[0] <> -1 Then $fUDF = True ; Click on UDF ListView $hMenu = _GUICtrlMenu_CreatePopup() _GUICtrlMenu_AddMenuItem($hMenu, "Run This", $iThis) _GUICtrlMenu_AddMenuItem($hMenu, "Run That", $iThat) Switch _GUICtrlMenu_TrackPopupMenu($hMenu, $hListView_Right, -1, -1, 1, 1, 2) Case $iThis _myRoutine1() Case $iThat _myRoutine2() EndSwitch _GUICtrlMenu_DestroyMenu($hMenu) EndIf EndFunc Func _WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam) Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView, $tInfo $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hListView_Right Switch $iCode Case $NM_RCLICK _LV_Right_RClick() Return 0 EndSwitch EndSwitch _GUIListViewEx_WM_NOTIFY_Handler($hWnd, $iMsg, $wParam, $lParam) EndFunc ;==>WM_NOTIFY All good now? M231 point
-
NassauSky, There was a misunderstanding - if you want to completely clear and reload a ListView then what you are doing is exactly the way to do so. As to context menus - here is how to create context menus on both native and UDF-created ListViews: #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiMenu.au3> #Include "GUIListViewEx.au3" Opt("GUIOnEventMode", 1) Global Enum $iThis = 1000, $iThat ; Create GUI $hGUI = GUICreate("LVEx Example 1", 640, 510) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") $cListView_Left = GUICtrlCreateListView("", 30, 40, 200, 300, BitOR($LVS_DEFAULT, $WS_BORDER)) _GUICtrlListView_AddColumn($cListView_Left, "Column 1", 83) _GUICtrlListView_AddColumn($cListView_Left, "Column 2", 83) $iLV_Left_Index = _GUIListViewEx_Init($cListView_Left, "", 0, 0, True) $ContextMenu = GUICtrlCreateContextMenu($cListView_Left) ;Right-Click Context menu inside Listview GUICtrlCreateMenuItem("Run This", $ContextMenu, 1) GUICtrlSetOnEvent(-1, "_myRoutine1") GUICtrlCreateMenuItem("Run That", $ContextMenu, 2) GUICtrlSetOnEvent(-1, "_myRoutine2") $hListView_Right = _GUICtrlListView_Create($hGUI, "", 330, 40, 200, 300, BitOR($LVS_DEFAULT, $WS_BORDER)) ;UDF version _GUICtrlListView_AddColumn($hListView_Right, "Column 1", 83) _GUICtrlListView_AddColumn($hListView_Right, "Column 2", 83) $iLV_Right_Index = _GUIListViewEx_Init($hListView_Right, "", 0, 0, True) _GUIListViewEx_MsgRegister(False) GUIRegisterMsg($WM_NOTIFY, "_WM_NOTIFY") GUISetState() _GUIListViewEx_InsertSpec($iLV_Left_Index, 0, "Row 1a Manual Wait| Test 1b") _GUIListViewEx_InsertSpec($iLV_Left_Index, 1, "Row 2a Manual Wait| Test 2b") _GUIListViewEx_InsertSpec($iLV_Right_Index, 0, "Row 1a Manual Wait| Test 1b") _GUIListViewEx_InsertSpec($iLV_Right_Index, 1, "Row 2a Manual Wait| Test 2b") While 1 Sleep(10) WEnd Func _Exit() Exit EndFunc Func _myRoutine1() MsgBox($MB_SYSTEMMODAL, "Native", "Running This") EndFunc Func _myRoutine2() MsgBox($MB_SYSTEMMODAL, "Native", "Running That") EndFunc Func _LV_Right_RClick() $aHit = _GUICtrlListView_SubItemHitTest($hListView_Right) If $aHit[0] <> -1 Then $hMenu = _GUICtrlMenu_CreatePopup() _GUICtrlMenu_AddMenuItem($hMenu, "Run This", $iThis) _GUICtrlMenu_AddMenuItem($hMenu, "Run That", $iThat) Switch _GUICtrlMenu_TrackPopupMenu($hMenu, $hListView_Right, -1, -1, 1, 1, 2) Case $iThis _myRoutine1() Case $iThat _myRoutine2() EndSwitch _GUICtrlMenu_DestroyMenu($hMenu) EndIf EndFunc Func _WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam) Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView, $tInfo $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hListView_Right Switch $iCode Case $NM_RCLICK _LV_Right_RClick() Return 0 EndSwitch EndSwitch _GUIListViewEx_WM_NOTIFY_Handler($hWnd, $iMsg, $wParam, $lParam) EndFunc ;==>WM_NOTIFY Note the requirement NOT to register the WM_NOTIFY message within the UDF _MsgRegister function, but to call the associated function within the separate registered handler. I hope that clears up all of your questions. M231 point
-
PS-CSV-For each in Autoit
seadoggie01 reacted to Musashi for a topic
or without the return count in the first element $users = 'toto,tata,tutu' $users = StringSplit($users,',', 2) ; 2 = disable the return count in the first element For $user In $users ConsoleWrite($user & @CRLF) Next1 point -
Encrypt / Decrypt executable FILE (via AutoIT) - (Moved)
seadoggie01 reacted to Musashi for a topic
It would be nice if you could share your newfound knowledge with others .1 point