; Download software https://www.autoitscript.com/site/autoit/downloads/
; run this script from SciTE script editor
; This is the script, it will find the microsoft teams window and the chat box title, typing automatically
; Wait for 5 seconds to open Microsoft Teams, click on the chat window and typing message field, this need to be done manually.
Sleep(5000)
While True ; Loop indefinitely
; Wait for the Microsoft Teams window to exist
;MsgBox(0, "Window Handle","debug -1")
;use the AutoIt v3 Window Info to capture the microsoft teams chat window title, for example, capture the chat box title is "John Smith (ABC) (You) | Microsoft Teams"
WinWait("John Smith (ABC) (You) | Microsoft Teams")
; Activate the Microsoft Teams window using its title and a more specific WinTitleMatchMode
WinActivate("John Smith (ABC) (You) | Microsoft Teams")
; MsgBox(0, "Window Handle","debug0")
; Wait for the window to become active
WinWaitActive("John Smith (ABC) (You) | Microsoft Teams")
;MsgBox(0, "Window Handle","debug1")
;Try to get and focus on the typing field, but this controlwait does not work with classnameNN value
;ControlWait("John Smith (ABC) (You) | Microsoft Teams", "", "Intermediate D3D Window1", "")
;MsgBox(0, "Window Handle","debug2")
; Set focus to the message input field
;ControlFocus("John Smith (ABC) (You) | Microsoft Teams", "", "Intermediate D3D Window1")
; Wait for the "Type a new message" field to become visible
;ControlWait("John Smith (ABC) (You) | Microsoft Teams", "", "Intermediate D3D Window", "Visible")
; Click on the "Type a new message" field to focus it
;ControlClick("John Smith (ABC) (You) | Microsoft Teams", "", "Intermediate D3D Window", "left", 1, 444, 617)
;MsgBox(0, "Window Handle","debug3")
Send("H ")
; Erase the text by sending the backace key in a loop
; While StringLen(ClipGet()) > 0
Send("{BACKSPACE}")
; WEnd
; WinSetState("John Smith (ABC) (You) | Microsoft Teams", "", @SW_MINIMIZE)
Sleep(60000)
WEnd
Similarly, Python scripting:
https://ayushi7rawat.medium.com/how-to-automate-ms-teams-with-python-6a5ca1b62cb2
Comments
Post a Comment