Autoit e Chrome!, Problema per fare interagire il programma al browser

« Older   Newer »
  Share  
DanDon
CAT_IMG Posted on 9/8/2016, 10:26     +1   -1




Salve a tutti, sto da tempo scrivendo un programma per riempire dei campi su Chrome.
Per motivi pratici e di compatibilitą vorrei eliminare i MouseClick del codice č sostituirli.
Per ora uso un Mouse click per passare dalla finestra del programma al Browser e 2 per accettare il regolamento e cliccare continua (per tutti gli altri uso Tab ma con loro non funge).
Č la mia primo discussione che apro mi scuso se č la sezione sbagliata o se ho scritto male il testo.
Grazie a tutti

Edited by DanDon - 9/8/2016, 14:16
 
Top
FrankyByte
CAT_IMG Posted on 10/8/2016, 10:41     +1   -1




Riesci a postare il codice sorgente?
 
Top
DanDon
CAT_IMG Posted on 10/8/2016, 10:44     +1   -1




Č parecchio lungo comunque posto la parte che ci interessa
CODICE
Func StartButton()

Global $carctrlname[5] = [GUICtrlRead($car1),GUICtrlRead($car2),GUICtrlRead($car3),GUICtrlRead($car4)]
Local $h = 5
If  GUICtrlRead($car5) = "Inserisci il quinto annuncio" Then
$h= $h-1
EndIf
If  GUICtrlRead($car4) = "Inserisci il quarto annuncio" Then
$h= $h-1
EndIf
If  GUICtrlRead($car3) = "Inserisci il terzo annuncio" Then
$h= $h-1
EndIf
If  GUICtrlRead($car2) = "Inserisci il secondo annuncio" Then
$h= $h-1
EndIf
If  GUICtrlRead($car1) = "Inserisci il primo annuncio" Then
MsgBox($MB_SYSTEMMODAL,"","INSERISCI ALMENO UN ANNUNCIO")
GUISetState(@SW_HIDE,$RunGui)
Exit
EndIf

For $i = 1 to $h
Local $m[17]
_FileReadToArray("C:\Users\" & @UserName & "\Dropbox\Programmi\Autoannunci\AutAnn\Data\" & $carctrlname[$i - 1] & ".txt",$m)
$chrome=WinActivate("[Class:Chrome_WidgetWin_1]")
$height=@DesktopHeight
$width=@DesktopWidth


;START

MouseClick("left",861 ,428)

;Auto
Send("{Tab}")
sleep(500)
send($m[17])
send("{enter}")
sleep(7000)
;Marca
Send("{Tab 3}")
sleep(500)
send($m[1])
sleep(4000)
;modello
Send("{Tab}")
sleep(250)
send($m[2])
sleep(1000)
;anno
Send("{Tab}")
sleep(500)
send($m[3])
sleep(500)

;Immagini
MouseClick("left",686,621)
sleep(2000)
send("C:\Users\")
send(@UserName)
send("\Dropbox\Auto")
sleep(250)
send("{enter}")
sleep(500)
send($m[16])
sleep(250)
send("{enter}")
sleep(250)
send('"c1""c2""c3""c4""c5"')
sleep(700)
send("{enter}")

;titolo-descrizione-prezzo
sleep(1000)
Send("{Tab}")
sleep(1000)
send($m[4])
sleep(500)
;descrizione
Send("{Tab}")
Send("{LCTRL A}")
sleep(500)
send($m[5])
send("{enter}")
send("Per maggiori informazioni chiamare a")
send("{enter}")
send("Stefano")
send("{enter}")
send("3332346211")
send("{enter}")
send("Danilo")
send("{enter}")
send("3927923928")
sleep(500)
;prezzo
Send("{Tab}")
sleep(1000)
send($m[6])
;km,com,allest,carb,tipo,cambio,class
Send("{Tab}")
sleep(500)
send($m[7])
sleep(500)
;cilindrata
If $m[17]="moto" Then
Send("{Tab}")
send($m[18])
EndIf
;comune
Send("{Tab}")
If $h=0 Or $h=2 Or $h=4  Then
  send("Pesaro(PU)")
EndIf
If $h=1 Or $h=3 Or $h=5 Then
  send("Rimini (RN)")
  EndIf
sleep(1000)
;allestimento
Send("{Tab 2}")
sleep(500)
send($m[8])
sleep(500)
;carburante
If $m[17]="Auto" Then
Send("{Tab}")
sleep(500)
send($m[9])
sleep(500)
;tipologia
Send("{Tab}")
sleep(500)
send($m[10])
sleep(500)
;cambio
Send("{Tab}")
sleep(500)
send($m[11])
sleep(500)
;emissioni,post,porte,colore
Send("{Tab}")
send($m[12])
sleep(500)
;posti
Send("{Tab}")
send($m[13])
sleep(500)
;porte
Send("{Tab}")
send($m[14])
sleep(500)
;colore
Send("{Tab}")
send($m[15])
sleep(500)
EndIf
;user,pass
Send("{Tab 2}")
send($user[3])
sleep(100)
;telefono
Send("{Tab}")
send($user[4])
Send("{Tab}")
;close

If ($width=1024) Then
If ($height=768) Then
MouseClick("left",408,705)
Send("{Tab 3}")
MouseClick("left",502,409)
sleep(15000)
;down
MouseClick("left",1015,697)
MouseClick("left",1015,697)
MouseClick("left",1015,697)
sleep(1000)
MouseClick("left",843,347)
EndIf
EndIf

If ($width=1280) Then
If ($height=800) Then
MouseClick("left",538,520)
MouseClick("left",634,637)
sleep(20000)
;down
MouseClick("left",1272,724)
MouseClick("left",1272,724)
MouseClick("left",984,516)
sleep(2000)
MouseClick("left",984,153)
EndIf
EndIf

Sleep(20000)

Next
EndFunc
 
Top
FrankyByte
CAT_IMG Posted on 10/8/2016, 10:46     +1   -1




Ora lo leggo, comunque per la prossima volta usa pastebin.com o simili per postare il sorgente.
Grazie
 
Top
DanDon
CAT_IMG Posted on 10/8/2016, 10:47     +1   -1




Va bene scusatemi
 
Top
4 replies since 9/8/2016, 10:26   66 views
  Share