Hello all,
I am a first time coder, started about a week ago I have put together a little script from resources around here. I need help with a simple desktop script which will make my life a little easier.
I have a few blogs and I need to be able to login to them in a couple clicks. The code i'm using doesn't work. I would at some point like to make the URL input a dropdown but for now this is what I have..pheeew
AutoIt
; TEMPLATE ; ; My Wordpress Blog Control ;=========================================================================== #include-once ;=========================================================================== ;Constants ;=========================================================================== ;=========================================================================== ;Include Files ;=========================================================================== #include <GUIConstantsEx.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> #include <Constants.au3> #include <GuiButton.au3> #include<EditConstants.au3> #include <IE.au3> ;=========================================================================== ;Global variables ;=========================================================================== Global $file, $Button2, $msg ;=========================================================================== ;Functions ;=========================================================================== $oIE = _IECreate("") ;==>How can I get this value from the URL input box Func Submit($InputID) $oForm = _IEFormGetObjByName($oIE, "loginform") $ologin = _IEFormElementGetObjByName($oForm, "log") $password = _IEFormElementGetObjByName($oForm, "pwd") _IEFormElementSetValue($ologin, GUICtrlRead($InputID)) _IEFormElementSetValue($password, GUICtrlRead($InputID + 1)) _IEFormSubmit($oForm) EndFunc ;==>Submit ;=========================================================================== ;Main entry ;=========================================================================== ;Create all GUI windows and controls GUICreate("Wordpress Blogs", 497, 183, 276, 147) GUICtrlCreateLabel("URL:", 68, 24, 64, 20) GUICtrlCreateLabel("UserName:", 40, 54, 67, 28) GUICtrlCreateLabel("Password:", 45, 86, 64, 20) Global $Input = GUICtrlCreateInput("", 96, 48, 345, 24) GUICtrlCreateInput("", 96, 80, 345, 24, $ES_PASSWORD) $file = GUICtrlCreateInput("", 96, 18, 345, 24) ;==>URL Input Global $Button1 = GUICtrlCreateButton("Login", 96, 128, 121, 25) Global $Button2 = GUICtrlCreateButton("Connect", 222, 128, 121, 25) ;==>Button to connect to URL GUISetState(@SW_SHOW) $msg = 1 While $msg <> $GUI_EVENT_CLOSE $msg = GUIGetMsg() Select Case $msg = $Button2 _IENavigate($oIE, GUICtrlRead($file)) ExitLoop EndSelect WEnd Login() ;Windows message pump Func Login() While True $nMsg = GUIGetMsg() Switch $nMsg Case -3 Exit Case $Button1 For $i = $Input To $Input + 2 If GUICtrlRead($i) = '' Then GUICtrlSetState($i, 256) ContinueLoop 2 ;256 = GUI_FOCUS EndIf Next Submit($Input) EndSwitch WEnd EndFunc ;==>Login ;Cleanup