Hi PsaltyDS,
Thank you for the working sample!
it really help me a lot!
But, I actually have further questions. Could you please help me on this?
Question 1:
I made a modification to the src.
Now I use ControlGetText("[CLASS:IEFrame]", "", "Edit1") to get the URL in order to get URL dynamically.
It works, but I have no idea why it's "Edit1"? Isn't that something like [ToolbarWindow32;INSTANCE2]?
Window Info tool does not detect "Edit1." So where does it come from?
Question 2:
In the src, you suggested me to use _IEAttach($sURL, "url").
It works. But, I can not understand why since following Function Reference confuses me a lot in comparison to what you did.
- http://www.autoitscript.com/autoit3/docs/libfunctions/_IEAttach.htm
Could you please explain a bit more?
Question 3:
Now I added select file section to the src.
And, it does not work.
But, the strange thing is that it actually works if I run this section from separate .exe by creating another .au3 with only select file section and compile.
Why it does not work as a single file just like the src you can see here?
#include <IE.au3>
_IEErrorHandlerRegister()
WinActivate("[CLASS:IEFrame]")
Global $sURL = ControlGetText("[CLASS:IEFrame]", "", "Edit1")
#region Global $sURL = "http://cgi-lib.berkeley.edu/ex/fup.html"
Global $oIE = _IEAttach($sURL, "url")
Global $oButton = _IEGetObjByName($oIE, "upfile")
_IEAction($oButton, "click")
#region MsgBox(64, "Wait", "Click OK to continue")
Sleep(2000)
; Select File
_WinWaitActivate("[CLASS:#32770]","")
WinActivate("[CLASS:#32770]","")
ControlSetText("[CLASS:#32770]", "","[CLASS:Edit; INSTANCE:1]","test.txt")
ControlClick("[CLASS:#32770]", "","[CLASS:Button; INSTANCE:2]")
; Submit form
WinActivate("[CLASS:IEFrame]")
$oForm = _IEFormGetCollection($oIE, 0) ; Get first form
_IEFormSubmit($oForm)
#region --- Internal functions Au3Recorder Start ---
Func _WinWaitActivate($title,$text,$timeout=0)
WinWait($title,$text,$timeout)
If Not WinActive($title,$text) Then WinActivate($title,$text)
WinWaitActive($title,$text,$timeout)
EndFunc
#endregion --- Internal functions Au3Recorder End ---
Thanks!