Jump to content
Sign in to follow this  
BChat

Insert Text Script

Recommended Posts

BChat

My OS = Windows Vista Ultimate. I would like to make a script to insert text (ex: user names and passwords) into web pages. I would like to make a shortcut for the script so all I have to do is click the short cut and the text is inserted into the web page.

Can this be done with AutoIt?

This is my 1st experience at this, so I know NOTHING

;-)

Share this post


Link to post
Share on other sites
Nahuel

Of course it can be done :P And very easily. (Although I believe there's some problems with Vista)

Look in the help file for all the IE functions.

Share this post


Link to post
Share on other sites
AquilaChill

sounds like your looking for a password manager (to put in your login credentials for email or something), i think even ie7 has some kind builtin... (but i think it sucks). i use firefox, i know it has its own, opera has its own last time i used it.

if i missunderstood this then sry, explain it a bit more.


people are anoying, am i? ;) v2.95

Share this post


Link to post
Share on other sites
BChat

sounds like your looking for a password manager (to put in your login credentials for email or something), i think even ie7 has some kind builtin... (but i think it sucks). i use firefox, i know it has its own, opera has its own last time i used it.

if i missunderstood this then sry, explain it a bit more.

I use IE7 & FF - mostly FF. I would like a script/macro that would type/insert text into a field on a web page. IF I go to www.xxx.com and want to insert my user name - I hit a shortcut and the text is inserted into the field.

Edited by BChat

Share this post


Link to post
Share on other sites
BChat

Of course it can be done :P And very easily. (Although I believe there's some problems with Vista)

Look in the help file for all the IE functions.

Sure - ''easily'' for you - not so ''easily'' for me. I don't have 3 eyes to see things.

Share this post


Link to post
Share on other sites
Nahuel

It is easy man. You'll learn fast. The help file has exampls that you can adapt to your needs! and you have the people here who can answer your questions :P

Share this post


Link to post
Share on other sites
BChat

I am not sure what to call the process I am trying to do. I saw the message box "Hello World" tutorial but all I want is the message/text.

Share this post


Link to post
Share on other sites
Nahuel

Could you try this script?

#include <IE.au3>

;Creates an explorer and navigates to the given site
$oIE=_IECreate("https://www.peoplesoft.com/corp/en/login.jsp",1)

$oUser=_IEGetObjByName($oIE,"USER");Gets the username inputbox object
$oPass=_IEGetObjByName($oIE,"PASSWORD");gets the password inputbox object
$oEnter=_IEGetObjByName($oIE,"enter");Gets the enter button object

_IEFormElementSetValue($oUser,"my username");Sets username in the username inputbox
_IEFormElementSetValue($oPass,"mypassword");Sets the password in the password inputbox
_IEAction($oEnter,"click");Clicks on the enter button

Is that what you are trying to do? This will open an internet explorer window, will navigate to that site and will fill in the login form.

Share this post


Link to post
Share on other sites
BChat

Thanks for the reply. All I want is a script that will type "xxxxxx" wherever I run it, whether it be IE, Firefox, or a cell in Excel.

Share this post


Link to post
Share on other sites
Nahuel

Something like this?

HotKeySet("{F7}","User")
HotKeySet("{F8}","Password")
HotKeySet("{F9}","Message")

$user="my username"
$password="password"
$message="Hello world!"

While 1
    Sleep(100)
WEnd

Func User()
    Send($user)
EndFunc

Func Password()
    Send($password)
EndFunc

Func Message()
    Send($message)
EndFunc

Run the script. Then go to some edit control and press F7 to send username, F8 to send password or F9 to send a message.

Edited by Nahuel

Share this post


Link to post
Share on other sites
BChat

Thanks again. I guess I am not explaining myself very well.

Maybe I'll be smarter tomorrow

Share this post


Link to post
Share on other sites
BChat

It's morning, my smartness is still questionable :P

Can I use this function

Send ( "keys" [, flag] )

to insert text?

If I want to insert "BChat", can I replace "keys" with "BChat"?

FWIW, I experimented in both Vista Ultimate and XP Home - I am equally

dumb in both.

Share this post


Link to post
Share on other sites
Nahuel

hehe.

What I gave you there was an example. Pressing F7, F8 and F9 sends different strings to whatever control has focus.

Yes, you can replace that. Send() simulates keystrokes, try it.

Share this post


Link to post
Share on other sites
BChat

OK, 1 step at a time:

1 - I make a script

Send ( "b" [, 0] )

will that send a b to the field/cell where I have the cursor placed?

Thank you for your continued support.

I am a certified by the State Prison System here in the proper application of leg irons and handcuffs -

should ever need any help in THAT area.

:P

Share this post


Link to post
Share on other sites
Nahuel

Just use it like this:

Send("b")

That's the correct syntax. When you see a function description, you'll see sometimes that there are parameters in brackets, like this:

Send ( "b" [, 0] )

They only mean that that parameter is optional, you don't have to type the brackets.

Share this post


Link to post
Share on other sites
BChat

I do that and when I click on the script short cut, the screen flashes - but no ''b'' shows up.

Somewhere on this computer are a bunch of b's - hiding.

Something is wrong with my process. Thanks for your patience.

FYI - when you apply handcuffs - the double bar side goes on the top of the out stretched arm.

the key hole faces up the arm, away from the hand, and you must be sure to double lock them.

:P

Share this post


Link to post
Share on other sites
Nahuel

Well of course, if your script only has: Send("b"), then the 'b' is sent right after you run your script. Try this:

Sleep(5000)
Send("hello there")

Open notepad (or some other program where you can type text in) then run this scrtipt and return to notepad. Make sure you click there so it can type. Sleep(5000) will give you 5 seconds to wait so you can do all that.

Look for Send() in the help file, it has really good examples. Also, look for the Hello World tutorial.

Share this post


Link to post
Share on other sites
BChat

ALRIGHT! ;)

Now I got it - thanks. I now understand what is going on, somewhat, and can build from this.

Thanks again Nahuel.

--- If you ever need to get out of handcuffs, call me :P ---

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  

×