Jump to content

Send and ControlSend


gbr
 Share

Recommended Posts

ControlSend() is for sending keys to a particular control. Since key combinations like Win+r or Win+d go to the OS, it does not make sense to pass them to a particular control. For those cases, you should use Send().

If those were just examples, and you are wanting to send keystrokes (in general) to a control,

ControlSend("Title of window control is in", "optional text to further identify the window the control is in", "The ID (name) of the control", "keys to send", 1) ; the final parameter (1) is the same as in Send() to tell autoit to use the "Raw" keys style in your example.
Link to comment
Share on other sites

Hi All:

Thanks a lot for the replies!!!

The AutoIt script is not working on the Locked workstations but I need that as I am running the scripts overnight. I read in the AutoIt wiki that:

Q: Why doesn't my script work on a locked workstation?

A: On locked station any window will never be active (active is only dialog with text "Press Ctrl+Alt+Del") In Windows locked state applications runs hidden (behind that visible dialog) and haven't focus and active status. So generally don't use Send() MouseClick() WinActivate() WinWaitActive() WinActive() etc. Instead use ControlSend() ControlSetText() ControlClick() WinWait() WinExists() WinMenuSelectItem() etc. This way you may have your script resistive against another active windows. It's possible to run such script from scheduler on locked Windows station.

Hence I am trying to use the ControlSend(). My script has commands like Send("#d") and Send("#r") which works normally but fails to start overnight (on a locked workstation)

Any suggestations!!!

Link to comment
Share on other sites

There's absolutely no reason to use the Send command (or by extension ControlSend) to run a program. Use the Run() command and skip using the Start menu run command box to do it.

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

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...