Jump to content

Need help with this script!!


Go to solution Solved by JonBMN,

Recommended Posts

Hello everyone! I'm just learning Autoit and it's great. I create a simple script to log into my yahoo mail. Everything seem ok but there's room for improvement. Here's what I got and here's what I wanted it to accomplished. I create a GUI with one simple button for me to press and it will automatically log me into yahoo mail. So from that point on everything is great. The problem occur when I tried to write a script for the keep me sign in checkbox. The checkbox get checked but now it won't submit and log me in. I've tried a few things but couldn't find a solution. I know I'm just learning Autoit can someone guide or tell me the right way of writing my script. Any suggestion will be appreciated. Here's what my script look like.

 

#include <ie.au3>
#include <GUIConstantsEx.au3>
#include <GUIButton.au3>
#include <WindowsConstants.au3>

$GUI=GUICreate("Yahoo", 1700, 940)

$oIE=_IECreateEmbedded()
GUICtrlCreateObj($oIE,10,10,1490,920)
_IENavigate($oIE, '[url=https://login.yahoo.com/')]https://login.yahoo.com/')[/url]

GUICtrlCreateInput("", 112, 40, 257, 21)
GUICtrlSetTip(-1, "NetApp")
$Button1 = GUICtrlCreateButton("Yahoo", 1570, 290, 120, 20, $WS_Group)

GUISetState()

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit
        Case $msg = $button1
            _IENavigate($oIE, '[url=https://login.yahoo.com/config/login?.src=fpctx&.intl=us&.done=http%3A%2F%2Fwww.yahoo.com%2F')]https://login.yahoo.com/config/login?.src=fpctx&.intl=us&.done=http%3A%2F%2Fwww.yahoo.com%2F')[/url]



Local $username = _IEGetObjByName ($oIE,"login")
Local $password = _IEGetObjByName ($oIE,"passwd")
Local $button = _IEGetObjByName ($oIE, ".save")

_IEFormElementSetValue ($username,"MyUsername")
_IEFormElementSetValue ($password,"MyPassword")

$oButton = _IEGetObjById($oIE, "pLabelC")
$oButton.Focus()
$oButton.Click()
sleep(500)
_IEFormImageClick($oIE, "submit","alt")
Sleep (1000)


ControlClick("Window title", "", "[classname provided by AutoitINFO]")


EndSelect
WEnd
Edited by Melba23
Added code tags
Link to comment
Share on other sites

  • Moderators

OneSolution,

Please give your threads descriptive titles - everyone here needs help. ;)

And when you post code please use Code tags - see here how to do it. Then you get a scrolling box and syntax colouring as you can see above now I have added the tags. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

OneSolution,

Please give your threads descriptive titles - everyone here needs help. ;)

And when you post code please use Code tags - see here how to do it. Then you get a scrolling box and syntax colouring as you can see above now I have added the tags. :)

M23

Thank you for the headup. I was wondering how I'm supposed to post the code. :sweating:

Link to comment
Share on other sites

  • Solution

This line needs to be fixed, also if I'm not mistaken the [url=] is not needed.

_IENavigate($oIE, '[url=https://login.yahoo.com/')]https://login.yahoo.com/')[/url]

Here is a correct example.

_IENavigate($oIE, "https://login.yahoo.com/")

EDIT: Added line solution; this should help you with the other call to

_IENavigate()
Edited by JonBMN
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...