How to clear text in a textbox?

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
aqua267
Junior Coder
Posts: 27
Joined: Thu Aug 19, 2010 7:57 pm

How to clear text in a textbox?

Post by aqua267 » Wed Oct 06, 2010 3:54 pm

I am writing a script to launch a windows application. It requires a username and password to login. My script sends the username and password to the application.

The application stores the username value on first time login. So when I try to login the second time, it fails by sending the same credentials again.
Can I clear out/reset the username column before sending the login credentials every time? How do I clear the contents of username column?

adroege
Automation Wizard
Posts: 438
Joined: Tue Dec 07, 2004 7:39 pm

Post by adroege » Wed Oct 06, 2010 5:09 pm

Every application behaves slightly different, however these are things I would try.

Double click in the field (usually this highlights the text in the field), then do a Press Delete.

If that doesn't work, single click in the field, Press Home, press shift, press end, release shift (this should highlight all the text) then press delete.

Put small wait> statements in between all key presses to give the application time to react accordingly.

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Wed Oct 06, 2010 6:30 pm

CTRL-A also does a select all. So once the field is focused (either via Press Tab or some other method), do:

Press CTRL
Send>a
Release CTRL

And then you can send your input.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

aqua267
Junior Coder
Posts: 27
Joined: Thu Aug 19, 2010 7:57 pm

Post by aqua267 » Thu Oct 07, 2010 9:21 pm

Thanks for your reply. Press tab took me back to the username textbox and I could clear it using highlight and delete button.

bennyn
Newbie
Posts: 9
Joined: Fri Nov 19, 2010 1:00 pm
Contact:

Post by bennyn » Fri Nov 19, 2010 1:12 pm

For the desired scenario I use the following commands:

Code: Select all

    Press End
    Press Shift
    Press Home
    Release Shift
    Press Del
These commands also delete the text of a textbox. But don't forget to give the focus to the textbox. ;)

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts