nooneclose Posted November 9, 2018 Author Posted November 9, 2018 @Danp2 Well this was a crazy one, but the question has been answered I will change this post to "solved". It would have been nice to figure out how to make the _IEBodyWriteHTML() method work but none the less you have helped me so much. I am very grateful. I am able to send any text to the popup and save it. Thank you again for your hard work and have a great weekend. Here is the final working code. expandcollapse popup#include <OutlookEX.au3> ;Allows the outlook functions #include <IE.au3> ;Allows Internet Explorer functions #include <AD.au3> ;Allows Active Directory functions #include "DTC.au3" ;Allows Custom Date and Time functions #include <Date.au3> ;Allows Date and Time functions #include <DateTimeConstants.au3> ;Allows Date and Time functions #include <StringConstants.au3> ;Allows Certain String functions #include <Array.au3> ;Allows Array functions #include <Misc.au3> ;Allows the "is pressed" function to be used #include <MsgBoxConstants.au3> ;Allows message box to be used #include <Constants.au3> ;Allows constants to be used ;#RequireAdmin ;Requests admin privliges before starting program ;******************************************************************************* ;Closes the script if "End" is pressed ;******************************************************************************* $oMyError = ObjEvent("AutoIt.Error","MyErrFunc") HotKeySet("{END}", "Terminate") Func Terminate() MsgBox($MB_ICONINFORMATION, "DEATH", "Script Stoped!") Exit EndFunc ;******************************************************************************* ; Opens the Maximo Test site and files a New Workorder ;******************************************************************************* ;Start IE at the Maximo Test site from google Sleep(2000) $oIE = _IECreate("http://www.google.com") Sleep(500) _IELoadWait($oIE) $hIE = _IEPropertyGet($oIE, "hwnd") ; Get Handle of the IE window Sleep(500) WinSetState($hIE, "", @SW_MAXIMIZE) ;Wait for a browser page load to complete Sleep(3000) ;Test site _IENavigate($oIE, "https://maximo-demo76.mro.com/maximo/webclient/login/login.jsp?welcome=true") Sleep(8000) _IELoadWait($oIE) ;Attach to a browser control embedded in another window ;Fake site $oIE = _IEAttach("https://maximo-demo76.mro.com/maximo/webclient/login/login.jsp?welcome=true", "url") ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $oIE = ' & $oIE & @CRLF & '>Error code: ' & @error & ' Extended code: 0x' & Hex(@extended) & @CRLF) ;### Debug Console Sleep(2000) ;Store the username and password Local $wUserName = _IEGetObjByName($oIE, "username") Local $wPassword = _IEGetObjByName($oIE, "password") ;Send the username and password _IEFormElementSetValue($wUserName, "maximo") _IEFormElementSetValue($wPassword, "maxpass1") Sleep(3000) ;Clicks the login button Local $wLogin = _IEGetObjById($oIE, "loginbutton") Sleep(500) _IEAction($wLogin, "focus") _IEAction($wLogin, "click") Sleep(500) ;Navigate to the work order tracking application Sleep(3000) Local $wWorkOrderButton = _IEGetObjById($oIE, "m7f8f3e49_ns_menu_WO_MODULE_a") Local $wWorkOrderTrack = _IEGetObjById($oIE, "m7f8f3e49_ns_menu_WO_MODULE_sub_changeapp_WOTRACK_a") Sleep(300) _IEAction($wWorkOrderButton, "focus") _IEAction($wWorkOrderButton, "click") _IEAction($wWorkOrderTrack, "focus") _IEAction($wWorkOrderTrack, "click") Sleep(8000) _IELoadWait($oIE) ;Store the Work order Button ID Local $nWorkOrderB = _IEGetObjById($oIE, "toolactions_INSERT-tbb_anchor") ;Clicks the new work order button Sleep(3000) _IEAction($nWorkOrderB, "focus") _IEAction($nWorkOrderB, "click") Sleep(5000) ;Store the long description button Local $wLongDButton = _IEGetObjById($oIE, "mad3161b5-img2") ;Store the long Description field id Local $wLongD = _IEGetObjById($oIE, "dijitEditorBody") ;Store the ok button id that is in the long description Local $wLongOk = _IEGetObjById($oIE, "m74031266-pb") ;******************************************************************************* ; Send the stored data to the proper field ;******************************************************************************* ;Sends the discription Sleep(2000) Local $wDescription = _IEGetObjById($oIE, "mad3161b5-tb2") _IEFormElementSetValue($wDescription, "HELLO WORLD!") Sleep(2000) ;Click the long description button Sleep(300) _IEAction($wLongDButton, "focus") _IEAction($wLongDButton, "click") Sleep(1000) ;Sends the long description Local $text = "Today is not my day :D" Sleep(500) _IEAction($wLongD, "focus") _IEAction($wLongD, "click") Sleep(500) $oFrame = _IEFrameGetCollection($oIE, 1) ;_IEBodyWriteHTML($oFrame, "Good Morning test 2") Send($text) ;Click the ok button Sleep(2000) _IEAction($wLongOk, "focus") _IEAction($wLongOk, "click") Sleep(3000) ;******************************************************************************* ; Script has finished ;******************************************************************************* Sleep(1000) MsgBox($MB_ICONINFORMATION, "WO_to_FTE_Bot", "Script Finished!") Sleep(1000)
Danp2 Posted November 9, 2018 Posted November 9, 2018 Using Send isn't ideal, since the script will fail if the window loses focus. But sometimes you have to make due with a less than optimal solution. nooneclose 1 Latest Webdriver UDF Release Webdriver Wiki FAQs
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