Jump to content

first code help (I DID IT "yahoo")


Recommended Posts

I have completed my code sucessfully all the way through "log-out"

I would like to thank Goldnix for his patience and support,

Also A thank you to JohnOne for inspiring me to attempt this on my own (your encouragement was all I needed)

All I have to do now is find a way to set variables for certain fields to pull them from SQl and figure out running it in a loop until all press releases are sent correctly.

I know many challenges are ahead but was thrilled about getting this far!!

Also, hats off to Autoit developer...This stuff is fun :(

Steve

OK,

I have a program that browses to a website and then logd in.

I have it working right up to the "submit part.

If I remove this line of code

_IEFormSubmit ($oForm)

it places correct user and PW in the fields and I can manually hit the "login" button and it logs in.

when I put it back in it appears to put the data in the fields, but then just goes back to regular login screen with blank boxes.

Here is the HTML

<form action="./ucp.php?mode=login" method="post" id="login">
<div class="panel">
    <div class="inner"><span class="corners-top"><span></span></span>
 
    <div class="content">
        <h2>Login</h2>
        
        <fieldset class="fields1">
                <dl>
            <dt><label for="username">Username:</label></dt>
            <dd><input type="text" tabindex="1" name="username" id="username" size="25" value="" class="inputbox autowidth" /></dd>
        </dl>
        <dl>
            <dt><label for="password">Password:</label></dt>
            <dd><input type="password" tabindex="2" id="password" name="password" size="25" class="inputbox autowidth" /></dd>

Any suggestions as to what else I can try?

This is the very first cose I have ever attempted to write so sorry if it's a easy answer.

Steve

Edit: to add HTML code

Edited by slamothe
Link to comment
Share on other sites

My personal log in script looks like this, try it out.

;## Log in first
;~ -----------------------
;~ #cs
    $oIE =_IECreate("http://e-hentai.org/?spg=usercp&arg_ucp=training",0,1,1);opens the webpage
    ; get pointers to the login form and username, password and signin fields
    $o_login = _IEGetObjByName($oIE,"ipb_login_username")
    _IEFormElementSetValue ($o_login, "My Usernameeeeeee")

    $o_password = _IEGetObjByName($oIE,"ipb_login_password")
    _IEFormElementSetValue ($o_password, "MY passwordddd")

    $o_signin=_IEGetObjByName($oIE,"ipb_login_submit")
    _IEAction($o_signin,"click")
    Sleep(2000)
;~ #ce
;~ -----------------------
My Projects:[list][*]Guide - ytube step by step tut for reading memory with autoitscript + samples[*]WinHide - tool to show hide windows, Skinned With GDI+[*]Virtualdub batch job list maker - Batch Process all files with same settings[*]Exp calc - Exp calculator for online games[*]Automated Microsoft SQL Server 2000 installer[*]Image sorter helper for IrfanView - 1 click opens img & move ur mouse to close opened img[/list]
Link to comment
Share on other sites

Thanks Spammer,

I did try your code and I couldn't even get it to hit the website

Your is a little different than the one I'm using and I'm not sure what to modify to get it to work,

The one I have configured is darn close, I just need to get the correct "post" command

I have also tried

_IEFormSubmit ($oForm "click")

_IEAction ($oForm "click")

So far...No Go

But thank you for the input!

Link to comment
Share on other sites

of course its not going to work, its ment to log in on a different website. It was a sample, use it for reference. I was hoping you would do the modifications to the script. All you had to do was replace name of the inputboxes, user & pass. its only 2 words. If you are too lazy to do that. sorry, you are on your own.

There all you need now is to replace the website URL & find out your submit button name.

$oIE =_IECreate("website URL Hire",0,1,1);opens the webpage
$o_signin=_IEGetObjByName($oIE,"Name of the log in form submit button hire")

<dd><input type="text" tabindex="1" name="username" id="username" size="25" value="" class="inputbox autowidth" /></dd>

<dd><input type="password" tabindex="2" id="password" name="password" size="25" class="inputbox autowidth" /></dd>

;## Log in first
;~ -----------------------
;~ #cs
    $oIE =_IECreate("website URL Hire",0,1,1);opens the webpage
    ; get pointers to the login form and username, password and signin fields
    $o_login = _IEGetObjByName($oIE,"username")
    _IEFormElementSetValue ($o_login, "my user name")

    $o_password = _IEGetObjByName($oIE,"password")
    _IEFormElementSetValue ($o_password, "my pass word")

    $o_signin=_IEGetObjByName($oIE,"Name of the log in form submit button hire")
    _IEAction($o_signin,"click")
    Sleep(2000)
;~ #ce
;~ -----------------------
Edited by goldenix
My Projects:[list][*]Guide - ytube step by step tut for reading memory with autoitscript + samples[*]WinHide - tool to show hide windows, Skinned With GDI+[*]Virtualdub batch job list maker - Batch Process all files with same settings[*]Exp calc - Exp calculator for online games[*]Automated Microsoft SQL Server 2000 installer[*]Image sorter helper for IrfanView - 1 click opens img & move ur mouse to close opened img[/list]
Link to comment
Share on other sites

Goldenix,

Of course I tried editing your code with my information, I assumed you would know I did THAT much based on the fact I already stated I have a code that is already browsing to the website and inputin username and password...Itt's just not "SUBMITING" it.

I assumed you would know if I had gotten that far I would know to edit yours! :(

I thank you for your efforts to help me, I want to learn HOW..Not have you do it

I was asking for direction.

So here is your code as I have it

;## Log in first
;~ -----------------------
;~ #cs
    $oIE =_IECreate("http://MYSITEURL",0,1.0,1);opens the webpage
    ; get pointers to the login form and username, password and signin fields [font="Lucida Console"](This is what I don't know what to do, I searched "help" but found nothing[/font])
    $oIE = _IECreate($sUrl, 0, 1, 0, 1)
    $o_login = _IEGetObjByName($oIE,"username")
    _IEFormElementSetValue ($o_login, "MYUSERNAME")

    $o_password = _IEGetObjByName($oIE,"password")
    _IEFormElementSetValue ($o_password, "MYPASSWORD")

    $o_signin=_IEGetObjByName($oIE,"login")
    _IEAction($o_signin,"click")
    Sleep(2000)
;~ #ce
;~ -----------------------

Here is error I'm getting:

>"C:\Program Files (x86)\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Users\LAMOTHE\Desktop\login2.au3"    
C:\Users\LAMOTHE\Desktop\login2.au3 (4) : ==> Unknown function name.:
$oIE =_IECreate("http://MYSITEURL",0,1.0,1)
$oIE =^ ERROR
>Exit code: 1    Time: 0.223

Just to be clear: I have changed the URL to "MYSITEURL" :)

Any help you could give to point me in the right direction would be appreciated as was your fist response.

Steve

P.S. My original code still works great right up to the point of "submitting" or "clicking" on login button

Edited by slamothe
Link to comment
Share on other sites

I see you have _IECreate twice in that script.

Anyway, about your own code, you show some page source where you are getting the input field objects and thats all working yes ?

Im no big html expert but the snippet you posted has no reference to a submit or login button, so what exactly defines the submit/login button in the source ?

Edited by JohnOne

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

Hire lol, I made a guide. Should be beginner proof now.

PS: Watch in HD cuz other rez wont show you readable text.!

Edit: yes I used firefox & Installed addon called Firebug. It lets you inspect elements.

http://www.youtube.com/watch?v=r_B7Ct5fekU

Edited by goldenix
My Projects:[list][*]Guide - ytube step by step tut for reading memory with autoitscript + samples[*]WinHide - tool to show hide windows, Skinned With GDI+[*]Virtualdub batch job list maker - Batch Process all files with same settings[*]Exp calc - Exp calculator for online games[*]Automated Microsoft SQL Server 2000 installer[*]Image sorter helper for IrfanView - 1 click opens img & move ur mouse to close opened img[/list]
Link to comment
Share on other sites

I see you have _IECreate twice in that script

Yes, I added that to Golenix's code, I was trying to get the pointers to work. I will remove that line

I believe this is the "submit" button for login

<dd><input type="hidden" name="redirect" value="index.php" />
<input type="hidden" name="sid" value="905beec7abd7011eae40f9ede3d326c3" />
<input type="submit" name="login" tabindex="6" value="Login" class="button1" /></dd>
        </dl>

This is the code I have working right up to the "login" part, I can trigger this code and the only thing it doesnt do is "click" the "login" button. If I maually click on the sites login button after the code runs, I log right in! so I'm missing something on the "submit" line of code I think

working code--sorta of

#include<IE.au3>
$sUsername = "MYUSERNAME"
$sPassword = "MYPASSWORD"
$sUrl = "http://MYURL+ucp.php?mode=login"
$oIE = _IECreate($sUrl, 0, 1, 0, 1)
Sleep(2000)
$oHWND = _IEPropertyGet($oIE, "hwnd")
;WinSetState($oHWND, "",@SW_MAXIMIZE)
$oForm = _IEFormGetObjByName($oIE,"login")
$oUsername = _IEFormElementGetObjByName($oForm, 'username')
$oPassword = _IEFormElementGetObjByName($oForm, "password")
_IEFormElementSetValue($oUsername, $sUsername)
_IEFormElementSetValue($oPassword, $sPassword)
_IEFormSubmit ($oForm)

Do I need to pass the SID somehow?

Thanks for the help,

Steve

Link to comment
Share on other sites

<input type="submit" name="login" tabindex="6" value="Login" class="button1" /></dd>

It should work now, just replace the website URL.

;## Log in first
;~ -----------------------
;~ #cs
    $oIE =_IECreate("website URL Hire",0,1,1);opens the webpage
    ; get pointers to the login form and username, password and signin fields
    $o_login = _IEGetObjByName($oIE,"username")
    _IEFormElementSetValue ($o_login, "my user name")

    $o_password = _IEGetObjByName($oIE,"password")
    _IEFormElementSetValue ($o_password, "my pass word")

    $o_signin=_IEGetObjByName($oIE,"login")
    Sleep(2000)
    _IEAction($o_signin,"click")
 
;~ #ce
;~ -----------------------
Edited by goldenix
My Projects:[list][*]Guide - ytube step by step tut for reading memory with autoitscript + samples[*]WinHide - tool to show hide windows, Skinned With GDI+[*]Virtualdub batch job list maker - Batch Process all files with same settings[*]Exp calc - Exp calculator for online games[*]Automated Microsoft SQL Server 2000 installer[*]Image sorter helper for IrfanView - 1 click opens img & move ur mouse to close opened img[/list]
Link to comment
Share on other sites

<input type="submit" name="login" tabindex="6" value="Login" class="button1" /></dd>

It should work now, just replace the website URL.

;## Log in first
;~ -----------------------
;~ #cs
    $oIE =_IECreate("website URL Hire",0,1,1);opens the webpage
    ; get pointers to the login form and username, password and signin fields
    $o_login = _IEGetObjByName($oIE,"username")
    _IEFormElementSetValue ($o_login, "my user name")

    $o_password = _IEGetObjByName($oIE,"password")
    _IEFormElementSetValue ($o_password, "my pass word")

    $o_signin=_IEGetObjByName($oIE,"login")
    Sleep(2000)
    _IEAction($o_signin,"click")
 
;~ #ce
;~ -----------------------

LOL, I'm sorry Glodenix, But I still get this

>"C:\Program Files (x86)\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Users\LAMOTHE\Desktop\login2.au3"    
C:\Users\LAMOTHE\Desktop\login2.au3 (4) : ==> Unknown function name.:
$oIE =_IECreate("http://MYURL/phpBB_3.0.1/ucp.php?mode=login",0,1,1)
$oIE =^ ERROR
>Exit code: 1    Time: 0.333

I changed the URL and added MY username and password to the code as instructed..Still dies

Link to comment
Share on other sites

#include <IE.au3>  ;<-----Must be included in the beginning of the script or you get unknown function name error

Edited by goldenix
My Projects:[list][*]Guide - ytube step by step tut for reading memory with autoitscript + samples[*]WinHide - tool to show hide windows, Skinned With GDI+[*]Virtualdub batch job list maker - Batch Process all files with same settings[*]Exp calc - Exp calculator for online games[*]Automated Microsoft SQL Server 2000 installer[*]Image sorter helper for IrfanView - 1 click opens img & move ur mouse to close opened img[/list]
Link to comment
Share on other sites

Whoa!!, Just saw your video post, I will add Firefox so I can utilize that feature..Way COOL Thank You!

I believe I have the pointers correct but I must be missing something, I will study the code and help files deeper.

I have found that each road block is a great learning opportunity.

I have a feeling I'm going to have a bunch hear! :(

But this is way cool, You type it, it does it..

Link to comment
Share on other sites

OH!! Thought Autoit was putting it in there for me, Sorry

OK, I added it and the code ran perfect.....

Right up to the same point as the other one, Didn't "click" login button

Screen was ther, user name & PW installed, then nothing?

No errors though! :(

Link to comment
Share on other sites

what is the URL ?

My Projects:[list][*]Guide - ytube step by step tut for reading memory with autoitscript + samples[*]WinHide - tool to show hide windows, Skinned With GDI+[*]Virtualdub batch job list maker - Batch Process all files with same settings[*]Exp calc - Exp calculator for online games[*]Automated Microsoft SQL Server 2000 installer[*]Image sorter helper for IrfanView - 1 click opens img & move ur mouse to close opened img[/list]
Link to comment
Share on other sites

Sorry for the delay, I had a baseball scheduled to photograph and I realized I was way late

had to log off and scram!!

Thats was the problem!!

Thank you Goldenix...

When you asked me what the url was it got me thinking

I was browsing to the login page and was passing the login variable twice.

I removed this from the string <</ucp.php?mode=login>> and it worked perfectly.

Thank you for all of your patience with me,

Thatt feels pretty good when it works correctly.

Steve

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...