Code: Select all
#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.
^j::
Clipboard := ""
xl := ComObjCreate("Excel.Application")
xl.Visible := true
path = xxxx ; real path in real code
xl.Workbooks.Open(Path)
xl.sheets("Converted").select ; selects the sheet
;set first column
col = 6
Loop 2
{
;set columns to copy
col1 := "F" . col
col2 := "G" . col
;first cell selection and copy
xl.Range(col1).Select
xl.Range(col1).Copy
;ALT+TAB to switch to web form
Send, {Alt Down}
Send, {Tab}
Send, {Alt Up}
;TAB's to switch to first form field
if(A_Index = 1)
{
Loop 13
{
Send {Tab}
}
}
;Paste Copied Cell Data and TAB to next field ;Form is restricted only this kind on input works
SendInput {Raw}%clipboard%
Send, {Tab}
;ALT+TAB to switch back to excel file
Send, {Alt Down}
Send, {Tab}
Send, {Alt Up}
;Clear Clipboard before copying
Clipboard:= ""
ClipWait, 2
;second cell selection and copy
xl.Range(col2).Select
xl.Range(col2).copy
;ALT+TAB to switch back to web form
Send, {Alt Down}
Send, {Tab}
Send, {Alt Up}
;Paste the copied cell and TAB to next form field
SendInput {Raw}%clipboard%
Send, {Tab}
;ALT+TAB back to excel file
Send, {Alt Down}
Send, {Tab}
Send, {Alt Up}
;increment to get next column
col++
}