Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 04/26/2018 in all areas

  1. You can try: #include <GUIConstantsEx.au3> #include <ListViewConstants.au3> #include <WindowsConstants.au3> #include <GuiListView.au3> Global $DoubleClicked = False $Form1 = GUICreate("Form1", 259, 296, 192, 124) $ListV1 = GUICtrlCreateListView("ListView 1", 32, 32, 186, 182, -1, BitOR($LVS_EX_CHECKBOXES, $WS_EX_CLIENTEDGE)) For $i = 1 To 5 GUICtrlCreateListViewItem("Item" & $i, $ListV1) Next GUISetState(@SW_SHOW) GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func DoubleClickFunc($_iIndex) Local $sItemText = _GUICtrlListView_GetItemText($ListV1, $_iIndex) MsgBox(64, "OK", "Double Clicked: " & $sItemText) ClipPut($sItemText) EndFunc ;==>DoubleClickFunc Func WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView, $tInfo ; Local $tBuffer $hWndListView = $ListV1 If Not IsHWnd($ListV1) Then $hWndListView = GUICtrlGetHandle($ListV1) $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hWndListView Switch $iCode Case $NM_DBLCLK ; Sent by a list-view control when the user double-clicks an item with the left mouse button $tInfo = DllStructCreate($tagNMITEMACTIVATE, $lParam) DoubleClickFunc(DllStructGetData($tInfo, "Index")) EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY
    1 point
  2. Lol, don't worry. I'm only deleting the Key that I wrote to begin with and I'm being careful. I verified with Microsoft that I was safe to write and delete that key. I did the same thing a long time ago. Now, unless I've got a good reason, I keep my fingers out the Registry.
    1 point
  3. Earthshine

    Separating Functions

    yes, that way you can build a library of UDFs to just include in main scripts.
    1 point
  4. BrewManNH

    Separating Functions

    It's perfectly normal and acceptable to separate your functions and your main script. Look at the list of UDFs (User Defined Function) that come with AutoIt and the thousands of user created UDFs that do this.
    1 point
  5. Haven't actually done this myself, but I would think it would go something like this -- $sHTML = '<th localizer-text="GSR_New_Entry">NEW HEADER</th>' _FFXPath("/html/body/form/section[1]/table/thead/tr/th[8]") _FFCmd("FFau3.xpath.insertAdjacentHTML=('afterend', $sHTML)
    1 point
  6. You can try something like the following: #include <Array.au3> #include <Timers.au3> #include <WinAPIProc.au3> Global $sProductFilePath = @WindowsDir Global $sProductFileName = "Notepad.exe" Global $sProductName = FileGetVersion($sProductFilePath & "\" & $sProductFileName, "ProductName") Global $hProcessWnd, $aProcessList, $idMsgBox Global $iTimerInit = TimerInit() Global $iIdleTime = _Timer_GetIdleTime() While 1 $aProcessList = ProcessList($sProductFileName) If $aProcessList[0][0] >= 2 Then $idMsgBox = MsgBox(48, $sProductName, "Multiple Licenses Detected" & @CRLF & @CRLF & "Due to license limitations only one copy of " & $sProductName & " is allowed." & @CRLF & @CRLF & "Please close additional copies of " & $sProductName) $iTimerInit = TimerInit() ContinueLoop EndIf $iProcessId = ProcessExists($sProductFileName) If $iProcessId Then $iIdleTime = _Timer_GetIdleTime() $hProcessWnd = _GetHwndFromPID($iProcessId) If WinActive($hProcessWnd ) Then $iTimerInit = TimerInit() EndIf ;~ If the timer is more than 40 minutes then send message to user and close the process, otherwise it closes within 5 minutes If TimerDiff($iTimerInit) >= 40 * 60 * 1000 Or $iIdleTime >= 40 * 60 * 1000 Then $idMsgBox = MsgBox(48, $sProductName, $sProductName & " has been idle for more than 40 minutes and will be closed in 5 minutes if no activity is detected.", 300) If $idMsgBox = -1 Then ProcessClose($sProductFileName) EndIf EndIf Sleep(100) WEnd ;Function for getting HWND from PID Func _GetHwndFromPID($_iProcessId) Local $_hProcessWnd Local $iWinList, $_aWinList = WinList() For $i = 1 To $_aWinList[0][0] If $_aWinList[$i][0] <> "" Then $iWinList = WinGetProcess($_aWinList[$i][1]) If $iWinList = $_iProcessId Then $_hProcessWnd = $_aWinList[$i][1] ExitLoop EndIf EndIf Next Return $_hProcessWnd EndFunc;==>_GetHwndFromPID
    1 point
  7. @AdamUL You'll have to assign those commands to a variable, or enclose in parentheses, as otherwise it's an invalid line. /AutoIt3ExecuteLine "$v = Opt('SendKeyDelay', 150) & Send('Hello World!')" OR /AutoIt3ExecuteLine "(Opt('SendKeyDelay', 150) & Send('Hello World!'))"
    1 point
  8. One way is to use operators. There are multiple ways of doing this. Give this a try. AutoIt3 /AutoIt3ExecuteLine "(Opt('SendKeyDelay', 150) + Send('Hello World!'))" Adam
    1 point
  9. Your _FFCmd looks ok to me. Any meaningful content showing in the Scite output window? Hint: Use the console in the Developer Tools (hit F12 to activate) to figure out the correct syntax. You can right click on an element and then select "Use in console". This will give you a variable (likely temp0) that you can use for testing. Once you get it working in the console, then you can implement using _FFXpath / _FFCmd.
    1 point
×
×
  • Create New...