Moderatori: Anthony47, Flash30005
myPid = Shell("CMD /C TASKKILL /IM iexplore.exe /F")
myStart = Timer
Do
DoEvents :If Timer > myStart + 2 Or Timer < myStart Then Exit Do
Loop
Si, solo un po' piu' contorto...Ho risolto usando questo codice
[. . . . ]
che praticamente è lo stesso di quello che suggerisci tu.
...
' Cancella IE cronologia
Shell "RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 255"
'Attesa 3 Secondi
myStart = Timer
Do
DoEvents
If Timer > myStart + 3 Or Timer < myStart Then Exit Do
Loop
'loop infinito
Do
I = 0
'verifica di essere log off
myURL = "link..."
Set IE = CreateObject("InternetExplorer.Application")
With IE
.navigate myURL
.Visible = True
Do While .Busy: DoEvents: Loop
Do While .ReadyState <> 4: DoEvents: Loop
End With
'Attesa 5 Secondi
myStart = Timer
Do
DoEvents
If Timer > myStart + 5 Or Timer < myStart Then Exit Do
Loop
'Ciusura IE
IE.Quit
Set IE = Nothing
'log IN
myURL = "link..."
Set IE = CreateObject("InternetExplorer.Application")
With IE
.navigate myURL
.Visible = True
Do While .Busy: DoEvents: Loop
Do While .ReadyState <> 4: DoEvents: Loop
End With
myStart = Timer
Do
DoEvents
If Timer > myStart + 3 Or Timer < myStart Then Exit Do
Loop
IE.Document.forms(0).all("username").Value = "username"
IE.Document.forms(0).all("password").Value = "password"
IE.Document.forms(0).submit
' attesa 20 secondi per essere sicuri che il log in si avvenuto
myStart = Timer
Do
DoEvents
If Timer > myStart + 20 Or Timer < myStart Then Exit Do
Loop
'inizio programma
myURL = "link..."
Set IE = CreateObject("InternetExplorer.Application")
Sheets("Foglio1").Select
Range("A:B").Clear
With IE
.navigate myURL
.Visible = True
Do While .Busy: DoEvents: Loop
Do While .ReadyState <> 4: DoEvents: Loop
End With
myStart = Timer
Do
DoEvents
If Timer > myStart + 3 Or Timer < myStart Then Exit Do
Loop
'cerca ed elenca Id e Descrizioni
Set myColl = IE.Document.getElementsByTagName("a")
For Each myLink In myColl
LLin = myLink.href
...
On Error Resume Next
WebBrowser1.Navigate "about:blank"
DoEvents
Do
Err.Clear
WebBrowser1.Document.body.innerhtml = "Attendi..."
If Err.Number = 0 Then Exit Do
DoEvents
Loop
On Error GoTo 0
' ora puoi navigare dove vuoi
WebBrowser1.Navigate "http://www.ilmiosito.com"
Do While .ReadyState <> 4: DoEvents: Loop 'Esistente
End With 'Esistente
'AGGIUNTO:
CUrl = IE.LocationURL 'Current URL
If CUrl <> myUrl Then 'Current <> quello impostato
'cosa fare...
End if
Set IE = CreateObject("InternetExplorer.Application")
Set IE2 = CreateObject("InternetExplorer.Application")
Set IE = CreateObject("InternetExplorer.Application")
Set IE2 = CreateObject("InternetExplorer.Application")
Sub Soloprova()
Set IE = CreateObject("InternetExplorer.Application")
Set IE2 = CreateObject("InternetExplorer.Application")
myURL = "link 1..."
my URL2= "link 2..."
With IE
.navigate myURL
.Visible = True
End With
With IE2
.navigate myURL2
.Visible = True
End With
Stop
IE.Quit
IE2.Quit
Set IE = Nothing
Set IE2 = Nothing
End Sub
Ma per prova puoi usare il codice che ti ho dato con due link diversi, cosi' puoi accorgerti se un comando governa un "oggetto" e un altro governa quell' altro? Quello che conta e' l' associazione con IE e con IE2; una fara' riferimento a un oggetto, l' altro all' altro oggetto.il problema è che nel mio caso il link è sempre lo stesso (se lo provi con due account di posta elettronica ti accorgi, almeno da quanto ho verificato facendo delle prove, che con il comando CreateObject("InternetExplorer.Application") si aprono più pagine di internet explorer ma non sessioni diverse e indipendenti di IE)
Torna a Applicazioni Office Windows
adattare il contenuto alla pagina Autore: trittico69 |
Forum: Applicazioni Office Windows Risposte: 12 |
Importare immagini a seconda del testo in una cella Autore: Paolo67met |
Forum: Applicazioni Office Windows Risposte: 4 |
non riesco più a mettere google come nuova pagina Autore: zaq1 |
Forum: Sistemi Operativi Windows Risposte: 6 |
Importare anche gli url con selenium Autore: aggittoriu |
Forum: Applicazioni Office Windows Risposte: 3 |
Visitano il forum: Nessuno e 5 ospiti