Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 07/03/2019 in all areas

  1. matwachich

    Advanced Input Box

    DEPRECATED: see this new UDF
    1 point
  2. use #requireadmin at beginning of script
    1 point
  3. This is not an Autoit3 syntax issue but rather a commandline command issue: Run(@ComSpec & " /c" & $drive & "\W10-NewCPU\defprof.exe <user> /q")  =>  C:\WINDOWS\system32\cmd.exe  /cc:\W10-NewCPU\defprof.exe <user> /q so as indicated: An space is missing between /c en the rest. Use /k while testing so you can see any commandline issues as the comspec windows will remain open. Jos
    1 point
  4. trancexx

    WinHTTP functions

    Look for _WinHttpSimpleReadDataAsync() in the help file that comes with WinHttp.au3 Also read Remarks section for that entry. It explains problems AutoIt internally have. As for the WebSocket, you have examples here on the forum, even in this thread posted by others. But again, AutoIt internally isn't capable of handling it sensibly.
    1 point
  5. @Math43 You can set $_WD_ERROR_MSGBOX to False to hide these message boxes during runtime. I'll have to take a further look at the code to see why it is showing an error on success.
    1 point
  6. don't append the @CRLF to the $Output variable
    1 point
  7. Nine

    TCPRecv and TCPSend

    Receiver should have a loop that resembles to this : Local $sBuffer = Binary (""), $sReceived = Binary ("") Do $sReceived &= $sBuffer $sBuffer = TCPRecv($iSocket, 4096, $TCP_DATA_BINARY) Until $sBuffer = "" or @error Instead of trying to use a huge buffer...
    1 point
  8. i'm kind of struggling trying to understand the concept of GUI parent/child. what is the difference between just creating a secondary GUI, and creating it as a child of the main GUI? would it behave differently? how? what are the pros&cons? under what circumstances would i want to use (or avoid) a child GUI rather than an independent GUI? thanks for any info.
    1 point
  9. Not necessarily, autoit is quite flexible with the gui, let's expand on my previous example and now add some buttons that hide/show the parent GUI, you can see that it still works #include <GUIConstants.au3> Global $iWidth = 800, $iHeight = 600, $bWidth = 140, $bHeight = 30, $cWidth = 300, $cHeight = 150, $mainparentGUI, $childGUI, $parentGUI $mainparentGUI = GUICreate('Example Main Parent GUI', $iWidth, $iHeight, @DesktopWidth/2 - $iWidth/2, @DesktopHeight/2 - $iHeight/2) $iButton = GUICtrlCreateButton('Hide Main Parent GUI', $iWidth/2 - $bWidth/2, $iHeight/2 - $bHeight/2, $bWidth, $bHeight) GUISetState() $childGUI = GUICreate('Example Child GUI', $cWidth, $cHeight, -1, -1, -1, $WS_EX_MDICHILD, $mainparentGUI) $cButton = GUICtrlCreateButton('Show Main Parent GUI', $cWidth/2 - $bWidth/2, $cHeight/2 - $bHeight/2, $bWidth, $bHeight) GUICtrlSetState(-1, $GUI_HIDE) GUISetState() $parentGUI = GUICreate('Example Parent GUI', $cWidth, $cHeight) GUISetState() While 1 $msg = GUIGetMsg(1) Switch $msg[1] Case $mainparentGUI Switch $msg[0] Case $GUI_EVENT_CLOSE GUIDelete($mainparentGUI) Exit Case $iButton GUISetState(@SW_HIDE, $mainparentGUI) GUICtrlSetState($cButton, $GUI_SHOW) EndSwitch Case $childGUI Switch $msg[0] Case $GUI_EVENT_CLOSE GUIDelete($childGUI) Case $cButton GUISetState(@SW_SHOW, $mainparentGUI) GUICtrlSetState($cButton, $GUI_HIDE) EndSwitch Case $parentGUI Switch $msg[0] Case $GUI_EVENT_CLOSE GUIDelete($parentGUI) EndSwitch EndSwitch WEnd A more interesting example and use of Parent/Child GUI is the ability to Lock the parent GUI whilst the Child GUI is active. Note how if you show the child GUI and then click anywhere on the parent GUI the Child GUI will *flash*. This is useful where you don't want a user to dismiss something important... i.e some action needs to be done (e.g. press a button) on the child GUI before the parent GUI is activated again. #include <GUIConstants.au3> Global $iWidth = 800, $iHeight = 600, $bWidth = 200, $bHeight = 30, $cWidth = 300, $cHeight = 150, $mainparentGUI, $childGUI, $parentGUI $mainparentGUI = GUICreate('Example Main Parent GUI', $iWidth, $iHeight, @DesktopWidth/2 - $iWidth/2, @DesktopHeight/2 - $iHeight/2) $iButton = GUICtrlCreateButton('Show Child GUI and Lock Parent GUI', $iWidth/2 - $bWidth/2, $iHeight/2 - $bHeight/2, $bWidth, $bHeight) GUISetState() $childGUI = GUICreate('Example Child GUI', $cWidth, $cHeight, -1, -1, -1, $WS_EX_MDICHILD, $mainparentGUI) $cButton = GUICtrlCreateButton('Hide Child GUI and Unlock Parent GUI', $cWidth/2 - $bWidth/2, $cHeight/2 - $bHeight/2, $bWidth, $bHeight) While 1 $msg = GUIGetMsg(1) Switch $msg[1] Case $mainparentGUI Switch $msg[0] Case $GUI_EVENT_CLOSE GUIDelete($mainparentGUI) Exit Case $iButton GUISetState(@SW_DISABLE, $mainparentGUI) GUISetState(@SW_SHOW, $childGUI) EndSwitch Case $childGUI Switch $msg[0] Case $GUI_EVENT_CLOSE GUIDelete($childGUI) Case $cButton GUISetState(@SW_ENABLE, $mainparentGUI) GUISetState(@SW_HIDE, $childGUI) EndSwitch Case $parentGUI Switch $msg[0] Case $GUI_EVENT_CLOSE GUIDelete($parentGUI) EndSwitch EndSwitch WEnd
    1 point
  10. Re: WS_EX_CONTROLPARENT Greetings GEOSoft and Melba23 @MartinGr you can prevent a child dialog with WS_EX_CONTROLPARENT style from being dragged with a WM_NCHITTEST message handler. some background reference to the issue with the WS_EX_CONTROLPARENT style for anyone else reading this post. without that style, the child dialog is tabbed as one control. see Trac ticket #1115 for the reason this style has the side effect of making an AutoIt class child gui draggable. Ticket #1115 (closed Bug: No Bug) documentation for GuiCreate error http://www.autoitscript.com/trac/autoit/ticket/1115 a modification of GEOSoft's example above showing tabbing between controls on all three forms. ;#include <WinAPI.au3> #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> Opt('MustDeclareVars', 1) Global $Frm_Child_1, $Frm_Child_2 _Main() Func _Main() Local $bShow = False, $Msg Local $Frm_Main = GUICreate("Test Form", 300, 500, -1, -1) GUISetBkColor(0x00FF00) GUICtrlCreateButton("Main", 120, 470, 60, 30) $Frm_Child_1 = GUICreate("First Child", 300, 200, 0, 0, BitOR($WS_CHILD, $WS_TABSTOP), $WS_EX_CONTROLPARENT, $Frm_Main) Local $Btn_Disp = GUICtrlCreateButton("Toggle", 120, 90, 60, 30) GUISetBkColor(0xFF0000) GUISetState(@SW_SHOW, $Frm_Child_1) $Frm_Child_2 = GUICreate("Second Child", 300, 250, 0, 220, BitOR($WS_CHILD, $WS_TABSTOP), $WS_EX_CONTROLPARENT, $Frm_Main) GUISetBkColor(0x0000FF) GUICtrlCreateButton("Button1", 10, 20, 60, 30) GUICtrlCreateButton("Button2", 80, 20, 60, 30) GUICtrlCreateButton("Button3", 160, 20, 60, 30) GUICtrlCreateButton("Button4", 230, 20, 60, 30) GUIRegisterMsg($WM_NCHITTEST, "_WM_NCHITTEST") ;comment this line, and child forms with WS_EX_CONTROLPARENT style are draggable GUISetState(@SW_SHOW, $Frm_Main) While 1 $Msg = GUIGetMsg() Switch $Msg Case -3 Exit Case $Btn_Disp If $bShow Then GUISetState(@SW_HIDE, $Frm_Child_2) Else GUISetState(@SW_SHOW, $Frm_Child_2) EndIf $bShow = NOT $bShow EndSwitch WEnd EndFunc Func _WM_NCHITTEST($hWnd, $iMsg, $iwParam, $ilParam) #forceref $iMsg, $iwParam, $ilParam Switch Number($hWnd) Case Number($Frm_Child_1), Number($Frm_Child_2) ;Local $iCode = _WinAPI_DefWindowProc($hWnd, $iMsg, $iwParam, $ilParam) ;If $iCode = 2 Then Return 1 ;Return $iCode Return 1 EndSwitch Return $GUI_RUNDEFMSG EndFunc
    1 point
×
×
  • Create New...