Jump to content
Sign in to follow this  

Send Keys to Forms (Panels) created in VB

Recommended Posts


Hi Forum,

I have created a VB.net Program in which i have used two panels,

The panels contain two text editors (Editor1, Editor2) in each panel,

I have created 2 buttons in between the panels (1. Save Editor1, 2. Save Editor2),

My requirement is if i click the button (1.Save Editor 1), it shud send CTRL+S to the panel 1 which contains Editor 1, and the same with Editor 2,

The Editor 1 is nothing but notepad++ text editor, i tried to send keys to notepad++ when it opened outside my VBform created Window, it works fine, but if i cal notepad++ inside my VB form, my autoit script not sending keys to the notepad++, i dont know what is the problem, i googled a lot about it, but of no use,

I tried to send keys from VB.net itself and that also failing, please guide me

My Autoit script

Winactivate ("[class:notepad++]")
ControlSend("[class:notepad++]", "", "", "^{s}")


I have attached the screenshot of my VB.net created form

Thanks & Regards

Sathish V.


Share this post

Link to post
Share on other sites

We need to send Ctrl+S combination to the window. Using Send("^s") for this instead of ControlSend() could work.


:bye: Hey there, was I helpful?


My Current OS: Win8 PRO (64-bit); Current AutoIt Version: v3.3.8.1

Share this post

Link to post
Share on other sites

ControlSend should work just fine, you just have your characters to send written wrong, use "^s" instead of "^{s}".

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

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  

  • Similar Content

    • dilligence
      By dilligence
      Hello everyone,
      I could use some help with the following: 
      I'm a speech recognition user and recently I've started to use AutoIt for additional scripting because sometimes it works faster. 
      I would like to create an AutoIt script that will open the Chrome link on my desktop which is a a symbolic link, so that the Chrome cache is on my Ram drive:
      "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --disk-cache-dir="A:\Browser Cache"
      Next I want to send the website address, in this case: https://autochords.com/ (with SendKeys) to the address bar.
      Then another SendKeys to send Enter.
      I want to use this script when I'm working on my girlfriend's computer, where speech recognition isn't installed.
      I could use ShellExecute ("Chrome", "https://autochords.com/") but then it won't run via my ram drive.
      I am a Dragon NaturallySpeaking user. The program has a scripting language similar to VBA. In Dragon the command is as follows:
      HeardWord "open","chrome" ; HeardWord acts as if I literally said "open Chrome" this command opens any desktop shortcut no matter which window I'm working in.
      Wait 1500 
      SendKeys "https://autochords.com/"
      SendKeys "{Enter}"; these last three lines are similar to AutoIt language I think.....
      Any help would be appreciated.

    • xuzo
      By xuzo
      I need to populate my website, and I use {tab}{tab}{tab}{tab} to get to the fields and then fill them with text.
      But I find it a unreliable, is there a way to "Paste" text in all the fields in one shot?
      A little like password managers like Roboform and Last Pass do?
      I there a way to target the field from it's html handle?
    • BobSherman
      By BobSherman
      I am attempting to enter the logon ID and password into the form below and submit it.
      But, I am experiencing an error in IE.au3 whether I use _IEAction to submit a click (which does submit the form) or _IEFormSubmit (which does not submit the form before it errors out).
      The form seems rather simple:
      <form method="post" action="logon_submit.php">
                             <input type="hidden" name="visit" value="sRhvMItOu1hNV_y9t4iB7xhns2UJ0pUIYmpJyy3CivjvGYv0ST1QHY40QP9H5UPTqonadminkin_65dvtXxSIXDPwyFFI6WPVQFmgFtba8vW3OH">
      <table width="100%" border="0" cellpadding="0" align="center" cellspacing="0">
                            <td valign=top><table width="100%" border="0" cellpadding="4" cellspacing="1">
                                  <td align="Right"><b>Username: <span class="style1">*</span></b></td>
                                  <td width="80%"><input type="TEXT" name="user" style="width: 90%;">
                                  <td align="Right"><b>Password: <span class="style1">*</span></b></td>
                                  <td><input type="password" name="pass" style="width: 90%;">
                                  <td align="Right">&nbsp;</td>
                                  <td><input type="submit" name="Submit" value="Submit Form">
                                  <td align="Right">&nbsp;</td>
                                  <td><a href="resetpw.php?visit=sRhvMItOu1hNV_y9t4iB7xhns2UJ0pUIYmpJyy3CivjvGYv0ST1QHY40QP9H5UPTqonadminkin_65dvtXxSIXDPwyFFI6WPVQFmgFtba8vW3OH" class=white>Forgot your password ?</a></td>
      My function to perform the logon is:
      Func StartUp()
         _IELinkClickByText ( $oIE, "Log On" )
         Local $oForm = _IEFormGetCollection($oIE)
         Local $iNumberOfForms = @extended
         For $iForm = 0 To $iNumberOfForms - 1
           $oForm = _IEFormGetCollection($oIE, $iForm)
           Local $oQuery = _IEFormElementGetCollection($oForm)
           Local $iNumberOfFormElements = @extended
           For $iElement = 0 to $iNumberOfFormElements - 1
               Local $oFormElement = _IEFormElementGetCollection($oForm, $iElement )
               If $oFormElement.name = 'user' Then
                  _IEFormElementSetValue ( $oformElement, "xxxxx", 0)
               elseif $oFormElement.name = "pass" Then
                  _IEFormElementSetValue ( $oFormElement, "yyyyy", 0)
                  ; Sleep for 2 seconds.
                  Local $oSubmit = _IEGetObjByName($oIE, "Submit")
                  _IEAction($oSubmit, "click")

      After the submission of the form completes and goes to the next page I'm getting the following error as a popup from AutoIt:

      Line 970 (File "D\Program Files (x86)\AutoIt3\Include\IE.au3"):
      Case $iIndex > -1 And $iIndex < $oObject.elements.length
      Case $iIndex > -1 And $iIndex < $oObject^ ERROR
      Error: The requested actions with this object has failed.

      It's hard to imagine that such a simple form is causing so many problems.
      Any help would be appreciated.
    • trampjuicerocks
      By trampjuicerocks
      You get a full set of results in the webpage - as intended. (The search form part of the code works fine) then you do a _IEloadWait after the _IEAction form Submit.
      But nothing changes in the AutoIt HTML.
      Ok - Found Solution. I mean this must be a common problem.
      Use _IEAttach("Title page")
      That will wait for the results properly. And you can now access them in code.
    • monarch684
      By monarch684
      I need to input text and submit a form that popups.  Here is what I got so far but it is not working.
      ; Find Phone Popup $pIE = WinGetTitle("[Active]") $oForm = _IEFormGetObjByName($pIE,"phoneFindListForm") $oSelect = _IEFormElementGetObjByName($oForm, "searchField0") _IEAction($oSelect, "focus") _IEFormElementOptionSelect($oSelect, "numplan.dnorpattern") When this runs I get the following error.
      IE.au3 T3.0-1 Warning from function _IEFormElementGetObjByName, $_IESTATUS_NoMatch --> IE.au3 T3.0-1 Error from function _IEAction(focus), $_IESTATUS_InvalidDataType --> IE.au3 T3.0-1 Error from function _IEFormElementOptionSelect, $_IESTATUS_InvalidDataType --> IE.au3 T3.0-1 Error from function _IEFormGetObjByName, $_IESTATUS_InvalidDataType --> IE.au3 T3.0-1 Error from function _IEFormElementGetObjByName, $_IESTATUS_InvalidDataType --> IE.au3 T3.0-1 Error from function _IEAction(focus), $_IESTATUS_InvalidDataType --> IE.au3 T3.0-1 Error from function _IEFormElementOptionSelect, $_IESTATUS_InvalidDataType I am thinking my issue is getting the _IEFormGetObjByName() correct and the rest of the script will work.  Once the form is submitted the focus should go back to the original form.

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.