You are on page 1of 2

Name : Omkar Mahajan Roll no.

:25
Practical 14

; Script Start - Add your code below here

; Run Microsoft Word


Run("C:\Program Files\Microsoft Office\root\Office16\WINWORD.EXE")

; Wait for Word to become the active window


WinWaitActive("Microsoft Word")

; Type the text "This is a Sample Example for Microsoft Word"


Send("This is a Sample Example for Microsoft Word Made by")

; Press Enter
Send("{ENTER}")

; Type the text "Mr. Omkar mahajan"


Send("Omkar Mahajan for Automation Testing")

; Sleep for 5 seconds


Sleep(5000)

; Save the document


Send("^s") ; Press Ctrl + S to open the Save dialog

; Wait for the Save As dialog to appear


WinWaitActive("Save As")

; Type the file name "sample_document.docx"


Send("sample_document.docx")

; Press Enter to save the document


Send("{ENTER}")

; Close Word
WinClose("Microsoft Word")

; Press the Yes key to confirm saving changes


Send("!y")

; Script End

1
Output:

You might also like