Copy-paste with keyboard script 2: from Excel to D365FO

Copy-paste with keyboard script 2: from Excel to D365FO

Again an entity was missing in D365FO to import the data, this time a custom one. Building upon my work Copy-paste automation in D365 FO with a keyboard script, I created a Wunderwaffe script to copy a simple table with a Code and a Description directly from Excel into the D365FO browser window.

Close all other windows and put the browser with D365FO and Excel side by side. Place the cursor in Excel in the Code column at the first row to copy, then hit Ctrl-J. The script will start copying data from Excel and pasting records in D365FO by switching windows forth and back:
^j::
; --------- Place the focus on the code column in Excel, start with Ctrl-J
Loop 200 {
; --------- Copy the content of the Code from Excel
Send, ^c
Sleep, 500
; --------- Switch the window: Alt-Tab
Send, !{TAB}
Sleep, 1000
; --------- Create a new record in the D365FO window
Send, {Alt Down}
Sleep, 500
Send, n
Sleep, 500
Send, {Alt Up}
Sleep, 1000
; --------- Go to the next field and back in the D365FO to get into the edit mode
Send, {TAB}
Sleep, 1000
Send, +{TAB}
; --------- Paste the code
Send, ^v
; --------- Switch the window and go back to Excel
Send, !{TAB}
Sleep, 1000
; --------- Copy the content of the Description column from Excel
Send, {Right}
Send, ^c
Sleep, 1000
; --------- Switch the window for D365FO
Send, !{TAB}
Sleep, 1000
Send, {TAB}
Sleep, 500
; --------- Paste the description
Send, ^v
; --------- Switch the window for Excel
Send, !{TAB}
Sleep, 1000
; ---------Scroll down to the next record, and repeat the cycle
Send, {Down}{Left}
}
Return
; Press F1 in panic
F1::ExitApp