Jump to content
Sign in to follow this  
MikeShevchik

Send a line of text ot whaterve program is open

Recommended Posts

MikeShevchik

Send a line of text ot whaterve program is open, Ive tried the following:

Send("{SHIFTDOWN}t{SHIFTUP}his{SPACE}is{SPACE}a{SPACE}test")

But nothig is typed into the text box on a form

Share this post


Link to post
Share on other sites
Jos

Works fine here.... are you sure the intended program has the focus at the time your script runs?

Edited by Jos

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
MikeShevchik

Here are the steps I take to run the script

1) start notepad

2) click on the Autoit sript I want to run

Nothing is typed into notepad

Share this post


Link to post
Share on other sites
hawky358

The Send() command "sends" to the active window i.e. it simulates typing on the keyboard so you have to activate the window first

Opt("WinTitleMatchMode", 2)
WinActivate("Note")
Send("{SHIFTDOWN}t{SHIFTUP}his{SPACE}is{SPACE}a{SPACE}test")

Share this post


Link to post
Share on other sites
hawky358

Also I don't know if you have a reason for typing the shifts etc.

but you can just use

Send("This is a test")

Share this post


Link to post
Share on other sites
MikeShevchik

What I want to do is be able to goto any web page position the cursor and the run a scritpt, in order to be able to fill in the blanks on lets say a name and address. I dont know in advance what web page is active or what browser that may be active.

Share this post


Link to post
Share on other sites
hawky358

Rather use a hotkey then.

Have the script run in the background and when you select the box you press the appropriate hotkey.

Just don't make the hotkey conflict with another program's hotkey

ex: (the hotkey is Ctrl+1)

HotKeySet ("^1","type")

while 1
    sleep(15)
WEnd


Func type()
    Send("This is a test")
EndFunc
Edited by hawky358

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  

×

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.