Ombir
Active Member
- Joined
- Oct 1, 2015
- Messages
- 433
I was trying to help someone with automation of file upload via Internet explorer. I've compiled an Autoit script to upload the file.
The problem is that code stops at
and ask for user interaction to select the file from Select file dialogue window.
I want to execute Upload.exe through Shell command which automate the user interaction process. However code pause before this line.
Is there any way to Set this Select file dialogue window to the background and resume the execution of Vba code to Shell command?
You can use the Login details in the code. Its a dummy account for testing.
The problem is that code stops at
Code:
media.click
I want to execute Upload.exe through Shell command which automate the user interaction process. However code pause before this line.
Is there any way to Set this Select file dialogue window to the background and resume the execution of Vba code to Shell command?
Code:
Dim ie As InternetExplorer
Sub Ombir_08Jan2017()
Dim doc As HTMLDocument
Dim msg As String
Dim Statusbox As Object
Set ie = New InternetExplorer
msg = "Image Testing"
With ie
.Visible = True
.Navigate "www.facebook.com/"
Call IEReady
End With
Set doc = ie.document
doc.getElementById("email").Value = "jaryszek@o2.pl"
doc.getElementById("pass").Value = "Testtest1234"
doc.getElementById("loginbutton").Click
Call IEReady
Do While Statusbox Is Nothing
On Error Resume Next
Set Statusbox = doc.getElementsByName("xhpc_message")(0)
Loop
Statusbox.Value = msg
Do While media Is Nothing
Set media = doc.getElementsByClassName("_n _5f0v")(0)
Loop
On Error GoTo 0
AppActivate Application.Caption
media.Click
Shell ("C:\Test\Upload.exe")
doc.getElementsByClassName("_42ft _4jy0 _ej1 _4jy3 _4jy1 selected _51sy")(0).Click
Call IEReady
ie.Quit
End Sub
Sub IEReady()
Do While ie.ReadyState <> 4: DoEvents: Loop
waitfor 1
Do While ie.Busy
waitfor 3
Loop
End Sub
Sub waitfor(ByVal nSec As Long)
nSec = nSec + Timer
Do While Timer < nSec
DoEvents
Loop
End Sub
You can use the Login details in the code. Its a dummy account for testing.