Sign in to follow this  
Followers 0
armoros

ControlSendPlus.au3 ?

7 posts in this topic

Does anyone knows where to find this udf ControlSendPlus.au3, i searched the forum and noticed that it was included in but this is not supported from the dev team anymore.

I wanted to test this script but no luck.

#include <GUIConstants.au3>
#include <ControlSendPlus.au3>
Opt("SendKeyDelay", 40)
Global $BtnListDisk
$hGUI = GUICreate("DispartGUI - 1.00", 850, 600, -1, -1, BitOr($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_CLIPCHILDREN))
$PID    = Run(@comspec & " /c Diskpart", "", @SW_HIDE)  ;   Run(@ComSpec & " /c " & 'command', "", @SW_HIDE)
$hWnd   = 0
$stPID  = DllStructCreate("int")
$BtnListDisk = GUICtrlCreateButton("List Disk", 25, 65, 100, 25)
GUICtrlSetTip(-1, "Click here to set retreive disk details")
GUICtrlSetResizing ($BtnListDisk,$GUI_DOCKHEIGHT+$GUI_DOCKVCENTER+$GUI_DOCKWIDTH)

Do
    $WinList = WinList()
    For $i = 1 To $WinList[0][0]
        If $WinList[$i][0] <> "" Then
            DllCall("user32.dll", "int", "GetWindowThreadProcessId", "hwnd", $WinList[$i][1], "ptr", DllStructGetPtr($stPID))
            If DllStructGetData($stPID, 1) = $PID Then
                $hWnd = $WinList[$i][1]
                ExitLoop
            EndIf
        EndIf
    Next
    Sleep(100)
Until $hWnd <> 0
$stPID = 0
If $hWnd <> 0 Then
    $nExStyle = DllCall("user32.dll", "int", "GetWindowLong", "hwnd", $hWnd, "int", -20)
    $nExStyle = $nExStyle[0]
    DllCall("user32.dll", "int", "SetWindowLong", "hwnd", $hWnd, "int", -20, "int", BitOr($nExStyle, $WS_EX_MDICHILD))
    DllCall("user32.dll", "int", "SetParent", "hwnd", $hWnd, "hwnd", $hGUI)
    WinSetState($hWnd, "", @SW_SHOW)
    WinMove($hWnd, "", 245, 25, 600, 400)
EndIf
GUISetState()
While 1
    $msg = GUIGetMsg()
    If $msg = -3 Then ExitLoop
    Select
        Case $msg = $btnListDisk
        ;ControlFocus("Untitled - Notepad", "", "Edit1")
        ;$a = ControlGetFocus("C:\WINDOWS\system32\cmd.exe", "")
        ;MsgBox(0, "test", $a)
        ;ControlFocus("C:\WINDOWS\system32\cmd.exe", "", "Edit1")
        ;WinActivate("C:\WINDOWS\system32\cmd.exe", "")
            WinWaitActive("classname=ConsoleWindowClass", "")
            WinActivate("classname=ConsoleWindowClass")
            ControlsendPlus("classname=ConsoleWindowClass", "", "", "List Disk{ENTER}", 0)
;MsgBox(0, "test", "test")
    EndSelect

WEnd

[font="verdana, geneva, sans-serif"] [/font]

Share this post


Link to post
Share on other sites



has long become a part of AutoIt's UDF libraries. What function is missing when you drop line "#include <ControlSendPlus.au3>" and run your script?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Thank you water for the info...

When i drop <ControlSendPlus.au3> i still have a lot of errors probably because the script is 6 years old...I will try to clear it.

Thank you again

>Running AU3Check (1.54.22.0)  from:C:\Documents and Settings\Georgios\Desktop\A\Autoit_3.3.8.1
C:\Documents and Settings\Georgios\Desktop\A\Autoit_3.3.8.1\Test Scripts\test.au3(7,79) : WARNING: $WS_MINIMIZEBOX: possibly used before declaration.
$hGUI = GUICreate("DispartGUI - 1.00", 850, 600, -1, -1, BitOr($WS_MINIMIZEBOX,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Documents and Settings\Georgios\Desktop\A\Autoit_3.3.8.1\Test Scripts\test.au3(7,92) : WARNING: $WS_CAPTION: possibly used before declaration.
$hGUI = GUICreate("DispartGUI - 1.00", 850, 600, -1, -1, BitOr($WS_MINIMIZEBOX, $WS_CAPTION,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Documents and Settings\Georgios\Desktop\A\Autoit_3.3.8.1\Test Scripts\test.au3(7,103) : WARNING: $WS_POPUP: possibly used before declaration.
$hGUI = GUICreate("DispartGUI - 1.00", 850, 600, -1, -1, BitOr($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Documents and Settings\Georgios\Desktop\A\Autoit_3.3.8.1\Test Scripts\test.au3(7,116) : WARNING: $WS_SYSMENU: possibly used before declaration.
$hGUI = GUICreate("DispartGUI - 1.00", 850, 600, -1, -1, BitOr($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Documents and Settings\Georgios\Desktop\A\Autoit_3.3.8.1\Test Scripts\test.au3(7,134) : WARNING: $WS_CLIPCHILDREN: possibly used before declaration.
$hGUI = GUICreate("DispartGUI - 1.00", 850, 600, -1, -1, BitOr($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_CLIPCHILDREN)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Documents and Settings\Georgios\Desktop\A\Autoit_3.3.8.1\Test Scripts\test.au3(38,117) : WARNING: $WS_EX_MDICHILD: possibly used before declaration.
    DllCall("user32.dll", "int", "SetWindowLong", "hwnd", $hWnd, "int", -20, "int", BitOr($nExStyle, $WS_EX_MDICHILD)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Documents and Settings\Georgios\Desktop\A\Autoit_3.3.8.1\Test Scripts\test.au3(7,79) : ERROR: $WS_MINIMIZEBOX: undeclared global variable.
$hGUI = GUICreate("DispartGUI - 1.00", 850, 600, -1, -1, BitOr($WS_MINIMIZEBOX,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Documents and Settings\Georgios\Desktop\A\Autoit_3.3.8.1\Test Scripts\test.au3(7,92) : ERROR: $WS_CAPTION: undeclared global variable.
$hGUI = GUICreate("DispartGUI - 1.00", 850, 600, -1, -1, BitOr($WS_MINIMIZEBOX, $WS_CAPTION,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Documents and Settings\Georgios\Desktop\A\Autoit_3.3.8.1\Test Scripts\test.au3(7,103) : ERROR: $WS_POPUP: undeclared global variable.
$hGUI = GUICreate("DispartGUI - 1.00", 850, 600, -1, -1, BitOr($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Documents and Settings\Georgios\Desktop\A\Autoit_3.3.8.1\Test Scripts\test.au3(7,116) : ERROR: $WS_SYSMENU: undeclared global variable.
$hGUI = GUICreate("DispartGUI - 1.00", 850, 600, -1, -1, BitOr($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Documents and Settings\Georgios\Desktop\A\Autoit_3.3.8.1\Test Scripts\test.au3(7,134) : ERROR: $WS_CLIPCHILDREN: undeclared global variable.
$hGUI = GUICreate("DispartGUI - 1.00", 850, 600, -1, -1, BitOr($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_CLIPCHILDREN)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Documents and Settings\Georgios\Desktop\A\Autoit_3.3.8.1\Test Scripts\test.au3(38,117) : ERROR: $WS_EX_MDICHILD: undeclared global variable.
    DllCall("user32.dll", "int", "SetWindowLong", "hwnd", $hWnd, "int", -20, "int", BitOr($nExStyle, $WS_EX_MDICHILD)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Documents and Settings\Georgios\Desktop\A\Autoit_3.3.8.1\Test Scripts\test.au3(59,90) : ERROR: ControlsendPlus(): undefined function.
            ControlsendPlus("classname=ConsoleWindowClass", "", "", "List Disk{ENTER}", 0)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

[font="verdana, geneva, sans-serif"] [/font]

Share this post


Link to post
Share on other sites

This caused by missing include files. Search the help file for the variable and you will find a topic named "GUI Control Styles". There you'll see which file to include.

Example: $WS_MINIMIZEBOX needs #include <WindowsConstants.au3>


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Thank you water, yes that solved a lot of issues..


[font="verdana, geneva, sans-serif"] [/font]

Share this post


Link to post
Share on other sites

Now only one error message should remain:

ControlsendPlus(): undefined function
but I think it should be easy to replace with ControlSend.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Now only one error message should remain:

ControlsendPlus(): undefined function
but I think it should be easy to replace with ControlSend.

Yes correct i left it to find it by my self but you done the job again ;)

#include <GUIConstants.au3>
#include <WindowsConstants.au3>
Opt("SendKeyDelay", 40)
Global $BtnListDisk
$hGUI = GUICreate("DispartGUI - 1.00", 850, 600, -1, -1, BitOr($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_CLIPCHILDREN))
$PID    = Run(@comspec & " /c Diskpart", "", @SW_HIDE)  ;   Run(@ComSpec & " /c " & 'command', "", @SW_HIDE)
$hWnd   = 0
$stPID  = DllStructCreate("int")
$BtnListDisk = GUICtrlCreateButton("List Disk", 25, 65, 100, 25)
GUICtrlSetTip(-1, "Click here to set retreive disk details")
GUICtrlSetResizing ($BtnListDisk,$GUI_DOCKHEIGHT+$GUI_DOCKVCENTER+$GUI_DOCKWIDTH)

Do
    $WinList = WinList()
    For $i = 1 To $WinList[0][0]
        If $WinList[$i][0] <> "" Then
            DllCall("user32.dll", "int", "GetWindowThreadProcessId", "hwnd", $WinList[$i][1], "ptr", DllStructGetPtr($stPID))
            If DllStructGetData($stPID, 1) = $PID Then
                $hWnd = $WinList[$i][1]
                ExitLoop
            EndIf
        EndIf
    Next
    Sleep(100)
Until $hWnd <> 0
$stPID = 0
If $hWnd <> 0 Then
    $nExStyle = DllCall("user32.dll", "int", "GetWindowLong", "hwnd", $hWnd, "int", -20)
    $nExStyle = $nExStyle[0]
    DllCall("user32.dll", "int", "SetWindowLong", "hwnd", $hWnd, "int", -20, "int", BitOr($nExStyle, $WS_EX_MDICHILD))
    DllCall("user32.dll", "int", "SetParent", "hwnd", $hWnd, "hwnd", $hGUI)
    WinSetState($hWnd, "", @SW_SHOW)
    WinMove($hWnd, "", 245, 25, 600, 400)
EndIf
GUISetState()
While 1
    $msg = GUIGetMsg()
    If $msg = -3 Then ExitLoop
    Select
        Case $msg = $btnListDisk
        ;ControlFocus("Untitled - Notepad", "", "Edit1")
        ;$a = ControlGetFocus("C:\Windows\System32\cmd.exe", "")
        ;MsgBox(0, "test", $a)
        ;ControlFocus("C:\Windows\System32\cmd.exe", "", "Edit1")
        ;WinActivate("C:\Windows\System32\cmd.exe", "")
            WinWaitActive("classname=ConsoleWindowClass", "")
            WinActivate("classname=ConsoleWindowClass")
            Controlsend("classname=ConsoleWindowClass", "", "", "List Disk{ENTER}", 0)
;MsgBox(0, "test", "test")
    EndSelect

WEnd

[font="verdana, geneva, sans-serif"] [/font]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0