Copying from excel In IE and back
Posted: 19 Apr 2018, 07:21
Forgive me for my English, Hello, tell me whether it is possible to automate routine work, for example, there is xls, in column A with some rows of data, you need to copy one cell into chrome into a certain coordinate and copy the result back to xls in column B and also to all other cells. To make the cell copy in chrome made, selected the found old, and how to copy it back into the Excel and so on to the end of the specified lines
Code: Select all
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
$^1::
Setkeydelay, 35
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
while Xl.Sheets(Sheet_To_Calculate).Range("B" . Current_Row).Value != ""
{
B_stored := Xl.Sheets(Sheet_To_Calculate).Range("B" . Current_Row).Value
ControlFocus,, ahk_class IEFrame
Sleep 550
Click, 205, 285, 2
Sleep 150
Send %B_stored%
send {enter}
Sleep 2000
; Move to the next row
Current_Row++
}
MsgBox, % "Done! :)"
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