JayFran Posted August 24, 2010 Posted August 24, 2010 (edited) I'm not to sure on how to go about this. All I need to do is hit the browse button and select the file I want to upload. or just use a send function to type it in the select file line. Then press the ok button. I tried to look at _IEattach, _Ieforms, _IEtags & tables. I just dont know what else to do. Any help is always appreciated. Heres some code I've been trying out without no errors. $oIE = _IECreate("https://129.39.231.133/maximo/ui/?event=loadapp&value=change&uisessionid=1282672787430", 1, 1, 1, 1) ;$oIE = _IECreate("http://www.yahoo.com/", 1, 1, 1, 1) $dialog = _IEAttach("Create a File Attachment", "windowtitle") $browse = _IETagNameGetCollection($dialog, "button", 0) ;$dialog = _IEPropertyGet("Yahoo!", "title") ;If $file = $dialog Then $oP = _IETagNameGetCollection($oIE, "button", 0) ;$return = _IEAction($oP, "click") If $browse = "button" Then $return = _IEAction($dialog, "click") ;MsgBox (0, "", "Nice!") If $browse <> "button" Then MsgBox(0, "", "Try Again!") Edited August 24, 2010 by JayFran
DaleHohm Posted August 24, 2010 Posted August 24, 2010 Does your _IEAttach work as expected? Have you used DebugBar to look for frames and exact element information? Note: use the eyeball icon in the DebugBar toolbar to spy on other IE instances like your popup... Dale Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble
JayFran Posted August 24, 2010 Author Posted August 24, 2010 (edited) Does your _IEAttach work as expected? Have you used DebugBar to look for frames and exact element information? Note: use the eyeball icon in the DebugBar toolbar to spy on other IE instances like your popup...DaleYes I've used the debugbar. Thats howI know the source of the frame. The console gives me warnings about my _IEAttach.so should I use the _IEAttach something like $iFrame = _IEAttach("source", "url")And then navigate to the file upload id? Edited August 24, 2010 by JayFran
DaleHohm Posted August 24, 2010 Posted August 24, 2010 You have one implied and one explicit _IEAttach in your code (since you are using try_attach in _IECreate) so don't be confused. I suggest you enable SciTe debug mode (see my sig) to insure you know what lines are being executed. Dale Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble
JayFran Posted August 25, 2010 Author Posted August 25, 2010 You have one implied and one explicit _IEAttach in your code (since you are using try_attach in _IECreate) so don't be confused. I suggest you enable SciTe debug mode (see my sig) to insure you know what lines are being executed. Dale No it doesnt. I only use _IECreate in my scripts to resume my code from the point at which it malfunctions or stops working. If there is another way better please me let me know so I can use that method instead. But if i didnt do it this way then I would have to keep running my code from the begining it seems. That is why most of my code posts start with _IECreate in them since I try to work from that stop point. But from where my code starts from up until this point of malfunctions to this iFrame window is: Sleep(4000) $upload = "Attachments" $t_upload = _IEImgClick ($oIE, $upload, "alt") Sleep(1500) $add_new_attach = "addnew_middle_anchor" $a_n_a = _IEGetObjById($oIE, $add_new_attach) $hwnd = _IEPropertyGet($oIE, "hwnd") _IEAction($a_n_a, "focus") ControlSend($hwnd, "", "[CLASS:Internet Explorer_Server; INSTANCE:1]", "{Enter}") $add_file = "addnewfile_middle_anchor" $a_f = _IEGetObjById($oIE, $add_file) $hwnd = _IEPropertyGet($oIE, "hwnd") _IEAction($a_f, "focus") ControlSend($hwnd, "", "[CLASS:Internet Explorer_Server; INSTANCE:1]", "{Enter}");This Point right here opens the iFrame window. ;$pause = _IELoadWait($oIE) Also I cant figure out how to enable the SciTe debug mode in my code. I trie to copy and paste but that doesnt seem to be working.
Tvern Posted August 25, 2010 Posted August 25, 2010 I don't know how to help you as your code doesn't reproduce the issue, but I'm pretty sure $browse is an object variable and you're comparing it so a string. Doubt it has much to do with your issue though.
DaleHohm Posted August 25, 2010 Posted August 25, 2010 No it doesntNot it doesn't what? I don't understand you.Put #AutoIt3Wrapper_run_debug_mode=Y at the top of your source code and then run your code from SciTe with F5.Dale Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble
JayFran Posted August 25, 2010 Author Posted August 25, 2010 (edited) Not it doesn't what? I don't understand you. Put #AutoIt3Wrapper_run_debug_mode=Y at the top of your source code and then run your code from SciTe with F5. Dale No the _IEAttach doesnt attach to the window "Create A File Attachment" (picture above) Here is all of my code from start to finish expandcollapse popup#AutoIt3Wrapper_run_debug_mode=Y #include <IE.au3> #include<Debug.au3> AutoItSetOption("WinTitleMatchMode", 4) Opt("WinWaitDelay", 1000) ; ================================================================================================= ; #UserName# ; ================================================================================================= Do $user = InputBox("Login", "Enter Username:") If @error = 1 Then Exit If $user = "" Then MsgBox(16, "ISM Login", "Please Enter User Name") Until $user <> "" $u_string = StringRegExp($user, "[a-z][0-9][@]{1}[u]{1}[s]{1}[.]{1}[i]{1}[b]{1}[m]{1}[.]{1}[c]{1}[o]{1}[m]{1}", 2) If $u_string = @error Then MsgBox(5, "ISM Login", "Please Check the format of the username" & @CRLF & "Example: username@us.ibm.com") ; ================================================================================================= ; #Password# ; ================================================================================================= Do $pass = InputBox("Password", "Enter Password:", "", "*") If @error = 1 Then Exit If $pass = "" Then MsgBox(16, "ISM Login", "Password in incorrect or blank") Until $pass <> "" ; ================================================================================================= ; #Ticket Numbers# ; ================================================================================================= Do $t_number = InputBox("Ticket Number", "Enter Ticket Number:" & @CRLF & "Example:C0000") If @error = 1 Then Exit If $t_number = "" Then MsgBox(16, "ISM Login", "Enter Ticket Number:") Until $t_number <> "" $t_string = StringRegExp($t_number, "[C](?i){1}[0-9]{4}", 1) If @error = 1 Then MsgBox(5, "ISM Login", "Error in Ticket number") Exit EndIf ; ================================================================================================= ; #ISM Login# ; ================================================================================================= Sleep(1000) $oIE = _IECreate("https://129.39.231.133/maximo/webclient/login/login.jsp?appservauth=true") $oForm = _IEFormGetObjByName($oIE, "loginform") $username = _IEGetObjById($oIE, 'j_username') _IEFormElementSetValue($username, $user) Sleep(1000) $password = _IEFormElementGetObjByName($oForm, 'j_password') _IEFormElementSetValue($password, $pass) Sleep(1000) $loginButton = _IEGetObjById($oIE,'loginbutton') _IEAction($loginButton, "click") $pause = _IELoadWait($oIE) Sleep(2000) ; ================================================================================================= ; #Login Errors# ; ================================================================================================= ;If Error occurs If $oIE = "https://129.39.231.133/maximo/webclient/login/j_security_check" Then $404 = _IEAttach("HTTP 404", "windowtitle") _IEAction($oIE, "refresh") If $oIE <> _IEAttach("Start Center", "windowtitle") Then $oP = _IETagNameGetCollection($oIE, "button", 0) $return = _IEAction($oP, "click") ;If $oIE = "https://129.39.231.133/maximo/ui/login" Then $oIE = _IEAttach("Start Center", "windowtitle") ; _IELoadWait($oIE) ; ================================================================================================= ; #ISM Home Page# ; ================================================================================================= ;Navigate to the ticket input $pause = _IELoadWait($oIE) WinWait("Start Center - Windows Internet Explorer") sleep(4000) $c_click = "mx126" $changes = _IEGetObjById($oIe, $c_click) $hwnd = _IEPropertyGet($oIE, "hwnd") _IEAction($changes, "focus") ControlSend($hwnd, "", "[CLASS:Internet Explorer_Server; INSTANCE:1]", "{Enter}") ; Do $done = _IEPropertyGet($oIE, "statusbar") If $done <> "Done" Then Sleep(3000) Until $done = "Done" ; ================================================================================================= ; #ISM Ticket Field Fill & Lookup# ; ================================================================================================= ;Insert Ticket info WinWaitActive("Changes - Windows Internet Explorer") Sleep(2000) Do $t_inputid = "mx404" $t_input = _IEGetObjById($oIE, $t_inputid) $focus = _IEAction($t_input, "focus") Until Send($t_number) Send("{Enter}") Sleep(3000) $link = "mx534[R:0]" ;Ticket Link id $t_search = _IEGetObjById ($oIE, $link) $hwnd = _IEPropertyGet($oIE, "hwnd") _IEAction($t_search, "focus") ControlSend($hwnd, "", "[CLASS:Internet Explorer_Server; INSTANCE:1]", "{Enter}") $pause = _IELoadWait($oIE) ; ================================================================================================= ; #Ticket Upload# ; ================================================================================================= Sleep(4000) $upload = "Attachments" $t_upload = _IEImgClick ($oIE, $upload, "alt") Sleep(1500) $add_new_attach = "addnew_middle_anchor" $a_n_a = _IEGetObjById($oIE, $add_new_attach) $hwnd = _IEPropertyGet($oIE, "hwnd") _IEAction($a_n_a, "focus") ControlSend($hwnd, "", "[CLASS:Internet Explorer_Server; INSTANCE:1]", "{Enter}") $add_file = "addnewfile_middle_anchor" $a_f = _IEGetObjById($oIE, $add_file) $hwnd = _IEPropertyGet($oIE, "hwnd") _IEAction($a_f, "focus") ControlSend($hwnd, "", "[CLASS:Internet Explorer_Server; INSTANCE:1]", "{Enter}") ;$pause = _IELoadWait($oIE) The code stops once the Iframe window opens in the middle of the screen. I havent put no code down for it since I dont have an idea where to go from there. I know I either want to open the browse button, navigate to file and then close the dialog box or, just do a command write to the select a file line and then close the dialogbox. (please see attachments) Edited August 25, 2010 by JayFran
DaleHohm Posted August 26, 2010 Posted August 26, 2010 The purpose of putting in the SciTe debug mode was to determine what the last line executed in your script is... you didn't say. Dale Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble
JayFran Posted August 26, 2010 Author Posted August 26, 2010 The purpose of putting in the SciTe debug mode was to determine what the last line executed in your script is... you didn't say. Dale The last line executed was the tagname get collection... I did a msgbox for _IEbodyreadhtml and it displays the form id and input type and hidden text. but when i try to call on those functions it gives me warnings and such. ; ================================================================================================= ; #Ticket Upload# ; ================================================================================================= Sleep(4000) $upload = "Attachments" $t_upload = _IEImgClick ($oIE, $upload, "alt") Sleep(1500) $add_new_attach = "addnew_middle_anchor" $a_n_a = _IEGetObjById($oIE, $add_new_attach) $hwnd = _IEPropertyGet($oIE, "hwnd") _IEAction($a_n_a, "focus") ControlSend($hwnd, "", "[CLASS:Internet Explorer_Server; INSTANCE:1]", "{Enter}") $add_file = "addnewfile_middle_anchor" $a_f = _IEGetObjById($oIE, $add_file) $hwnd = _IEPropertyGet($oIE, "hwnd") _IEAction($a_f, "focus") ControlSend($hwnd, "", "[CLASS:Internet Explorer_Server; INSTANCE:1]", "{Enter}") Sleep(1000) $oFrames = _IEFrameGetCollection ($oIE, 0) $window2 = _IEBodyReadHTML($oFrames) ;MsgBox(0, "", $window2) $browse = _IETagNameGetCollection($oFrames, "input") $oFrame = _IEFrameGetObjByName ($browse, "file") _IEBodyWriteHTML($browse, "Some text")
DaleHohm Posted August 26, 2010 Posted August 26, 2010 Simplify brother. Create a reproducer. There are issues in your code and I don't want to have to debug the entire thing just to help you with a specific issue (i.e. $oIE is an object variable and you are comparing it to a URL... never gonna work). Cut this down to a very simple code segment and provide all of the SciTe console output. _IETagnameGetColledtion will not hang your script. Dale Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble
JayFran Posted August 27, 2010 Author Posted August 27, 2010 Simplify brother. Create a reproducer. There are issues in your code and I don't want to have to debug the entire thing just to help you with a specific issue (i.e. $oIE is an object variable and you are comparing it to a URL... never gonna work). Cut this down to a very simple code segment and provide all of the SciTe console output. _IETagnameGetColledtion will not hang your script. Dale I know there are issues with my code. I did figure out how to get the iframe window to open and upload the file yesterday. here's the code for that. $oFrames = _IEFrameGetCollection ($oIE, 0) $browse = _IETagNameGetCollection($oFrames, "input") For $oBrowse In $browse $b_prop = _IEPropertyGet($obrowse, "innerhtml") If $b_prop = "file" Then $hit = $oBrowse Next $b_open = _IEAction($oBrowse, "focus") Send($t_number&".doc") Question though my brother: When putting the scite4 in debug mode for script then writing it to the console. is this how it should look #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_run_debug_mode=Y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** *My Code* How would I get it to write to the console?
DaleHohm Posted August 27, 2010 Posted August 27, 2010 (edited) Yes, that is how it should look.Did you do everything I said?Put #AutoIt3Wrapper_run_debug_mode=Y at the top of your source code and then run your code from SciTe with F5.Dale Edited August 27, 2010 by DaleHohm Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble
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