Created
September 11, 2012 21:13
-
-
Save Protozoid/3702102 to your computer and use it in GitHub Desktop.
Gaia DOM login
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#NoTrayIcon | |
#Region ;**** Directives created by AutoIt3Wrapper_GUI **** | |
#AutoIt3Wrapper_Icon=J:\Dev-Cpp\Icons\mainicon.ico | |
#AutoIt3Wrapper_UseUpx=n | |
#AutoIt3Wrapper_Res_Comment=Made by The Unintelligible | |
#AutoIt3Wrapper_Res_Description=Gaia Online API | |
#AutoIt3Wrapper_Res_Fileversion=0.0.0.1 | |
#AutoIt3Wrapper_Res_LegalCopyright=Copyright © The Unintelligible, 2012. | |
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** | |
;Author: The Unintelligible | |
;Version: v.0.0.1 | |
;Powered by: AutoIt3 | |
#include <IE.au3> | |
Const $SOH = Chr(01), $EOH = Chr(05) | |
If $CmdLine[0] >= 1 Then | |
If $CmdLine[0] > 3 Then | |
ConsoleWrite("+> Terminal error -- maximum command-line parameters exceeded!" & @CRLF) | |
Exit | |
EndIf | |
Else | |
ConsoleWrite("+> Terminal error -- insufficient amount of command-line parameters specified." & @CRLF) | |
Exit | |
EndIf | |
Switch $CmdLine[1] | |
Case '/log-in' | |
$oIE = _IECreate("http://www.gaiaonline.com/auth/login", Default, 0, Default, 0) | |
$strHTML = _IEDocReadHTML($oIE) | |
If StringInStr($strHTML, "Welcome back") Then _IELinkClickByText($oIE, "Logout") | |
$oUser = _IEGetObjById($oIE, "username") | |
_IEFormElementSetValue($oUser, $CmdLine[2]) | |
$oPass = _IEGetObjByID($oIE, "password") | |
_IEFormElementSetValue($oPass, $CmdLine[3]) | |
$oSubmit = _IEGetObjByID($oIE, "signInbutton") | |
_IEAction($oSubmit, "click") | |
Sleep(2000) | |
_IENavigate($oIE, "http://gaiaonline.com/chat/gsi/index.php?m=109") | |
$sSID = StringReplace(_IEBodyReadText($oIE), "109" & $SOH & $EOH & $SOH, '') | |
ConsoleWrite($sSID & @CRLF) | |
Case '/log-out' | |
If StringInStr($strHTML, "Welcome back") Then | |
_IELinkClickByText($oIE, "Logout") | |
Else | |
ConsoleWrite("+> You are already signed out." & @CRLF) | |
EndIf | |
Case '/free' | |
$oIE = 0 | |
ConsoleWrite("+> DOM/IE object successfully liberated!" & @CRLF) | |
Case '/construct' | |
$oIE = _IECreate("http://www.gaiaonline.com/auth/login", Default, 0) | |
If Not @error Then | |
ConsoleWrite("+> Object construction successful!" & @CRLF) | |
Else | |
ConsoleWrite("+> Object construction failed." & @CRLF) | |
EndIf | |
Case '/help' | |
Case Else | |
ConsoleWrite("+> Invalid command specified!" & @CRLF) | |
EndSwitch |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Bawww. No support for AutoIt syntax coloring. I'm all sadface.