Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 06/28/2023 in all areas

  1. Jos

    Input from command prompt

    Correct and i don't understand the issue with that, but maybe for starters you should define the whole scope of this script to better understanding and maybe better suggestions? Using command line input isn't very 2023.😉
    1 point
  2. Hi pixelsearch, I found another methode for resizing without disabled dummy-label: GUIRegisterMsg($WM_SIZE, "ON_WINDOW_EDIT_RESIZE") Func ON_WINDOW_EDIT_RESIZE($hWnd, $iMsg, $wParam, $lParam) Local $iHeight, $iWidth If $hWnd = $hGlo_WE_GUI Then $iWidth = _WinAPI_LoWord($lParam) $iHeight = _WinAPI_HiWord($lParam) _WinAPI_MoveWindow($hGlo_WE_Control, 0, 0, $iWidth, $iHeight) Return 0 EndIf Return $GUI_RUNDEFMSG EndFunc ;==>ON_WINDOW_EDIT_RESIZE This works excellent in my program. Cheers mike
    1 point
  3. littlebigman, You need to set the $iCompare parameter to 1 - "partial search" - so that the script searches for the word within the text of the element. At the moment you are searching for a n element which has just the single word. #include <Array.au3> Global $aArray[] = [1, 2, 3, 4, ""fred - RESOLUTION"", 5, 6, 7, 8] $iRet = _ArraySearch($aArray, "RESOLUTION", 0, 0, 0, 1) ConsoleWrite(@error & @CRLF) ConsoleWrite($iRet & @CRLF) M23
    1 point
  4. Mike, the following script solves partially your issue. If you immediately drag the horizontal scroll box at its rightmost position, then the horizonal scroll right arrow will be deactivated, as discussed before. But this is not enough, as some other ways of scrolling aren't solved by the script. #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiRichEdit.au3> #include <GuiScrollBars.au3> Global $sText = "", $hGui, $hRichEdit For $n = 2 To 100 $sText &= $n & " - This is a single long line intended to cause a hoizontal scroll bar to appear in the RichEdit control." & @CRLF Next $hGui = GUICreate("Example (" & StringTrimRight(@ScriptName, 4) & ")", 320, 350, -1, -1) $hRichEdit = _GUICtrlRichEdit_Create($hGui, $sText, 10, 10, 300, 220, BitOR($ES_MULTILINE, $WS_VSCROLL, $WS_HSCROLL)) ; _GUICtrlRichEdit_SetEventMask($hRichEdit, BitOR($ENM_SCROLL, $ENM_SCROLLEVENTS)) _GUICtrlRichEdit_SetEventMask($hRichEdit, $ENM_SCROLLEVENTS) GUISetState(@SW_SHOW) $tSCROLLBARINFO = _GUIScrollBars_GetScrollBarInfoEx($hRichEdit, $OBJID_HSCROLL) $iMaxScrollHoriz = $tSCROLLBARINFO.Right - $tSCROLLBARINFO.xyThumbTop - $tSCROLLBARINFO.Left ConsoleWrite("$iMaxScrollHoriz = " & $iMaxScrollHoriz & @crlf & @crlf) GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") While True Switch GUIGetMsg() Case $GUI_EVENT_CLOSE _GUICtrlRichEdit_Destroy($hRichEdit) Exit EndSwitch WEnd Func WM_NOTIFY($hWnd, $iMsg, $iWparam, $iLparam) #forceref $iMsg, $iWparam Local $hWndFrom, $iCode, $tNMHDR, $tMsgFilter, $hMenu $tNMHDR = DllStructCreate($tagNMHDR, $iLparam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hRichEdit Select Case $iCode = $EN_MSGFILTER $tMsgFilter = DllStructCreate($tagMSGFILTER, $iLparam) Switch DllStructGetData($tMsgFilter, "msg") Case $WM_HSCROLL ; 276 Local $iRightScrollThumb = _GUIScrollBars_GetScrollBarXYThumbBottom($hRichEdit, $OBJID_HSCROLL) ConsoleWrite("$iRightScrollThumb = " & $iRightScrollThumb & " / " & _ "$iMaxScrollHoriz = " & $iMaxScrollHoriz & @crlf) If $iRightScrollThumb = $iMaxScrollHoriz Then _GUIScrollBars_EnableScrollBar($hRichEdit, $SB_HORZ, $ESB_DISABLE_RIGHT) Else _GUIScrollBars_EnableScrollBar($hRichEdit, $SB_HORZ, $ESB_ENABLE_BOTH) EndIf Case $WM_VSCROLL ; 277 EndSwitch EndSelect EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY Anyway, that's a start, better than nothing
    1 point
  5. Guess Oscar read the helpfile as it is clearly defined how a msg loop works and no sleep() is needed : https://www.autoitscript.com/autoit3/docs/guiref/GUIRef_MessageLoopMode.htm It is actually discouraged to add any sleep(). 😉
    1 point
  6. Try : #AutoIt3Wrapper_Au3Check_Parameters=-q -d -w 1 -w 2 -w 3 -w 4 -w 6 -w 7 #include <Constants.au3> Global $sCommand, $iPID, $iRetValue $sCommand = "net user " & @UserName $iPID = Run($sCommand, "", @SW_HIDE, BitOR($STDOUT_CHILD, $STDERR_CHILD)) $iRetValue = ProcessWaitClose($iPID) ConsoleWrite("RetValue = " & $iRetValue & @CRLF & _ "Command = " & $sCommand & @CRLF & @CRLF & _ "---------- OUTPUTREAD : ------------ " & @CRLF & _ StdoutRead($iPID) & @CRLF & _ "---------- ERRORREAD : ------------ " & @CRLF & _ StderrRead($iPID) & @CRLF)
    1 point
  7. Here is a script if you really want it ; control key is a @ ; escalator is script Exit https://www.autoitscript.com/autoit3/docs/libfunctions/_IsPressed.htm but as other people suggested you should probably find a better way to fix your issue <Misc.au3> HotKeySet("{ESC}", "TerminateScript") Global $shouldRun = True While $shouldRun If _IsPressed("11") Then ; Check if Control key is pressed Send("@") Sleep(100) ; Pause for 100 milliseconds to prevent rapid repetition EndIf Sleep(10) ; Pause for 10 milliseconds to reduce CPU usage WEnd Func TerminateScript() $shouldRun = False Exit EndFunc let me know if it worked
    1 point
  8. Test the keyboard on another computer and see if the key works
    1 point
  9. Moved to the appropriate forum. Moderation Team
    1 point
  10. Sounds like a broken keyboard, or a messed up windows installation run the keyboard, troubleshooter in windows, and see what it says and see if it fixes it
    1 point
  11. I just did a little search concerning what is discussed in this post. In this MSDN link, we can read what follows, which seems to explain how to always fix this : EnableWindow function ... [in] bEnable Type: BOOL Indicates whether to enable or disable the window... ... If an application is displaying a modeless dialog box and has disabled its main window, the application must enable the main window before destroying the dialog box. Otherwise, another window will receive the keyboard focus and be activated. ... Isn't it exactly what happens in OP's code and also in the 2nd example found in this AutoIt wiki page ? In the example found in the wiki page, the 1st GUI doesn't reappear when the 2nd GUI is closed (assuming there are other non-minimized windows, i.e. Explorer, any Browser, Scite...) Here is a part of the original code in the wiki example : Func gui1()     ...     Case $idButton2         ; Disable the first GUI         GUISetState(@SW_DISABLE, $hGUI1)         gui2()         ; Re-enable the first GUI         GUISetState(@SW_ENABLE, $hGUI1) EndFunc Func gui2()     ...     Case $GUI_EVENT_CLOSE         GUIDelete($hGUI2)         ExitLoop EndFunc If we change this code to what follows, then the 1st GUI will always reappear when the 2nd GUI is closed (tested) : Global $hGUI1  Func gui1()     ...     Case $idButton2         ; Disable the first GUI         GUISetState(@SW_DISABLE, $hGUI1)         gui2() EndFunc Func gui2()     ...     Case $GUI_EVENT_CLOSE         ; Re-enable the first GUI (just before deleting the 2nd GUI +++)         GUISetState(@SW_ENABLE, $hGUI1)         GUIDelete($hGUI2)         ExitLoop EndFunc It works same in OP's code (tested), by transferring the activation code of the main GUI just before closing the pop-up window : ... GUISetState(@SW_ENABLE, $main) GUIDelete($popup) ...
    1 point
  12. $s_String = 'aaa\bbb\ccc' $s_NewString = StringLeft($s_String, StringInStr($s_String, "\", 1, -1)-1) MsgBox(0, "The trimmed string", $s_NewString)
    1 point
×
×
  • Create New...