Friday, January 2, 2026

Powershell a to z alphabets 50 times

 #Note This first line is mandatory 


[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")



# Start WinWord (if not already running)


Start-Process -FilePath "notepad.exe"


# Wait for WinWord to open and become active


Start-Sleep -Seconds 3




# Activate the WinWord window (adjust the title if necessary)


$wshell = New-Object -ComObject wscript.shell


#$wshell.AppActivate("Document1 - Word") # Or the actual document title


Start-Sleep -Seconds 1


 for ($k = 1; $k -le 25; $k++) {


 for ($i = 1; $i -le 55; $i++) {


 $j = [char](65 + $i)


 


  (New-Object -ComObject "wscript.shell").SendKeys("$j")


  }


  (New-Object -ComObject "wscript.shell").SendKeys("{Enter}")

}


No comments:

Post a Comment