Sign in to follow this  
Followers 0
xuzo

Difference between send and controlsend?

4 posts in this topic

I want to make sure I have this right.

Send is good for let's say you want to type "Hello World" into notepad, because it mimics someone typing?

ControlSend should be used for menus, and commands like copy (Ctrl+C) and keys?:

File > Save As

What is better to copy a line of text?

Send("{CTRLDOWN}c{CTRLUP}")

or

ControlSend("{CTRLDOWN}c{CTRLUP}")

Just making sure I understand the best Sends to use! ;)

Share this post


Link to post
Share on other sites



I believe:

Send will send keys/commands to the active app (and can send ctrl characters)

Control send will send keys/commands to a specific control regardless if it is currently active.

Share this post


Link to post
Share on other sites

Typically, you would always favor the control commands (including ControlSend) over Send. As Shane0000 mentions, with the Control commands you specify the window you want to interact with, making them much more stable than Send.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

Note that ControlSend() can be used to interact with controls that are hidden or that doesn't have focus as well. This, however, is a case by case basis, as there are some applications that require the window to be active in order to interact with the controls.


Spoiler

“Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.”

 

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