Voici mon nouveau projet, toujours autour des API Google Maps:
Je n'arrive pas à comprendre comment simuler un input , l'appuie d'un bouton ou le choix dans un combo d'une page html à partir d'une Gui.
Voici la Gui à peu prés prète et le fichier html .
► Afficher le texte
Code : Tout sélectionner
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_outfile=googleelevation.exe
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <IE.au3>
#include <file.au3>
#include <GUIConstantsEx.au3>
If Not FileExists("Settings.ini") Then
IniWrite("Settings.ini", "Google Maps", "WindowsName", "GoogleMapsElevation")
IniWrite("Settings.ini", "Google Maps", "WindowsTOPoffset", "0")
IniWrite("Settings.ini", "Google Maps", "WindowsBOToffset", "0")
IniWrite("Settings.ini", "Html", "Samples","100")
IniWrite("Settings.ini", "Html", "Latitude1","37.801000")
IniWrite("Settings.ini", "Html", "Longitude1","-122.426499")
IniWrite("Settings.ini", "Html", "Latitude2","37.802051")
IniWrite("Settings.ini", "Html", "Longitude2","-122.419418")
IniWrite("Settings.ini", "Html", "Latitude3","37.802729")
IniWrite("Settings.ini", "Html", "Longitude3","-122.413989")
EndIf
$WindowsName = IniRead("Settings.ini", "Google Maps", "WindowsName", "")
$TOPoffset = IniRead("Settings.ini", "Google Maps", "WindowsTOPoffset", "")
$BOToffset = IniRead("Settings.ini", "Google Maps", "WindowsBOToffset", "")
$SampleSize = IniRead("Settings.ini", "Html", "Samples","")
$Latitude1 = IniRead("Settings.ini", "Html", "Latitude1","")
$Longitude1 = IniRead("Settings.ini", "Html", "Longitude1","")
$Latitude2 = IniRead("Settings.ini", "Html", "Latitude2","")
$Longitude2 = IniRead("Settings.ini", "Html", "Longitude2","")
$Latitude3 = IniRead("Settings.ini", "Html", "Latitude3","")
$Longitude3 = IniRead("Settings.ini", "Html", "Longitude3","")
$hwmd_Reciver = GUICreate($WindowsName, 800, 700, 0, 0,$WS_OVERLAPPEDWINDOW)
global $wikipedia="off"
$OK = GUICtrlCreateButton("OK", 350, 650, 60, 40)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
$TravelMode = GUICtrlCreateButton("Travel Mode", 460, 650, 100, 40)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
$ClearPoints = GUICtrlCreateButton("Clear Points", 580, 650, 100, 40)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
$Annuler = GUICtrlCreateButton("Annuler", 700, 650, 80, 40)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
GUICtrlCreateLabel("Entrez un ville :",30,660,200,20)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
$Ville = GUICtrlCreateInput("", 150, 660, 150, 20)
GUICtrlSetTip(-1, "Entrez une Ville de départ")
$url=@ScriptDir & "\gmapselevation_orig.html";lecture de la page html
_IEErrorHandlerRegister()
$ie = _IECreateEmbedded()
$ieobject = GUICtrlCreateObj($ie, -14, -14, 805, 600)
FileCopy($url,$url&"_tmp")
_ReplaceStringInFile($url, "SAMPLESIZE", $SampleSize, 1, 0) ;256 par défaut : je l'ai modifié par 100
_ReplaceStringInFile($url, "LAT1", $Latitude1, 1, 0) ;
_ReplaceStringInFile($url, "LON1", $Longitude1, 1, 0) ;
_ReplaceStringInFile($url, "LAT2", $Latitude2, 1, 0) ;
_ReplaceStringInFile($url, "LON2", $Longitude2, 1, 0) ;
_ReplaceStringInFile($url, "LAT3", $Latitude3, 1, 0) ;
_ReplaceStringInFile($url, "LON3", $Longitude3, 1, 0) ;
#cs
local $lat = "40"
_ReplaceStringInFile($url, "LATITUDE", $lat, 1, 0)
local $lon = "-100"
_ReplaceStringInFile($url, "LONGITUDE", $lon, 1, 0)
local $ZoomLevel = "12"
_ReplaceStringInFile($url, "ALTITUDE", $ZoomLevel, 1, 0)
#ce
_IENavigate($ie, $url, 0)
Sleep(2000)
;$oForms=_IEFormGetCollection($ie);,0)
$nb_form=@extended
$oFormville = _IEGetObjById ($ie,"start")
ConsoleWrite("nb form = "&$nb_form&@CRLF)
Dim $formulaire0
for $i = 0 to $nb_form - 1
; MsgBox(0, "Form Info", $oForms.name)
Assign("formulaire"&$i,_IEFormGetCollection($ie,$i))
Next
ConsoleWrite(@error&@CRLF)
$oQueryville = _IEGetObjById ($ie, "search")
$oQueryville = _IEFormElementGetCollection( $formulaire0,0)
ConsoleWrite(@error&@CRLF)
$oButtonville = _IEFormElementGetCollection( $formulaire0,1)
GUISetState()
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE , $Annuler
Exit
Case $OK
FileCopy($url,$url&"_tmp")
local $depart = GUICtrlRead($Ville)
_IEFormElementSetValue ($oQueryville, $depart)
;$formulaire0.submit()
;_IEFormSubmit ($formulaire0,0)
_IEAction($oButtonville,"click")
Sleep(2000)
;Beep(550,1000)
ConsoleWrite(@error&@CRLF)
EndSwitch
Wend-pouvoir enter autant de ville que je le veux (10 max) dans le input , validé par le bouton ok.
Cela correspond à autant d'entrée dans le input du fichier html suivi d'un retour ligne.
-choisir le type du voyage
-effacer les points
Merci de votre aide

