Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 02/22/2014 in all areas

  1. So basically check if it exists then subdivide to find which one $sErrorCheck = @error If $sErrorCheck = 1 Then etc etc czardus beat me to it
    1 point
  2. Never check @error for specific value, unless it's absolute necessity for such thing. Just check wheter @error is set. That way your code will be forward compatible. The documentation for the built-in functions often makes mistake saying @error is set to 1, when in fact the correct should have be that @error is set.
    1 point
  3. Hi, Take a look at the helpfile (F1 in SciTE) for the GUIGetMsg or GUICtrlSetOnEvent function. Br, FireFox.
    1 point
  4. Exit

    Where do I report bugs?

    http://www.autoitscript.com/trac/autoit
    1 point
  5. scila1996, You want to write a specific line to a file - I wonder if there is a function in the Help file that looks as if it might help you? Aha, there is "_FileWriteToLine", which strangely enough does exactly what you require. M23
    1 point
  6. From the Help file for ControlSend. This also applies to GUIs not created by the script itself. As a rule of thumb, I always use ControlFocus before "Control" commands. This should work for you. #include <MsgBoxConstants.au3> Example() Func Example() Run("notepad.exe a.txt","", @SW_HIDE) WinWait("a.txt - Notepad") WinSetState("a.txt - Notepad","", @SW_HIDE) Sleep(1000) ControlFocus("a.txt - Notepad", "", "Edit1") Local $value = ControlSend("a.txt - Notepad", "", "Edit1", "^a") Sleep(2000) MsgBox($MB_SYSTEMMODAL, "AutoIt Example", $value) Sleep(1000) ControlFocus("a.txt - Notepad", "", "Edit1") Local $value2 = ControlSend("a.txt - Notepad", "", "Edit1", "^c") Sleep(2000) MsgBox($MB_SYSTEMMODAL, "AutoIt Example", $value2) Sleep(1000) Run("notepad.exe","", @SW_HIDE) WinWait("Untitled - Notepad") WinSetState("Untitled - Notepad","", @SW_HIDE) Sleep(2000) ControlFocus("Untitled - Notepad", "", "Edit1") Local $value3 = ControlSend("Untitled - Notepad", "", "Edit1", "^v") Sleep(1000) MsgBox($MB_SYSTEMMODAL, "AutoIt Example", $value3) Sleep(1000) WinSetState("Untitled - Notepad","", @SW_SHOW) WinSetState("a.txt - Notepad","", @SW_SHOW) EndFunc Adam
    1 point
  7. As your request is not an easy thing to do, this is the smaller you can do : #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <EditConstants.au3> #include <ListViewConstants.au3> #include <GUIListBox.au3> #include <Misc.au3> Local $_sHistory = FileRead("history.txt") Local $_sList = FileRead("list.txt") #Region GUI GUICreate("MyGUI") Global $_iInput1 = GUICtrlCreateInput("", 10, 10, 200, 22) $_iListHistory = GUICtrlCreateList("", 10, 50, 100, 100) GUICtrlSetData($_iListHistory, StringReplace($_sHistory, @CRLF, "|")) $_iListResults = GUICtrlCreateList("", 110, 50, 100, 100) $_hListResults = GUICtrlGetHandle($_iListResults) GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") GUISetState(@SW_SHOW) #EndRegion GUI While GUIGetMsg() <> $GUI_EVENT_CLOSE WEnd GUIDelete() Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam) Local $iCtrlID = BitAND($wParam, 0x0000FFFF) Local $iCode = BitShift($wParam, 16) Local Static $fMyInputHasFocus = False Switch $iCtrlID Case $_iInput1 Switch $iCode Case $EN_CHANGE _Intellisense() Case $EN_SETFOCUS $fMyInputHasFocus = True Case $EN_KILLFOCUS $fMyInputHasFocus = False EndSwitch Case $_iListHistory Switch $iCode Case $LVNI_FOCUSED GUICtrlSetData($_iInput1, GUICtrlRead($_iListHistory)) _Intellisense() EndSwitch Case 1 If $fMyInputHasFocus And _IsPressed("0D") Then Local $s = GUICtrlRead($_iInput1) $_sHistory &= $s & @CRLF FileWriteLine("history.txt", $s) _GUICtrlListBox_AddString(GUICtrlGetHandle($_iListHistory), $s) EndIf EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_COMMAND Func _Intellisense() _GUICtrlListBox_BeginUpdate($_hListResults) _GUICtrlListBox_ResetContent($_hListResults) Local $s = GUICtrlRead($_iInput1) If $s <> "" Then $a = StringRegExp($_sHistory, "(?m)^.*\Q" & $s & "\E.*$", 3) If IsArray($a) = 1 Then For $i = 0 To UBound($a) - 1 _GUICtrlListBox_AddString($_hListResults, $a[$i]) Next EndIf EndIf _GUICtrlListBox_EndUpdate($_hListResults) EndFunc ;==>_Intellisense In the leftbox the history and in the rightbox the results Press ENTER to save the input in the history If you want to make it user friendly it will require some few lines Br, FireFox.
    1 point
  8. Danp2

    Dern those databases!

    Try: $objCN.Open($SQLString)
    1 point
×
×
  • Create New...