jefhal Posted May 5, 2008 Share Posted May 5, 2008 This script helps you login to XM Radio online automatically. It also allows you to close IE and restart XM Radio when it times out. CAUTION!!! This code will ask if you want to shut down IE. Beware that it may close all of your windows, not just the XM window. expandcollapse popup#Region converted Directives from C:\Examples\XMRadioLogReLog.au3.ini #AutoIt3Wrapper_aut2exe=C:\Program Files\AutoIt3\aut2exe\Aut2Exe.exe #AutoIt3Wrapper_outfile=C:\Examples\XMRadioLogReLog.exe #EndRegion converted Directives from C:\Examples\XMRadioLogReLog.au3.ini ; #include <IE.au3> #include <Array.au3> HotKeySet("{ESC}","_terminate") Opt("TrayIconDebug",1) ;;; set variables for first webpage, email, and password $sURL = "http://xmro.xmradio.com/xstream/index.jsp" $my_email = "yourxmemailusername" $my_password = "yourxmpassword" ;;; open the first webpage If WinExists("http://player.xmradio.com") Then $resp = MsgBox(3,"Question:","Click YES to close and restart XMRadio" & @CRLF & "Click NO to just start XMRadio" & @CRLF & "Click CANCEL to quit") If $resp = 6 Then WinClose("http://player.xmradio.com") ElseIf $resp = 7 Then If WinExists("XM Radio - Listen Online - Windows Internet Explorer","Command Bar") Then WinClose("XM Radio - Listen Online - Windows Internet Explorer","Command Bar") EndIf If WinExists("XM Radio - Listen Online - Windows Internet Explorer","Command Bar") Then WinClose("XM Radio - Listen Online - Windows Internet Explorer","Command Bar") EndIf Else Exit 0 EndIf EndIf $oIE = _IECreate($sURL) ;;; get a collection of all of the "input" objects on the page $colInputs = _IETagNameGetCollection($oIE, "INPUT") ;;; find out how many there are $iInputCnt = @extended ;;; if some inputs exist, get the form object and set the values for the two required fields If $iInputCnt Then $o_form = _IEFormGetObjByName($oIE, "login") $o_email = _IEFormElementGetObjByName($o_form, "req-email") $o_password = _IEFormElementGetObjByName($o_form, "req-password1") _IEFormElementSetValue($o_email, $my_email) _IEFormElementSetValue($o_password, $my_password) ;;; click on the submit button to go to log in _IEFormImageClick ($oIE, "btn_submit_yellow.gif", "src") EndIf ;;; wait for above code to open new webpage WinWait("XM Radio - Listen Online - Windows Internet Explorer","Command Bar") Sleep(1000) ;;; attach to the new webpage object $oIE2 = _IEAttach("XM Radio - Listen Online") ;;; click on the "Listen Now" button _IEImgClick ($oIE2, "listen_now.gif", "src") ;;; notify then close the XM login page ToolTip("Loading the XM presets panel") WinWait("XM Radio - Listen Online","",120000) ToolTip("Closing the XM login page") Sleep(2000) WinClose("XM Radio - Listen Online") Exit Func _terminate() Exit 0 EndFunc ...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now