Jump to content

Recommended Posts

Posted

The AI designed for shortcoming script generation is currently not performing quite well, prompting me to explore other ideas and options. I’m interested in converting the text field Handle (of Word Office) into a standalone active window. This would be to facilitate the creation of a specific video tailored for the child window holding the text as much as possible in the center and employing a method demonstrated here. Along with enabling magnification through the (win+ shortcut), it may present additional challenges, as the primary screen window monitors the Read-aloud text, resulting in a 'follow the typewriter effect.' The challenge lies in ensuring that all components operate in conjunction with a screen & audio recorder as cleanly as possible. To demonstrate a starting point, here is an AI-generated script. 

 

; AutoIt Script for Word Document Creation and Interaction
; This script performs the following tasks:
; 1. Generate a block of text and save it to a Word document.
; 2. Open the Word document.
; 3. Set focus on the text field.
; 4. Use text-to-speech functionality to read the text aloud.
; 5. Prepare for window recording.

#include <Word.au3>
#include <MsgBoxConstants.au3>

; Function to create and save a Word document
Func CreateAndSaveWordDoc()
    Local $oWord = _Word_Create() ; Create a new Word instance.
    Local $oDoc = _Word_DocAdd($oWord) ; Add a new document.

    ; Sample text to include in the document
    Local $sText = "This is a sample line one." & @CRLF & _
                   "Here is line two explaining something important." & @CRLF & _
                   "Line three introduces additional details about this task." & @CRLF & _
                   "The fourth line is here to ensure we have enough content." & @CRLF & _
                   "In line five, we'll elaborate on related concepts." & @CRLF & _
                   "Line six provides further clarification." & @CRLF & _
                   "On the seventh line, we summarize our findings." & @CRLF & _
                   "The eighth line gives a clear conclusion." & @CRLF & _
                   "Line nine might suggest what to consider next." & @CRLF & _
                   "Finally, line ten wraps up the information provided."

    ; Insert the text into the document
    _Word_DocWrite($oDoc, $sText)

    ; Save the document
    Local $sFilePath = @ScriptDir & "\example.docx"
    _Word_DocSaveAs($oDoc, $sFilePath)

    ; Open the document
    _Word_DocOpen($oWord, $sFilePath)

    ; Set focus on the text field
    WinActivate("example.docx - Word") ; Adjust window title if needed
    Sleep(500) ; Wait for half a second for the window to activate

    ; Read the document aloud using text-to-speech
    Local $oVoice = ObjCreate("SAPI.SpVoice")
    $oVoice.Speak($sText)
    
    ; Prepare for recording (this part is a placeholder)
    ; Further implementation required for capturing active window to AVI
    
    ; Close the Word application
    ; _Word_Close($oWord)
EndFunc ;==>CreateAndSaveWordDoc

; Run the function
CreateAndSaveWordDoc()

 

Posted (edited)

Step 1: Launch Microsoft Word and Capture the "Handle" Text Field

Use AutoIt to launch Microsoft Word and capture the "Handle" text field. This will enable us to work with the text field as a centered standalone element.

Step 2: Record and Center the Highlighted Read-Aloud Text

While recording, center the highlighted read-aloud text by enabling magnification using the "win+" shortcut. This will allow us to focus on the text and create a clear video.

Edited by Deye
Posted

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...