Jump to content

[SOLVED] How to send text to a popup in IE with Autoit


Recommended Posts

I need to send a string of text to this popup and click on the ok button to save it.

Here is the code I have so far:

;Start IE 
Sleep(7000)
$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)
_IENavigate($oIE, "https://properURL.com")
Sleep(8000)
_IELoadWait($oIE)

;Attach to a browser control embedded in another window
$oIE = _IEAttach("https://"properURL.com", url")
ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $oIE = ' & $oIE & @CRLF & '>Error code: ' & @error & '    Extended code: 0x' & Hex(@extended) & @CRLF) ;### Debug Console
Sleep(2000)

;Get the title of the webpage
;Local $wTitle = _IEPropertyGet($oIE, "title")
;MsgBox($MB_SYSTEMMODAL, "Webpage title:", $wTitle)

;Clicks the new button
Sleep(3000)
_IEAction($nWorkOrderB, "focus")
_IEAction($nWorkOrderB, "click")
Sleep(5000)

;Store the Element names where the important data will be sent
;Store the long description button
Local $wLongDButton = _IEGetObjById($oIE, "m65d795a4-img")
;Store the long Description field id
Local $wComments    = _IEGetObjById($oIE, "ma6499a9c-rte_iframe")
;Store the ok button id that is in the long description
Local $wCommOk      = _IEGetObjById($oIE, "m74031266-pb")

;*******************************************************************************
; Send the stored data to the proper field
;*******************************************************************************

;Click the long description button
Sleep(300)
_IEAction($wLongDButton, "focus")
_IEAction($wLongDButton, "click")
Sleep(300)

;Sends the Comments
Sleep(500)
_IEAction($wComments, "focus")
_IEAction($wComments, "click")
Sleep(500)
_IEFormElementSetValue($wComments, "hello darkness my old friend")

;Click the ok button
Sleep(500)
_IEAction($wCommOk, "focus")
_IEAction($wCommOk, "click")
Sleep(500)

 

Here is the popup:

5be33f8118f44_Screenshot(138).png.cd23a99616d58e3cf37331725eca86fd.png

Edited by nooneclose
Link to comment
Share on other sites

  • Moderators

@nooneclose you really need to start engaging the gray matter before you report threads. As for your "his response was mean" report, I have already responded in that thread. As for this one, rather than reporting the thread because you feel the response is "not helpful", why not take the time to read the response (which makes several valid points) and respond. Complaining about those that volunteer their time on this forum is a great way to ensure you receive no help in the future.

If you truly feel a response is not being helpful, try being the opposite of "unnecessary, unhelpful, unprofessional and childish"  and ignore it rather than complaining. Not everything is a personal affront to you, even if you are sensing tone in someone's reply.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

@Danp2 

  Here is the code with a test site URL that anyone can use to see my issue. on the test site you will need to click on the "new work order button" then click on the "long description" button which sits next to the description field. The description field is the one to the right of the work order number field.  

;Start IE 
Sleep(7000)
$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)
_IENavigate($oIE, "https://maximo-demo76.mro.com/maximo/ui/?event=loadapp&value=wotrack&uisessionid=4019&csrftoken=u4q602akdrmfdknalrdmf0rcdo")
Sleep(8000)
_IELoadWait($oIE)

;Attach to a browser control embedded in another window
$oIE = _IEAttach("https://maximo-demo76.mro.com/maximo/ui/?event=loadapp&value=wotrack&uisessionid=4019&csrftoken=u4q602akdrmfdknalrdmf0rcdo")
ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $oIE = ' & $oIE & @CRLF & '>Error code: ' & @error & '    Extended code: 0x' & Hex(@extended) & @CRLF) ;### Debug Console
Sleep(2000)

;Get the title of the webpage
;Local $wTitle = _IEPropertyGet($oIE, "title")
;MsgBox($MB_SYSTEMMODAL, "Webpage title:", $wTitle)

;Clicks the new button
Sleep(3000)
_IEAction($nWorkOrderB, "focus")
_IEAction($nWorkOrderB, "click")
Sleep(5000)

;Store the Element names where the important data will be sent
;Store the long description button
Local $wLongDButton = _IEGetObjById($oIE, "m65d795a4-img")
;Store the long Description field id
Local $wComments    = _IEGetObjById($oIE, "ma6499a9c-rte_iframe")
;Store the ok button id that is in the long description
Local $wCommOk      = _IEGetObjById($oIE, "m74031266-pb")

;*******************************************************************************
; Send the stored data to the proper field
;*******************************************************************************

;Click the long description button
Sleep(300)
_IEAction($wLongDButton, "focus")
_IEAction($wLongDButton, "click")
Sleep(300)

;Sends the Comments
Sleep(500)
_IEAction($wComments, "focus")
_IEAction($wComments, "click")
Sleep(500)
_IEFormElementSetValue($wComments, "Did it work?")

;Click the ok button
Sleep(500)
_IEAction($wCommOk, "focus")
_IEAction($wCommOk, "click")
Sleep(500)

 

Link to comment
Share on other sites

@JLogan3o13 posting about my reports in a public post instead of messaging me directly is unprofessional. FYI I read all three pages of comments on the other post and saw nothing that would help me. I also read the UDF that was posted. I did not understand it and also that post was about clicking on a popup. I want to send a popup text. Also, I am very grateful for the people who use their free time to help others. I often thank them and let them know how helpful they were in a very kind manner. It is the unnecessary rude posts I don't like. I don't have the luxury of free time when I come here for help that is because I need help not rude remarks or criticism.

Edited by nooneclose
Link to comment
Share on other sites

  • Moderators
1 minute ago, nooneclose said:

@JLogan3o13 posting about my reports in a public post instead of messaging me directly is literally childish and very unprofessional. FYI I read all three pages of comments on the other post and saw nothing that would help me. I also read the UDF that was posted. I did not understand it and also that post was about clicking on a popup. I want to send a popup text. Also, I am very grateful for the people who use their free time to help others. I often thank them and let them know how helpful they were in a very kind manner. It is the unnecessary rude posts I don't like. I don't have the luxury of free time when I come here for help that is because I need help not rude remarks or criticism.

You keep using the terms "childish" and "unprofessional" when you are the only one acting in this manner. A couple of things:

  • Quote

    I also read the UDF that was posted. I did not understand it

    Your capacity for understanding suggestions from forum members (or lack thereof) is no one's problem but your own. You could ask for clarification instead of complaining that others are not being as helpful as you feel they should be.

  • Quote

    I don't have the luxury of free time when I come here for help that is because I need help not rude remarks or criticism.

    You sound very much as though you believe you are entitled to a response right now, because your time is precious. First and foremost, this is not a paid support forum but one dedicated to helping people with their own scripts. Thus far from your time here I see more of a demand on others to barf up code for you or "just fix it" rather than a desire to actually learn. That, along with your treatment of those trying to help, is not going to encourage the many forum members that volunteer their time to continue to assist.

This is my final word on the matter, beyond a warning not to continue to abuse the reporting system because someone is "not being helpful" to you. If it continues you will be granted a vacation from posting on the site for a day. 

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

@nooneclose You need to help us to be better able to help you. Showing us an image of a popup isn't very useful, especially when you could have posted the demo site information again. The code you posted doesn't even run, so you might want to work on that.

P.S. The popup that you want to interact with is being displayed in an iframe element, so you'll want to use _IEFrameGetCollection or _IEFrameGetObjByName to get a reference to this container. Read the help file for examples on how to properly use these commands.

Link to comment
Share on other sites

@Danp2  Thank you very much. I am not sure why the code I posted didn't work for you? It works for me. I will look into the _IEFrameGetCollection and _IEFrameGetObjByName. Thank you again for your help I will try some stuff tomorrow and get back with you. 

Also, I will do better (with my posts). I'll post a more detailed version of my code and the popup tomorrow with the demo site as a reference. 

Edited by nooneclose
Link to comment
Share on other sites

@Danp2 ok at your request I have duplicated my script using the demo site. the script is 100% working. Also, I think you are going to like it very much. 😊 

Here is the working code with your suggestion in place:

#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)
MsgBox("", "", "Did it work?")

;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 Element names where the important data will be sent
;You can ignore these:
;Local $wDescription = _IEGetObjById($oIE, "m65d795a4-tb")
;Local $wLocation    = _IEGetObjById($oIE, "m7b0033b9-tb")
;Local $wWorkType    = _IEGetObjById($oIE, "me2096203-tb")
;Local $wTime        = _IEGetObjById($oIE, "m972c8009-tb")
;Local $wByEmail     = _IEGetObjById($oIE, "m89bb4711-tb")
;Local $wReportedBy  = _IEGetObjById($oIE, "me25d1b3-tb")
;Local $wRoomPhone   = _IEGetObjById($oIE, "mb9bb8962-tb")

;Store the long description button
Local $wLongDButton = _IEGetObjById($oIE, "m65d795a4-img")
;Store the long Description field id
Local $wComments    = _IEGetObjById($oIE, "ma6499a9c-rte_iframe")
;Store the ok button id that is in the long description
Local $wCommOk      = _IEGetObjById($oIE, "m74031266-pb")


;*******************************************************************************
; Send the stored data to the proper field
;*******************************************************************************
;Sends the discription
Sleep(2000)
;_IEFormElementSetValue($wDescription, $eDescription)
Sleep(2000)

;Click the long description button
Sleep(300)
_IEAction($wLongDButton, "focus")
_IEAction($wLongDButton, "click")
Sleep(300)

;Sends the Comments
Sleep(500)
_IEAction($wComments, "focus")
_IEAction($wComments, "click")
_IEAction($wComments, "click")
Sleep(500)
_IEFormElementSetValue($wComments, "Hello World! did it work?")

;Click the ok button
Sleep(500)
_IEAction($wCommOk, "focus")
_IEAction($wCommOk, "click")
Sleep(500)

Local $oForm = _IEFormGetCollection($oIE, 0)

;Run some tests to see where the long description element is
Sleep(300)
Local $oQuery = _IEFormElementGetCollection($oForm, 2)
_IEFormElementSetValue($oQuery, "AutoIt IE test 2")
Sleep(300)
Local $oQuery = _IEFormElementGetCollection($oForm, 3)
_IEFormElementSetValue($oQuery, "AutoIt IE test 3")
Sleep(300)
Local $oQuery = _IEFormElementGetCollection($oForm, 4)
_IEFormElementSetValue($oQuery, "AutoIt IE test 4")
Sleep(300)
Local $oQuery = _IEFormElementGetCollection($oForm, 5)
_IEFormElementSetValue($oQuery, "AutoIt IE test 5")
Sleep(300)
Local $oQuery = _IEFormElementGetCollection($oForm, 6)
_IEFormElementSetValue($oQuery, "AutoIt IE test 6")
Sleep(300)
Local $oQuery = _IEFormElementGetCollection($oForm, 7)
_IEFormElementSetValue($oQuery, "AutoIt IE test 7")
Sleep(300)
Local $oQuery = _IEFormElementGetCollection($oForm, 8)
_IEFormElementSetValue($oQuery, "AutoIt IE test 8")
Sleep(300)
Local $oQuery = _IEFormElementGetCollection($oForm, 9)
_IEFormElementSetValue($oQuery, "AutoIt IE test 9")
Sleep(300)
Local $oQuery = _IEFormElementGetCollection($oForm, 8)
_IEFormElementSetValue($oQuery, "AutoIt IE test 8")
Sleep(300)
Local $oQuery = _IEFormElementGetCollection($oForm, 10)
_IEFormElementSetValue($oQuery, "AutoIt IE test 10")
Sleep(300)
Local $oQuery = _IEFormElementGetCollection($oForm, 11)
_IEFormElementSetValue($oQuery, "AutoIt IE test 11")
Sleep(300)
Local $oQuery = _IEFormElementGetCollection($oForm, 12)
_IEFormElementSetValue($oQuery, "AutoIt IE test 12")
Sleep(300)
Local $oQuery = _IEFormElementGetCollection($oForm, 13)
_IEFormElementSetValue($oQuery, "AutoIt IE test 13")
Sleep(300)
Local $oQuery = _IEFormElementGetCollection($oForm, 14)
_IEFormElementSetValue($oQuery, "AutoIt IE test 14")
Sleep(300)
Local $oQuery = _IEFormElementGetCollection($oForm, 15)
_IEFormElementSetValue($oQuery, "AutoIt IE test 15")
Sleep(300)
Local $oQuery = _IEFormElementGetCollection($oForm, 16)
_IEFormElementSetValue($oQuery, "AutoIt IE test 16")
Sleep(300)
Local $oQuery = _IEFormElementGetCollection($oForm, 17)
_IEFormElementSetValue($oQuery, "AutoIt IE test 17")
Sleep(300)
Local $oQuery = _IEFormElementGetCollection($oForm, 18)
_IEFormElementSetValue($oQuery, "AutoIt IE test 18")
Sleep(300)
Local $oQuery = _IEFormElementGetCollection($oForm, 19)
_IEFormElementSetValue($oQuery, "AutoIt IE test 20")
Sleep(300)
Local $oQuery = _IEFormElementGetCollection($oForm, 20)
_IEFormElementSetValue($oQuery, "AutoIt IE test 20")

Sleep(3000)

;Sends the Location
Sleep(300)
;_IEFormElementSetValue($wLocation, $eLocation)
Sleep(2000)

;Sends the Work Type
Sleep(300)
Local $eWorkType = "CM"
;_IEFormElementSetValue($wWorkType, $eWorkType)
Sleep(2000)

;Sends the Reported Date
Sleep(300)
;_IEFormElementSetValue($wTime, $eSentOn)
Sleep(2000)

;Sends the Reported By
Sleep(300)
;_IEFormElementSetValue($wReportedBy, $eReportedBy)
Sleep(2000)

;Sends the Reported By Email
Sleep(300)
;_IEFormElementSetValue($wByEmail, $eSenderAddress)
Sleep(2000)

;Sends the Reported By Phone
Sleep(300)
;_IEFormElementSetValue($wRoomPhone, $eRoomPhone)
Sleep(2000)

I tried 20 elements but I did not see any of them in the long description field.  Also, I do not remember if I mentioned that in order for "text" to appear in the long description the ok button has to be pressed when the pop up pops up or it won't save.

anyways as always, any help would be appreciated.  

Link to comment
Share on other sites

@Danp2 I see what I did wrong, my mistake.  I misread your reply.  I thought it said to use _IEFormElementGetCollection when it says _IEFrameGetCollection. I was confused for a second because I did use _IEFormElementGetCollection 20 times. I will make the change soon and get back with you. Thank you. 

Link to comment
Share on other sites

@Danp2 Ok here is the updated code with the _IEFrameGetCollection:

#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 Element names where the important data will be sent
;You can ignore these:
;Local $wDescription = _IEGetObjById($oIE, "m65d795a4-tb")
;Local $wLocation    = _IEGetObjById($oIE, "m7b0033b9-tb")
;Local $wWorkType    = _IEGetObjById($oIE, "me2096203-tb")
;Local $wTime        = _IEGetObjById($oIE, "m972c8009-tb")
;Local $wByEmail     = _IEGetObjById($oIE, "m89bb4711-tb")
;Local $wReportedBy  = _IEGetObjById($oIE, "me25d1b3-tb")
;Local $wRoomPhone   = _IEGetObjById($oIE, "mb9bb8962-tb")

;Store the long description button
Local $wLongDButton = _IEGetObjById($oIE, "mad3161b5-img2")
;Store the long Description field id
Local $wComments    = _IEGetObjById($oIE, "dijitEditorBody")
;Store the ok button id that is in the long description
Local $wCommOk      = _IEGetObjById($oIE, "m74031266-pb")


;*******************************************************************************
; Send the stored data to the proper field
;*******************************************************************************
;Sends the discription
Sleep(2000)
;_IEFormElementSetValue($wDescription, $eDescription)
Sleep(2000)

;Click the long description button
Sleep(300)
_IEAction($wLongDButton, "focus")
_IEAction($wLongDButton, "click")
Sleep(300)

;Sends the Comments
Sleep(500)
_IEAction($wComments, "focus")
_IEAction($wComments, "click")
_IEAction($wComments, "click")
Sleep(500)
_IEFormElementSetValue($wComments, "Hello World! did it work?")

;Click the ok button
Sleep(500)
_IEAction($wCommOk, "focus")
_IEAction($wCommOk, "click")
Sleep(500)

Local $oForm = _IEFormGetCollection($oIE, 0)

;Run some tests to see where the long description element is
Sleep(300)
Local $oQuery = _IEFormElementGetCollection($oForm, 2)
_IEFormElementSetValue($oQuery, "AutoIt IE test 2")
Sleep(300)
Local $oQuery = _IEFormElementGetCollection($oForm, 3)
_IEFormElementSetValue($oQuery, "AutoIt IE test 3")
Sleep(300)
Local $oQuery = _IEFormElementGetCollection($oForm, 4)
_IEFormElementSetValue($oQuery, "AutoIt IE test 4")
Sleep(300)
Local $oQuery = _IEFormElementGetCollection($oForm, 5)
_IEFormElementSetValue($oQuery, "AutoIt IE test 5")
Sleep(300)
Local $oQuery = _IEFormElementGetCollection($oForm, 6)
_IEFormElementSetValue($oQuery, "AutoIt IE test 6")
Sleep(300)
Local $oQuery = _IEFormElementGetCollection($oForm, 7)
_IEFormElementSetValue($oQuery, "AutoIt IE test 7")
Sleep(300)
Local $oQuery = _IEFormElementGetCollection($oForm, 8)
_IEFormElementSetValue($oQuery, "AutoIt IE test 8")
Sleep(300)
Local $oQuery = _IEFormElementGetCollection($oForm, 9)
_IEFormElementSetValue($oQuery, "AutoIt IE test 9")
Sleep(300)
Local $oQuery = _IEFormElementGetCollection($oForm, 8)
_IEFormElementSetValue($oQuery, "AutoIt IE test 8")
Sleep(300)
Local $oQuery = _IEFormElementGetCollection($oForm, 10)
_IEFormElementSetValue($oQuery, "AutoIt IE test 10")
Sleep(300)
Local $oQuery = _IEFormElementGetCollection($oForm, 11)
_IEFormElementSetValue($oQuery, "AutoIt IE test 11")
Sleep(300)
Local $oQuery = _IEFormElementGetCollection($oForm, 12)
_IEFormElementSetValue($oQuery, "AutoIt IE test 12")
Sleep(300)
Local $oQuery = _IEFormElementGetCollection($oForm, 13)
_IEFormElementSetValue($oQuery, "AutoIt IE test 13")
Sleep(300)
Local $oQuery = _IEFormElementGetCollection($oForm, 14)
_IEFormElementSetValue($oQuery, "AutoIt IE test 14")
Sleep(300)
Local $oQuery = _IEFormElementGetCollection($oForm, 15)
_IEFormElementSetValue($oQuery, "AutoIt IE test 15")
Sleep(300)
Local $oQuery = _IEFormElementGetCollection($oForm, 16)
_IEFormElementSetValue($oQuery, "AutoIt IE test 16")
Sleep(300)
Local $oQuery = _IEFormElementGetCollection($oForm, 17)
_IEFormElementSetValue($oQuery, "AutoIt IE test 17")
Sleep(300)
Local $oQuery = _IEFormElementGetCollection($oForm, 18)
_IEFormElementSetValue($oQuery, "AutoIt IE test 18")
Sleep(300)
Local $oQuery = _IEFormElementGetCollection($oForm, 19)
_IEFormElementSetValue($oQuery, "AutoIt IE test 20")
Sleep(300)
Local $oQuery = _IEFormElementGetCollection($oForm, 20)
_IEFormElementSetValue($oQuery, "AutoIt IE test 20")

Sleep(3000)

;More tests to see where the long description element is
Local $oFrames = _IEFrameGetCollection($oIE)
Local $iNumFrames = @extended
Local $sTxt = $iNumFrames & " frames found" & @CRLF & @CRLF
Local $oFrame = 0
For $i = 0 To ($iNumFrames - 1)
    $oFrame = _IEFrameGetCollection($oIE, $i)
    $sTxt &= _IEPropertyGet($oFrame, "innertext") & @CRLF
Next
MsgBox($MB_SYSTEMMODAL, "Frames Info", $sTxt)


;Sends the Location
Sleep(300)
;_IEFormElementSetValue($wLocation, $eLocation)
Sleep(2000)

;Sends the Work Type
Sleep(300)
Local $eWorkType = "CM"
;_IEFormElementSetValue($wWorkType, $eWorkType)
Sleep(2000)

;Sends the Reported Date
Sleep(300)
;_IEFormElementSetValue($wTime, $eSentOn)
Sleep(2000)

;Sends the Reported By
Sleep(300)
;_IEFormElementSetValue($wReportedBy, $eReportedBy)
Sleep(2000)

;Sends the Reported By Email
Sleep(300)
;_IEFormElementSetValue($wByEmail, $eSenderAddress)
Sleep(2000)

;Sends the Reported By Phone
Sleep(300)
;_IEFormElementSetValue($wRoomPhone, $eRoomPhone)
Sleep(2000)

Here is a picture of the frames it found. How do I access the correct Frame? 

5be46efe32e92_Screenshot(140).thumb.png.547fc5a11533af1ee38a3b62a31d11d9.png

Edited by nooneclose
Link to comment
Share on other sites

I think I found the name of the frames but I'm not sure what to do with them. 

Frame names:

frames = window.top.document.getElementsByTagName("IFRAME")

var frame = frames; if( frame.id == "md3374424_bimviewer_model_frame"

viewer = new ViewerWrapper( md3374424_bimviewer_modelNW )

var ctrl = document.getElementById( "md3374424_bimviewer_modelNW" )

modelMgr = new ModelManager( "md3374424_bimviewer_modelNW", "md3374424_bimviewer_model_model_cb", viewer )

what does the frame name look like? 

Edited by nooneclose
Link to comment
Share on other sites

@Danp2Thank you very very much! I know this is difficult and that you're helping me out of your free time just wanted you to know that your help means a lot to me. Even if its just a step closer to have this project finished ill take any step over a dead end. 

To have the changes stick the "OK" button in that iframe needs to be clicked. But I thought my code clicks on it? 

I'll spare you the duplication and just show you the ok button code.

;Click the ok button
Sleep(500)
Local $wOK = _IEGetObjById($oIE, "m74031266-pb")
_IEAction($wOK, "focus")
_IEAction($wOK, "click")
Sleep(3000)

having this after a text is sent to the iframe should save the contents but for some reason, it does not. 

I tried with your code with this. It sends "good morning" and I think "ok" is clicked because the window closes but I am not sure anymore. 

 

 

Also, this post is the current top result from google concerning anything about "sending text to a popup with autoit"  and or "autoit how to sent text to a frame in ie"

 

Edited by nooneclose
Link to comment
Share on other sites

ok, I figured it out. assume that all the proper code is in place. 

;Click the long description button
Sleep(300)
_IEAction($wLongDButton, "focus")
_IEAction($wLongDButton, "click")
Sleep(1000)

;Clicks on the font name
Sleep(1000)
Local $wFN = _IEGetObjById($oIE, "dijit__editor_plugins__FontNameDropDown_4_select")
_IEAction($wFN, "focus")
_IEAction($wFN, "click")
Sleep(2000)

;Sends the long description
Sleep(500)
_IEAction($wComments, "focus")
_IEAction($wComments, "click")
Sleep(500)
$oFrame = _IEFrameGetCollection($oIE, 1)
;_IEBodyWriteHTML($oFrame, "Good Morning test 2")
Send("Today's time/date is not today got him!")

;Click the ok button
Sleep(2000)
Local $wOK = _IEGetObjById($oIE, "m74031266-pb")

the buttons work. It is the actual text that _IEBodyWriteHTML($oFrame, "Good Morning test 2") sends that Maximo doesn't recognize.  I tested the clicks with different functions and I tested the text that is sent. Only the "Send()" method works. (as in the long description saves it when "ok" is clicked)

For some reason, the long description does not recognize text that is sent by the "_IEBodyWriteHTML()" method.

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

×
×
  • Create New...