Добрый день! Что то я туговат и не разобрался.
Мой код:
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
#SingleInstance force ; игнор уже запущенного скрипта, переоткрытие
FileSelectFile, Path, 3, , Open Excel File, Excel File (*.xls; *.xlsx)
IF path =
ExitApp
Xl := ComObjCreate("Excel.Application")
Xl.Visible := true
Xl.Workbooks.Open(Path)
FormatTime, TimeString, , dd.MM.yyyy
Xl.Range("A1").value := Xl.Range("A1").value " " Timestring
Xl.Range("B1").value := Xl.Range("B1").value " " Timestring
Xl.Range("C1").value := Xl.Range("C1").value " " Timestring
Xl.Range("D1").value := Xl.Range("D1").value " " Timestring
ie := ComObjCreate("InternetExplorer.Application")
ie.Visible := true
ie.Navigate("https://1.ru")
ie.Navigate("https://2.ru",2048)
ie.Navigate("http://3",2048)
ie.Navigate("http://4",2048)
while ie.readystate <> 4
continue
Gui, +ToolWindow +AlwaysOnTop
Gui, Font, s12 italic
Gui, Add, text,x30, 1
Gui, Add, text,x+60, 2
Gui, Add, text,x+65, 3
Gui, Add, text,x+70, 4
Gui, Font, normal
Gui, Add, Button, -TabStop x5 y+10 w40 h40 g11, +
Gui, Add, Button, -TabStop x+40 y+-40 w40 h40 g21, +
Gui, Add, Button, -TabStop x+40 y+-40 w40 h40 g31 , +
Gui, Add, Button, -TabStop x+40 y+-40 w40 h40 g41 , +
Gui, Show, x600 y100 w300 h110, Proverka
Return
; здесь "https://1.ru"
g11:
xl.Worksheets("Лист").Cells.(xl.Worksheets("Лист").Cells.(xl.Worksheets("Лист").Rows.Count, "A").End(xlUp := -4162).Row + 1, "A").value:= ie.document.getElementsByTagName("input")[2].value
; здесь "https://2.ru"
g21:
xl.Worksheets("Лист").Cells.(xl.Worksheets("Лист").Cells.(xl.Worksheets("Лист").Rows.Count, B").End(xlUp := -4162).Row + 1, "B").value:= ie.document.getElementsByTagName("input")[0].value
; здесь "https://3.ru"
g31:
xl.Worksheets("Лист").Cells.(xl.Worksheets("Лист").Cells.(xl.Worksheets("Лист").Rows.Count, C").End(xlUp := -4162).Row + 1, "C").value:= ie.document.getElementsByTagName("input")[0].value
; здесь "https://4.ru"
g41:
xl.Worksheets("Лист").Cells.(xl.Worksheets("Лист").Cells.(xl.Worksheets("Лист").Rows.Count, D").End(xlUp := -4162).Row + 1, "D").value:= ie.document.getElementsByTagName("input")[1].value
Еще проблема в том, что, например, ie.Navigate("https://2.ru",2048) - не выполянется ".....value:= ie.document.getElementsByTagName("input")[0].value", если убрать "2048", то всё ОК