Jump to content
Sign in to follow this  
AndreasVliegen

Check If Cursor Is In Inputbox

Recommended Posts

AndreasVliegen

Hello people,

I created this program that sends an Username and a Password from an INI-file to a Webpage

$user = IniRead($installdir & "\Files\Inloggen.ini","Account","User","")
    $pass = IniRead($installdir & "\Files\Inloggen.ini","Account","Pass","")
    
    $browser = RegRead("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\IEXPLORE.EXE", "")
    
    Run('"' & $browser & '"' & "http://teletop.bc-enschede.nl/02start.nsf?Login&lan=NL&RedirectTo=/02start.nsf")

    WinWaitActive("TeleTOP Login -")
    Send($user)
    Send("{TAB}")
    Send($pass)
    Send("{ENTER}")

Sort of an automatic login script, but sometimes the $user and the $pass are typed into the URL bar, so how can I check if the cursor is at the input box on the website?

Part of HTML code of the web page:

<input name="UsernameInput" value="" class="inp" maxlength=256>
<input name="Username" value="" type=hidden></td>        
<input name="Password" value="" type="password" class="inp" maxlength=256>

Cheers,

SteeloXP

Edited by AndreasVliegen

Share this post


Link to post
Share on other sites
seandisanti

Hello people,

I created this program that sends an Username and a Password from an INI-file to a Webpage

$user = IniRead($installdir & "\Files\Inloggen.ini","Account","User","")
    $pass = IniRead($installdir & "\Files\Inloggen.ini","Account","Pass","")
    
    $browser = RegRead("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\IEXPLORE.EXE", "")
    
    Run('"' & $browser & '"' & "http://teletop.bc-enschede.nl/02start.nsf?Login&lan=NL&RedirectTo=/02start.nsf")

    WinWaitActive("TeleTOP Login -")
    Send($user)
    Send("{TAB}")
    Send($pass)
    Send("{ENTER}")

Sort of an automatic login script, but sometimes the $user and the $pass are typed into the URL bar, so how can I check if the cursor is at the input box on the website?

Part of HTML code of the web page:

<input name="UsernameInput" value="" class="inp" maxlength=256>
<input name="Username" value="" type=hidden></td>        
<input name="Password" value="" type="password" class="inp" maxlength=256> 
<input name="RedirectTo" value="/02start.nsf" type=hidden></td>

Cheers,

SteeloXP

if you're using internet explorer, you should check out dale's IE.au3 it will allow you to set the text for the form elements exactly where they should go, just like using a controlsettext with a non browser window.

Share this post


Link to post
Share on other sites
Jynxst

Sounds like the login window might be losing focus for some reason... try this:

WinWait("TeleTOP Login -")
Sleep(500)
WinActivate("TeleTOP Login -")
Send($user)
Send("{TAB}")
Send($pass)
Send("{ENTER}")

The sleep statement might not be necessary - I just added it there to give a buffer between the window appearing and beginning to input to it. You could instead use Opt("WinWaitDelay", 500) if you like this method better.

Share this post


Link to post
Share on other sites
AndreasVliegen

if you're using internet explorer, you should check out dale's IE.au3 it will allow you to set the text for the form elements exactly where they should go, just like using a controlsettext with a non browser window.

Thanks, I think I found this *huge* script / program :)

http://www.autoitscript.com/forum/index.ph...13398&hl=IE.au3

I'm checking which function I need to use :mellow:

If I don't understand, I'll reply here

Thanks and cheers,

SteeloXP

Edited by AndreasVliegen

Share this post


Link to post
Share on other sites
AndreasVliegen

It all works fine! :):o:mellow:

Thanks again! :)

Share this post


Link to post
Share on other sites
seandisanti

It all works fine! :):o:mellow:

Thanks again! :)

glad you figured it out. we're always happy to help.

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  

×