Leaderboard
Popular Content
Showing content with the highest reputation on 06/28/2023 in all areas
-
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
-
richedit resizable scrollbars
pixelsearch reacted to mike1950r for a topic
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 mike1 point -
[_ArraySearch] Fails finding text
littlebigman reacted to Melba23 for a topic
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) M231 point -
Richedit horizontal scroll right arrow problem
mikell reacted to pixelsearch for a topic
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 nothing1 point -
Ternary line for GUI loop?
littlebigman reacted to Jos for a topic
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 -
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
-
Need a script that type @ - (Moved)
matteus_71 reacted to 20Ice18 for a topic
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 worked1 point -
Need a script that type @ - (Moved)
matteus_71 reacted to Earthshine for a topic
Test the keyboard on another computer and see if the key works1 point -
Need a script that type @ - (Moved)
matteus_71 reacted to Jos for a topic
Moved to the appropriate forum. Moderation Team1 point -
Need a script that type @ - (Moved)
matteus_71 reacted to Earthshine for a topic
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 it1 point -
GUI minimizes automatically for no reason when second gui is closed
sylremo reacted to pixelsearch for a topic
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 -
StringTrimRight until a certain character
ThomasBennett reacted to AspirinJunkie for a topic
$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