Jump to content

Help with my IE script


Recommended Posts

Hello. I have been playing a game called GunZ for about 1 week in the closed beta and now I'm starting the Live Service on the GunZ. For the time that I've been playing it, I get so annoyed of typing in ijji.com, clicking on the gunz game, then clicking "play live". That is why I have made this easy script for GunZ. This script that I made doesn't have much to it, but it does save SOME time when logging into gunz. What this does is when you double click it, it opens up windows explorer and it will take you to the login page where you enter your account and password so it will save you some steps and time. Well, even though my code is a big "time saver" for me, I would like to find someone who can help me so it will auto fill in the login boxes with my account and password. Therefore, I would only have to click Enter so I wouldn't have to type in my account info everytime. Thanks for the help and if you have any suggestions or questions plz let me know!!

My script code:

#include <IE.au3>

$oIE = _IECreate()
_IENavigate($oIE, "http://login.ijji.com/login.nhn?nextURL=http%3A%2F%2Fgunz.ijji.com%2Findex.nhn")

Exit
Edited by zvision.pro
Link to comment
Share on other sites

Anyone?

The _IEForm* functions have examples in the helpfile of logging in via a web form. Also see the AutoIt Snippets Database (see my sig).

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

Link to comment
Share on other sites

I've tried doing this and it will load up the page but there is no success with the auto-filling of my login information.

Here is the code that I tried it with:

#include <IE.au3>

$oIE = _IECreate()
_IENavigate($oIE, "http://login.ijji.com/login.nhn?nextURL=http%3A%2F%2Fgunz.ijji.com%2Findex.nhm")

; get pointers to the login form and username and password fields
$o_form = _IEFormGetObjByName($oIE, "f1")
$o_login = _IEFormElementGetObjByName($o_form, "login")
$o_password = _IEFormElementGetObjByName($o_form, "passwd")

; Set field values and submit the form
_IEFormElementSetValue($o_login, "accounthere")
_IEFormElementSetValue($o_password, "passwordhere")
Sleep(2000)
_IEFormSubmit($o_form)

Exit
Link to comment
Share on other sites

#include <IE.au3>

$oIE = _IECreate("http://login.ijji.com/login.nhn?nextURL=http%3A%2F%2Fgunz.ijji.com%2Findex.nhm")
;~ _IENavigate($oIE, "http://login.ijji.com/login.nhn?nextURL=http%3A%2F%2Fgunz.ijji.com%2Findex.nhm")

; get pointers to the login form and username and password fields
$o_form = _IEFormGetObjByName($oIE, "form")
$o_login = _IEFormElementGetObjByName($o_form, "memberid")
$o_password = _IEFormElementGetObjByName($o_form, "password")

; Set field values and submit the form
_IEFormElementSetValue($o_login, "accounthere")
_IEFormElementSetValue($o_password, "passwordhere")
;~ Sleep(2000)
_IEFormSubmit($o_form)

Exit

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

If you look at the page source you'll see that the foem name is "form", the username is "memberid" and the password is "password". Update you r code with these values and you should be set.

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

Link to comment
Share on other sites

Hi, Dale,

This is such a regular requirement..

? add to ie.au3?

Func _WebLogin($s_URL, $s_FormName,$s_FormUserObjName,$s_FormPassObjName, $s_Email, $s_Password)
    $o_IE = _IECreate($s_URL, 0, 1)
    $o_Form = _IEFormGetObjByName($o_IE, $s_FormName)
    $o_Name = _IEFormElementGetObjByName($o_Form, $s_FormUserObjName)
    $o_Pass = _IEFormElementGetObjByName($o_Form, $s_FormPassObjName)
    _IEFormElementSetValue($o_Name, $s_Email)
    _IEFormElementSetValue($o_Pass, $s_Password)
    _IEFormSubmit($o_Form, 0)
    _IELoadWait($o_IE, 500)
EndFunc   ;==>_WebLogin
What do you think?

Randall

Link to comment
Share on other sites

@zvision.pro You're welcome

@randallc You're right that it is a common request, but I have a philoophical problem with that level of automation in a UDF. AutoIt is a programming language, not a black box, and people really need to understand what they are doing at some level -- particularly when usernames and passwords are involved. The consequences of not understanding what you are doing in that sort of scenario can be very high.

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

Link to comment
Share on other sites

How can i use AutoIT to authenticate in this page

http://www.tynset.kommune.no/default.asp?WCI=Authenticate

Here is my script:

#include <IE.au3>

$oIE = _IECreate("http://www.tynset.kommune.no/default.asp?WCI=Authenticate")
;~ _IENavigate($oIE, "http://www.tynset.kommune.no/default.asp?WCI=Authenticate")

; get pointers to the login form and username and password fields
$o_form = _IEFormGetObjByName($oIE, "Login")
$o_login = _IEFormElementGetObjByName($o_form, "UserID")
$o_password = _IEFormElementGetObjByName($o_form, "Password")

; Set field values and submit the form
_IEFormElementSetValue($o_login, "myusernamehere")
_IEFormElementSetValue($o_password, "mypasswordhere")
;~ Sleep(2000)
_IEFormSubmit($o_form)

Exit
Link to comment
Share on other sites

How can i use AutoIT to authenticate in this page

http://www.tynset.kommune.no/default.asp?WCI=Authenticate

Here is my script:

#include <IE.au3>

$oIE = _IECreate("http://www.tynset.kommune.no/default.asp?WCI=Authenticate")
;~ _IENavigate($oIE, "http://www.tynset.kommune.no/default.asp?WCI=Authenticate")

; get pointers to the login form and username and password fields
$o_form = _IEFormGetObjByName($oIE, "Login")
$o_login = _IEFormElementGetObjByName($o_form, "UserID")
$o_password = _IEFormElementGetObjByName($o_form, "Password")

; Set field values and submit the form
_IEFormElementSetValue($o_login, "myusernamehere")
_IEFormElementSetValue($o_password, "mypasswordhere")
;~ Sleep(2000)
_IEFormSubmit($o_form)

Exit

Where did you get "Login"? ;) The form has no name, so use indexing (_IEFormGetCollection).

IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font]
Link to comment
Share on other sites

Okay - I'm just now learning to program and also learning auto IT. Can someone point out the form name for the following code to set this up, and then tell me what part it is they're getting it from and why? I think it's inside a frame set. Is there any way to tell what it is inside the frameset?

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<HTML>

<HEAD>

<TITLE>Peregrine Portal</TITLE>

<script type="text/javascript" src="js/setDomain.js"></SCRIPT>

<script src="js/globals.js" type="text/javascript"></SCRIPT>

<script type="text/javascript">

top._RootPage="login.jsp";

top._HomePage="appmenu.jsp";

top._LogoutPage="e_logout_main_auto.do";

top._ExpiredPage="e_logout_main_expired.do";

top._KeepAlivePage="keepalive.jsp";

top._EntryPage = "e_login_main_start.do?";

// Define localized strings to be used in Javascript

top.UpStatusMsg = "Move up";

top.DownStatusMsg = "Move down";

top.RemoveStatusMsg = "Remove";

top.AddStatusMsg = "Add an item";

top.SubStatusMsg = "Remove an item";

top.EditStatusMsg = "Edit";

top.RemoveConfirmStatusMsg = "Remove this component?";

top.SelectAddStatusMsg = "Please select an item to add";

top.SelectStatusMsg = "Please select an item first";

top.HomeMsg = "Home";

top.LogoutMsg = "End your Peregrine Portal Session";

top.FormInfoMsg = "Display Form Info";

top.HelpMsg = "Help topics for the Peregrine Portal";

top.CloseWindowMsg = "Close Window";

function setTopFrames()

{

if( top != this )

{

top.getit_main = this.getit_main;

top.getit_header = this.getit_header;

top.backchannel = this.backchannel;

top.getit_main_head = this.getit_main_head;

}

// Force refresh of header menu. This required to avoid problems when establishing capabilities dynamically.

// Occassionally the menus would not reflect the actual capabilities assigned to the user, particularly when logging in via siteminder or equivalent

top.getit_main_head.postBackChannel("genHeaderMenu.jsp?sourcepage="+top._RootPage);

}

</SCRIPT>

<script src="js/Builder.js" type="text/javascript"></SCRIPT>

<script src="js/TabBuilder.js" type="text/javascript"></SCRIPT>

<script type="text/javascript">top.Cell.prototype.strImagePath = "images/skins/classic/";</SCRIPT>

</HEAD>

<FRAMESET id="oaa_masterFRS" name="oaa_masterFRS"

cols="*" rows="102,*,0"

onload="setTopFrames()"

onunload="closeChildWindows()"

title="OAA Master Frameset"

frameborder="0" framespacing="0" border="0">

<FRAME id="getit_main_head" name="getit_main_head" src="oaa_header.jsp"

title="Header Navigation Frame" scrolling="no" noresize="noresize">

<FRAMESET id="oaa_formsFRS" name="oaa_formsFRS" cols="195,*" rows="*"

title="OAA Forms Frameset">

<FRAME id="getit_header" name="getit_header" src="apphead.jsp"

title="Navigation Frame"

frameborder="0" border="1">

<FRAME id="getit_main" name="getit_main"

src="e_login_main_start.do?" title="Main Frame">

</FRAMESET>

<FRAMESET id="oaa_channelFRS" name="oaa_formsFRS" cols="*" rows="0,0"

title="OAA Channel Frameset"

frameborder="0" framespacing="0" border="0,0">

<FRAME id="backchannel" name="backchannel"

src="backchannel.htm" title="Backchannel Hidden Frame"

noresize="noresize" unselectable="1">

<FRAME id="appchannel" name="appchannel"

src="appchannel.jsp" title="Application Channel Hidden Frame"

noresize="noresize" unselectable="1">

</FRAMESET>

</FRAMESET>

<NOFRAMES>You must use either Internet Explorer 5.0 or Netscape 6.1 and Higher</NOFRAMES>

</HTML>

--------------

Also, I have a specific need to make this autologin prompt me for a username and password every time, but in an inputbox. It's weird, but I'm using this to create a ghetto bookmarking portion of a program I'm making that attaches to a secure database of knowledge documents that the user must log into. I can't circumvent any portion of the security, so I'm making the user enter their credentials each search. It's faster than having no bookmarks.

So I've been trying to figure out how to make two different prompts come up accepting the username and passwords. This doesn't seem to work correctly - can someone correct the code below for that function?

#include <IE.au3>

; Create a browser window and navigate to hotmail

$oIE = _IECreate ("http://www.hotmail.com")

; Get pointers to the login form and username, password, and signin fields

$o_form = _IEFormGetObjByName ($oIE, "f1")

$o_login = _IEFormElementGetObjByName ($o_form, "login")

$o_password = _IEFormElementGetObjByName ($o_form, "passwd")

$o_signin = _IEFormElementGetObjByName ($o_form, "SI")

;these are wrong - I need to know how to make them prompt for input

$username = (InputBox)

$password = (InputBox)

; Set field values and submit the form

_IEFormElementSetValue ($o_login, $username)

_IEFormElementSetValue ($o_password, $password)

_IEAction ($o_signin, "click")

Exit

Thanks in advance for any help or guidance. If I've neglected and information, please let me know.

Thanks!

Jim

Link to comment
Share on other sites

First, it is not a good idea in this forum to jump into an unrelated thread with a new question - much preferred to start a new topic.

That said, please look at _IEFrameGetObjByName() in the helpfile - you'll see the names of the frames easily in what you posted. You need to find the correct frame and then use an object reference to it the same way that $oIE is used in the _IEForm* examples you'll see in the helpfile.

Please open a new topic to continue this question if necessary.

Dale

Edit: typo

Edited by DaleHohm

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

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...