stealzy а в экселе остается с пробелом.
Вот полный код
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
$^1::
Setkeydelay, 35
Loginname = ***
Password = ****
ie := ComObjCreate("InternetExplorer.Application")
ie.Visible := true
ie.Navigate("****")
while ie.readystate <> 4
continue
ie.document.getElementsByTagName("input")[0].value := Loginname
ie.document.getElementsByTagName("input")[1].value := Password
ie.document.getElementsByTagName("input")[2].click()
Sleep 2000
ie.document.getElementsByTagName("a")[0].click()
; Выбор экселевскгого файла дял проверки
FileSelectFile, Path, 3, , Open Excel File, Excel File (*.xls; *.xlsx)
if Path =
ExitApp
Xl := ComObjCreate("Excel.Application")
Xl.Workbooks.Open(Path) ;open an existing file
Xl.Visible := True
if Errorlevel
{
MsgBox, % "Error opening excel file! Exiting..."
ExitApp
}
; Выбор листа в книге
Sheet_Titles =
global Sheet_To_Calculate := 0
loop, % xl.Sheets.Count
Sheet_Titles .= A_Index . ": " . xl.Sheets(A_Index).Name . "`n"
While Sheet_To_Calculate < 1 || Sheet_To_Calculate > xl.Sheets.Count || !IF_Integer(Sheet_To_Calculate)
inputbox, Sheet_To_Calculate, % Xl.ActiveWorkbook.Name, %Sheet_Titles%, , , , , , , , 1
if ErrorLevel
ExitApp
; Выбор строки, с которой начинать копирование
global Current_Row := -1
While Current_Row < 1 || !IF_Integer(Current_Row)
inputbox, Current_Row, % Xl.ActiveWorkbook.Name, % "Enter the row to start on.", , , , , , , , 2
if ErrorLevel
ExitApp
; THE REAL MEAT :) while the current row's A column is not blank, continue the loop
while Xl.Sheets(Sheet_To_Calculate).Range("F" . Current_Row).Value != ""
{
; Выбор столбца с № документа
F_stored := Xl.Sheets(Sheet_To_Calculate).Range("F" . Current_Row).Value
Sleep 200
ie.document.getElementsByTagName("input")[2].value := Xl.Sheets(Sheet_To_Calculate).Range("F" . Current_Row).Value
sleep 200
ie.document.getElementsByTagName("button")[0].click()
Sleep 2500
Xl.Range("B" . Current_Row).Value := ie.document.getElementsByTagName("span")[1].innerText
sleep 300
Xl.Range("C" . Current_Row).Value := ie.document.getElementsByTagName("span")[3].innerText
sleep 300
; Move to the next row
Current_Row++
}
Xl.Range("A2").Formula := "=RC[1]&RC[2]"
sleep 50
MsgBox, % "Сделано!"
sleep 100
path := xl.ActiveWorkbook.path
name := xl.ActiveWorkbook.name
Str := RegExReplace(name, ".xlsx")
file := path "\" Str "_проверено" ".xlsx"
xl.ActiveWorkbook.SaveAs(file, 51)
sleep 100
Xl.ActiveWorkbook.close()
ie.quit
ExitApp
IF_Integer(check_this)
{
if check_this is not integer
return false
else
return true
}
return
F12::
Pause
return
$Esc::ExitApp ;EMERGENCY EXIT HOTKEY