Jump to content
Sign in to follow this  
Dethredic

Odd Problem - Javascript

Recommended Posts

Dethredic

Ok, I need to automate a login, and I will make some tray commands to make life easier, but I have this problem:

#include <IE.au3>

Dim $url = "http://armedhosting.com/livesupport/admin/index.php" 
Dim $title = "Armed Hosting - Live Support Solution (Powered By Help Center Live) - Microsoft Internet Explorer" 
Dim $title2 = "http://armedhosting.com - Armed Hosting - Live Support Solution (Powered By Help Center Live) - Microsoft Internet Explorer" 
Dim $username = "*******" 
Dim $password = "********" 

;Login
$oIE = _IECreate($url, 0, 1, 1, -1)
$read = _IEBodyReadText($oIE)
$search = StringInStr($read, "Login", 0)
If $search = 15 Then
    ControlSend($title, "", "", "{tab}")
    ControlSend($title, "", "", "{tab}")
    ControlSend($title, "", "", $username)
    ControlSend($title, "", "", "{tab}")
    ControlSend($title, "", "", $password)
    ControlSend($title, "", "", "{enter}")
EndIf
_IELoadWait($oIE)
_IENavigate($oIE, "java script:Monitor.launch();"); THIS OPENS AND WORKS ; WINDOW A - reference below
MsgBox(0, "", ""); THIS DOES NOT WORK

As you can see, It opens the javascript window fine, but the msgbox doesn't work. The program continues to run, until I quit it manually. Also, there is a picture in window A, which does not load, and whenever I right click and go show image, it doesn't help, could that be the problem?

Edited by Dethredic

"Its not about the 30 inch 1080p display, or the SLI 8800 ultras, or the DDR3 memory. It's about when you turn on your PC, does it return the favor?"Math is like sex. Sure, it may give some practical results, but that is not why we do it

Share this post


Link to post
Share on other sites
DaleHohm

Most likely the javascript has control and will not return control back to your script until its operation is complete. If this is the case you'll need to find another way to activate that window -- like a mouse click or sending ENTER. See the second example for _IEAction

Dale


Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post


Link to post
Share on other sites
Nahuel

It does show up here...

Share this post


Link to post
Share on other sites
Dethredic

It does show up here...

what do you mean? You could not have possibly loaded the javascript window, because you need to login to do that.

Edited by Dethredic

"Its not about the 30 inch 1080p display, or the SLI 8800 ultras, or the DDR3 memory. It's about when you turn on your PC, does it return the favor?"Math is like sex. Sure, it may give some practical results, but that is not why we do it

Share this post


Link to post
Share on other sites
Nahuel

Yeah, I meant that it did show up.

May I ask why you are doing this:

ControlSend($title, "", "", "{tab}")
    ControlSend($title, "", "", "{tab}")
    ControlSend($title, "", "", $username)
    ControlSend($title, "", "", "{tab}")
    ControlSend($title, "", "", $password)
    ControlSend($title, "", "", "{enter}")

Instead of this:

$oUSER=_IEGetObjByName($oIE,"username")
    $oPASS=_IEGetObjByName($oIE,"password")
    $oSUB=_IEGetObjByName($oIE,"submit")
    
    _IEFormElementSetValue($oUSER,"my username")
    _IEFormElementSetValue($oPASS,"my password")
    _IEAction($oSUB,"click")

It just seems easier for me.

Edited by Nahuel

Share this post


Link to post
Share on other sites
Dethredic

maybe, but yours doesn't click the button anyways.

it returns this after the click

3 ($_IEStatus_InvalidDataType) = Invalid Data Type


"Its not about the 30 inch 1080p display, or the SLI 8800 ultras, or the DDR3 memory. It's about when you turn on your PC, does it return the favor?"Math is like sex. Sure, it may give some practical results, but that is not why we do it

Share this post


Link to post
Share on other sites
Dethredic

this line works, if anyone is interested. (replace the java script one)

_IELinkClickByText($oIE, "Live Help")


"Its not about the 30 inch 1080p display, or the SLI 8800 ultras, or the DDR3 memory. It's about when you turn on your PC, does it return the favor?"Math is like sex. Sure, it may give some practical results, but that is not why we do it

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  

×