Jump to content

ControlSendPlus.au3 ?


Recommended Posts

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]

Link to comment
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 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
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]

Link to comment
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 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
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 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
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]

Link to comment
Share on other sites

  • 7 years later...

??

#comments-start
ControlSendPlus UDF created by "pekster"
Version: 2.03 (created 06/13/2004 mm/dd/yyyy)
SHORT DESCRIPTION: This function is designed to replace the built-in ControlSend
  function. It will correctly handle the shift state (using the global state to
  send the required keys) as well as the control and alt key modifiers.
USAGE: ControlSendPlus("title", "text", "classnameNN", "string", flag)
  The first 4 text parameters are identical to the ControlSend function.
  The 'flag' parameter is a bit different. Consult the table below. Note that in
    all of these modes the global shift state is used to properly send
    characters.
    0 - Default behavior. Special characters like {ENTER} and {UP} are sent to
      the control. The '!', '^', and '+' are alt, control, and shift
      accordingly. All modifier keys are sent LOCALLY.
    1 - Raw mode. Keys are sent as they appear in the "string" parameter.
    2 - Global mode. Identical to mode 0, but the control and alt keystrokes are
      sent globally. See NOTE 1 below.
    3 - Global Ctrl mode.  Identical to mode 0, but control keystrokes are sent
      globally (alt keystrokes are local.) See NOTE 1 below.
    4 - Global Alt mode.  Identical to mode 0, but alt keystrokes are sent
      globally (control keystrokes are local.) See NOTE 1 below.
RETURN: As of version 2.0.3, this function has the same return as ControlSend.
  Success returns 1, and a failure to find the window or control returns 0. A
  failure is any failure to send any characters, so it is possible for some of
  the characters to get sent, and then the rest fail if the window closes
  during the send process.
KEYBOARD LAYOUTS: This function was designed to be used with the standard QWERTY
  US keyboard layout. If you have a different layout, you may need to change the
  function to properly detect characters that require a shift modifier. To do
  this, you will need to edit the string on line 7 between the single quotes.
  Place each character that requires a shift right after one-another. No further
  changes are required. Don't for get capital letters as well as your symbols!
BRACES ISSUE: This is not a bug, since I designed my function to imitate the
  ControlSend function as much as I could. The issue appears when you enter
  a string such as "{I ACTUALLY WANT BRACES}" with a flag other than 1. The
  proper methods of doing this are to use raw mode, or use the "{{}" and "{}}"
  special characters. However, it may appear as if sections of your string were
  ignored by my function. If this occurs, check your use of braces.
  You can also get strange outputs when you don't match braces, the exception
  being the "{{}" and "{}}" uses. If you need to do this, use flag 1.
NOTE 1: Some applications will not properly use the local alt and/ or control
  keystroke. This is why the additional 3 flags were added. To discover the
  proper flag to use for you particular application, you will have to try out
  the different flags. Sometimes both local and global mode work, and other
  times only one will.
LIMITATIONS: The current version observes the following limitations:
  * You cannot send Chr(5) since this character is use internally by the function
    to denote replaced characters. Attempts to do so could result in an error,
    or unexpected results.
  * The windows key "#" is not supported. In my testing, I was not able to use
    this key properly with my function or the ControlSend function, so I removed
    support for it. If you can give me an example where ControlSend can handle
    it, please email me so that I can release a new version with proper windows
    key support
CONTACT: If you have a suggestion, bug report, or otherwise have a need to
  contact me, You may use the information below. If you find a bug, please
  tell me what text you used as the string parameter, what flag you used, and
  the incorrect output that was returned. It also helps if you list your version
  of the function.
    E-mail: [email="pekster@mail-page.com"]pekster@mail-page.com[/email] (preferred method)
    user "pekster" on the HiddenSoft forums at [url=http://www.hiddensoft.com]www.hiddensoft.com[/url]
ACKNOWLEDGEMENTS: Thanks to all the users on the HiddenSoft forums who supplied
  me with assistance. And a big thanks to Jon, the author of AutoIt version 3.
  [url=http://www.autoitscript.com/autoit3/]www.autoitscript.com/autoit3/[/url]
LEGAL: This function is provided without any warranty. This code cannot do any
  damage to your computer by itself. If you use it in such a way to cause harm
  or damage of any kind, it is your own fault.
  You may edit, modify, or distribute this function as you see fit. I would ask
  that if you find a bug, or a feature that could be added or improved, please
  send me a detailed email so that I can release a new version. The only thing
  you may not do is claim that you wrote this code (although feel free to change
  it for use in your projects.) Always remember to give proper credit if you use
  a major portion of someone else's code.
VERSION HISTORY:
  2.0.3 (06/13/2004)
    * Added: return value to match ControlSend (see RETURN above)
  2.0.2 (06/13/2004)
    * Bug fixed: dimension range error when using raw mode (flag 1)
    * I didn't fully get rid of all the code I should have in the 2.0.1 release
  2.0.1 (06/12/2004)
    * Removed a useless If...Else statement that wasn't needed
  2.0 (06/12/2004)
    * Updated to work with special chars like {UP}, {DOWN}, and {ASC ####}
    * Updated to work with key modifiers such as !, ^, and +
    * 3 flag modes added to take care of global vs local issue (see NOTE 1)
    * Name changed to ControlSendPlus to reflect the ability to use the !, ^,
      and + key modifiers (old name was ShiftControlSend)
  1.0 (06/09/2004)
    First release. No readme, and did not work with any special characters or
    modifier keys.
#comments-end

#include-once
Func ControlSendPlus($title, $text, $className, $string, $flag)
;VERSION 2.0.3 (06/13/2004)
    Local $ctrl = 0, $alt = 0, $upper, $start, $end, $i, $char, $and, $Chr5Index, $isUpper, $ret
    If $flag = 2 Or $flag = 3 Then $ctrl = 1
    If $flag = 2 Or $flag = 4 Then $alt = 1
    If $flag <> 1 Then $flag = 0;set the flag to the default function style
    $upper = StringSplit('~!@#$%^&*()_+|{}:"<>?ABCDEFGHIJKLMNOPQRSTUVWXYZ', "")
    If $flag <> 1 Then;don't replace special chars if it's raw mode
    ;replace {{} and {}} with +[ and +] so they will be displayed properly
        $string = StringReplace($string, "{{}", "+[")
        $string = StringReplace($string, "{}}", "+]")
    ;replace all special chars with Chr(5)
    ;add the special char to an array.  each Chr(5) corresponds with an element
        Local $Chr5[StringLen($string) / 2 + 1]
        For $i = 1 To StringLen($string)
            $start = StringInStr($string, "{")
            If $start = 0 Then ExitLoop;no more open braces, so no more special chars
            $end = StringInStr($string, "}")
            If $end = 0 Then ExitLoop;no more close braces, so no more special chars
        ;parse inside of braces:
            $Chr5[$i] = StringMid($string, $start, $end - $start + 1)
        ;replace with Chr(5) leaving the rest of the string:
            $string = StringMid($string, 1, $start - 1) & Chr(5) & _
                    StringMid($string, $end + 1, StringLen($string))
        Next
    ;take out any "!", "^", or "+" characters
    ;add them to the $Modifiers array to be used durring key sending
        Local $Modifiers[StringLen($string) + 1]
        For $i = 1 To StringLen($string)
            $char = StringMid($string, $i, 1)
            $and = 0
            If $char = "+" Then
                $and = 1
            ElseIf $char = "^" Then
                $and = 2
            ElseIf $char = "!" Then
                $and = 4
            ElseIf $char = "" Then
                ExitLoop
            EndIf
            If $and <> 0 Then
                $Modifiers[$i] = BitOR($Modifiers[$i], $and)
                $string = StringMid($string, 1, $i - 1) & _
                        StringMid($string, $i + 1, StringLen($string))
                $i = $i - 1
            EndIf
        Next
    Else;it is raw mode, so set up an all-0 modifier array
        Local $Modifiers[StringLen($string) + 1]
    EndIf
;now send the chars
    $Chr5Index = 1
    For $i = 1 To StringLen($string)
        $char = StringMid($string, $i, 1)
        If $char = Chr(5) Then
            $char = $Chr5[$Chr5Index]
            $Chr5Index = $Chr5Index + 1
        EndIf
        $isUpper = 0
        For $j = 1 To UBound($upper) - 1
            If $char == $upper[$j] Then $isUpper = 1
        Next
    ;1 SHIFT, 2 CTRL, 4 ALT (programmer note to keep the bits straight)
        If $isUpper = 1 Or BitAND($Modifiers[$i], 1) = 1 Then Send("{SHIFTDOWN}")
        If BitAND($Modifiers[$i], 4) = 4 And Not $alt Then $char = "!" & $char
        If BitAND($Modifiers[$i], 2) = 2 And Not $ctrl Then $char = "^" & $char
        If BitAND($Modifiers[$i], 4) = 4 And $alt Then Send("{ALTDOWN}")
        If BitAND($Modifiers[$i], 2) = 2 And $ctrl Then Send("{CTRLDOWN}")
        $ret = ControlSend($title, $text, $className, $char, $flag)
        If BitAND($Modifiers[$i], 4) = 4 And $alt Then Send("{ALTUP}")
        If BitAND($Modifiers[$i], 2) = 2 And $ctrl Then Send("{CTRLUP}")
        If $isUpper = 1 Or BitAND($Modifiers[$i], 1) = 1 Then Send("{SHIFTUP}")
        If Not $ret Then Return 0;window or control not found
    Next
    Return 1
EndFunc  ;==>ControlSendPlus

 

or:

 

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...