Jump to content

robertocm

Active Members
  • Posts

    210
  • Joined

  • Last visited

Community Answers

  1. robertocm's post in Double click on an item in a list was marked as the answer   
    taietel code adapted for two ListBoxes
    #include <GUIConstantsEx.au3> #include <GUIListBox.au3> #include <WindowsConstants.au3> GUICreate("Form1", 400, 350) $hListBox = GUICtrlCreateList("", 5, 5, 190, 340) Local $t For $i=1 To 10 $t &="Item no."&$i&"|" Next GUICtrlSetData(-1,$t) $mnuLBContext = GUICtrlCreateContextMenu($hListBox) GUICtrlCreateMenuItem("MenuItem3", $mnuLBContext) GUICtrlCreateMenuItem("MenuItem2", $mnuLBContext) GUICtrlCreateMenuItem("MenuItem1", $mnuLBContext) GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") $hListBox_2 = GUICtrlCreateList("", 205, 5, 190, 340) GUICtrlSetData(-1,$t) GUISetState(@SW_SHOW) While 1 Sleep(10) Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam) #forceref $hWnd, $iMsg Local $hWndFrom, $iIDFrom, $iCode, $hWndListBox, $hWndListBox_2 If Not IsHWnd($hListBox) Then $hWndListBox = GUICtrlGetHandle($hListBox) If Not IsHWnd($hListBox_2) Then $hWndListBox_2 = GUICtrlGetHandle($hListBox_2) $hWndFrom = $ilParam $iIDFrom = BitAND($iwParam, 0xFFFF) ; Low Word $iCode = BitShift($iwParam, 16) ; Hi Word Switch $hWndFrom Case $hListBox, $hWndListBox, $hListBox_2, $hWndListBox_2 Switch $iCode Case $LBN_DBLCLK ; Sent when the user double-clicks a string in a list box Switch $iIDFrom Case $hListBox, $hWndListBox ConsoleWrite("ListBox 1 Item " & _GUICtrlListBox_GetCurSel($hListBox) & @CRLF) Case $hListBox_2, $hWndListBox_2 ConsoleWrite("ListBox 2 Item " & _GUICtrlListBox_GetCurSel($hListBox_2) & @CRLF) EndSwitch EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_COMMAND  
  2. robertocm's post in [i am completely beginner] I have question was marked as the answer   
    My first steps would be:
    1. Right click on an empty space on the desktop
    2. New AutoIt v3 Script
    3. Right Click on the created new file
    4. Edit
    5. Paste a simple example like this and save
    #include <File.au3> #include <MsgBoxConstants.au3> Local $sFind = "д" Local $sReplace = "d" Local $sFileName = "test.txt" Local $iRetval = _ReplaceStringInFile($sFileName, $sFind, $sReplace) If $iRetval = -1 Then MsgBox($MB_SYSTEMMODAL, "ERROR", "The pattern could not be replaced in file: " & $sFileName & " Error: " & @error) Exit Else MsgBox($MB_SYSTEMMODAL, "INFO", "Found " & $iRetval & " occurances of the pattern: " & $sFind & " in the file: " & $sFileName) EndIf 6. Create a text file in same location as the script: test.txt
    д some text д more text д 7. Return to the SciTe Editor
    8. Place the cursor on the name of some function and press F1 for HELP File (_ReplaceStringInFile in the example above)
    9. Press F5 for running the script
    10. Repeat again and again: HELP FILE / simple examples for functions / Test ...
×
×
  • Create New...