Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 04/07/2023 in all areas

  1. Maybe because you have 2 nested loops: While 1 ... Do .. Until ... Wend When you exit out of the do loop, it loops forever again in the while loop. Here is a solution: #include <Misc.au3> Local $hDLL = DllOpen("user32.dll") $hTime = TimerInit() Do If TimerDiff($hTime) > 2000 Then Beep(500, 1000) $hTime = TimerInit() EndIf Until _IsPressed("51", $hDLL) DllClose($hDLL)
    1 point
  2. My bad, you're correct. It was very late when I posted and suspected 1.5e3*(7 - 2) could result in 1.3e(3*5) but after trying it yielded the correct result (1.5e3) * 5. What I completely overlooked was that (1 + 2) / 2m would give (1+2) / 2 * 1e-3 that is (being evaluated left to right) ((1 + 2) / 2) * (1e-3). So indeed parenthetising the normalized values is required, like your post demonstrates. Also thanks for pointing out the names for 10⁻³⁰,10⁻²⁷,10²⁷,10³⁰ which I ignored. They have only been introduced in 2022, years after I built my SQLite Units table.
    1 point
  3. Mouse can only interact with the active Window, the one who has the focus, so forget that option. You can use ControlSend or _GuiCtrlEdit_xxxxx functions to send messages to the window. An Option is to move the caret (blinking cursor) on the notepad Window meanwhile it is minimized or not focused and then use these functions: ;notepad.au3 by Lepes ;Creado con ISN Studio AutoIt v. 1.14 ;***************************************** ;Make this script high DPI aware ;AutoIt3Wrapper directive for exe files, DllCall for au3/a3x files #AutoIt3Wrapper_Res_HiDpi=y If not @Compiled then DllCall("User32.dll", "bool", "SetProcessDPIAware") #include <GuiEdit.au3> ; using Standard UDF #include <GUIConstantsEx.au3> #include <GuiEdit.au3> #include <MsgBoxConstants.au3> #include <WindowsConstants.au3> Example_External() Func Example_External() Local $s_Text = 'Find And Replace Example with AutoIt ' & FileGetVersion(@AutoItExe) & @CRLF & _ "this is a test" & @CRLF & _ "this is only a test" & @CRLF & _ "this testing should work for you as well as it does for me" Local $hTitle, $hHandle Local $sTitle = "[CLASS:Notepad]" ; Run("notepad.exe", "", @SW_MAXIMIZE) ;Wait for the window "Untitled" to exist ;WinWait($sTitle) ; Get the handle of a notepad window $hTitle = WinGetHandle($sTitle) If @error Then MsgBox($MB_SYSTEMMODAL, "Error", "A Notepad window must be opened and minimized before running this script") Else $hHandle = ControlGetHandle($hTitle, "", "Edit1") If @error Then MsgBox($MB_SYSTEMMODAL, "Error", "Could not find the correct control") Else ; Set all text _GUICtrlEdit_SetText($hHandle, $s_Text) ;_GUICtrlEdit_Find($hHandle, True) ; move Caret inside the window. _GUICtrlEdit_SetSel($hHandle, 15, 15) ; if the second parameter is greater than the first one, text will be highlighted ;how many lines has the text? $ilines = _GUICtrlEdit_GetLineCount($hHandle) MsgBox(0, "", "notepad has " & $ilines & " lines") ; selecting 5 characters _GUICtrlEdit_SetSel($hHandle, 15, 20) MsgBox(0, "", "Don't click on Accept button, activate Notepad and check that some text is selected!" & @CRLF & "Then click Accept button to continue") ; Replace selected text ; all 5 characters already selected, will be replaced _GUICtrlEdit_ReplaceSel($hHandle, "-TEXT_REPLACED-") ; moving caret to position 40 ; keep in mind that -TEXT_REPLACED- already count!! _GUICtrlEdit_SetSel($hHandle, 40, 40) ; There is not selected text so new text will be inserted at position 40 _GUICtrlEdit_ReplaceSel($hHandle, "-TEXT INSERTED-") ;get all text from the Notepad Window: $sAllText = _GUICtrlEdit_GetText($hHandle) MsgBox(0, "", "whole new text from notepad is: " & @CRLF & $sAllText) $sLine = _GUICtrlEdit_GetLine($hHandle, 0) ; first line is Zero MsgBox(0, "", "First Line (zero based) is : " & @CRLF & $sLine) ; moving caret to position 90 ; keep in mind that -TEXT_REPLACED- already count!! _GUICtrlEdit_SetSel($hHandle, 90, 90) ; What line number am I? $iline = _GUICtrlEdit_LineFromChar($hHandle, 90) + 1 MsgBox(0, "", "I am at line " & $iline & @CRLF & "From now on, click on Notepad title bar to activate and see where is the caret position." & @CRLF & "Don't click inside text area") $ichar = _GUICtrlEdit_LineIndex($hHandle) MsgBox(0, "", "Caret position is now at position " & $ichar) ; Append text to the end of the file, automatically changes the position of the caret _GUICtrlEdit_AppendText($hHandle, ".--New text added to the end") $ichar = _GUICtrlEdit_LineIndex($hHandle) MsgBox(0, "", "Caret position is now at position " & $ichar) EndIf EndIf EndFunc ;==>Example_External There are more _GuiCtrlEdit_xxxx functions, take a look.
    1 point
  4. you can send text inside the minimized window Local $hWnd = WinWait("[CLASS:Notepad]") ControlSend($hWnd, "", "Edit1", "string") or keys Local $hWnd = WinWait("[CLASS:Notepad]") ControlSend($hWnd, "", "Edit1", "{DOWN 3}")
    1 point
  5. the mouse inside the minimized window cannot move, and by simply clicking it, it will get focus and be activated
    1 point
  6. Here is my first pass at the help file. This was more of a learning exercise for me, but I would appreciate any feedback or suggestions. I know I can probably add more details, but I think the meat of it is all there. I used the AutoIt help file for inspiration on formatting. GuiBuilderPlus.chm
    1 point
  7. _IENavigate($object, 'javascript:document.querySelector(".classname").href') easiest method is by far the above. my one lline example simply evals javascript to select the class then returns the href. i know this posst is old but i figured someone might bee interested to know this can be done in one line
    1 point
×
×
  • Create New...