Thursday, November 27, 2025

How to send one thousand time window keys with powershell

 for ($i = 0; $i -lt 1000; $i++) {


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

    # Optional: Add a small delay (e.g., 10 milliseconds) to prevent overwhelming the system

    Start-Sleep -Milliseconds 10

}

How to click window button and open file explorer with powershell

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


Start-Sleep -Seconds 3

[System.Windows.Forms.SendKeys]::SendWait("file explorere")


[System.Windows.Forms.SendKeys]::SendWait("{ENTER}")

One thousand times left click in PowerShell

 Add-Type -AssemblyName System.Windows.Forms

Add-Type -AssemblyName System.Drawing


function Send-MouseClick {

    # Define the necessary Win32 API function for mouse events

    $signature = @'

    [DllImport("user32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)]

    public static extern void mouse_event(uint dwFlags, uint dx, uint dy, uint cButtons, uint dwExtraInfo);

'@


    $mouseEvents = Add-Type -MemberDefinition $signature -Name "Win32MouseEvents" -Namespace "Windows" -PassThru


    # Mouse event flags

    $MOUSEEVENTF_LEFTDOWN = 0x0002

    $MOUSEEVENTF_LEFTUP = 0x0004


    # Get current cursor position

    $cursorPos = [System.Windows.Forms.Cursor]::Position

    $x = $cursorPos.X

    $y = $cursorPos.Y


    # Perform the left mouse button down and up events

    $mouseEvents::mouse_event($MOUSEEVENTF_LEFTDOWN, $x, $y, 0, 0)

    $mouseEvents::mouse_event($MOUSEEVENTF_LEFTUP, $x, $y, 0, 0)

}


# Loop 1000 times to perform 1000 clicks

for ($i = 0; $i -lt 1000; $i++) {

    Send-MouseClick

    # Optional: Add a small delay (e.g., 10 milliseconds) to prevent overwhelming the system

    Start-Sleep -Milliseconds 10

}


Write-Host "1000 clicks performed."


Tuesday, November 25, 2025

How to add comments in Excel

 With single cottes   ' test '

How to save file with VBA - How to save file with Macro - in Excel or MS Word

 Sub Macro2()


Shell "winword", vbNormalFocus   

   SendKeys "George W. Bush"

   SendKeys "%{F4}", True

    SendKeys "{ENTER}", True  

   'SendKeys "George W. Bush.txt", True'                       'Comment'  

   'SendKeys "%S"'                                     'Comment'

End Sub


How to use chrome as file explorer - How to open folder in Chrome

Type this below code in URL

 file:///C:/

How to add styles to live website in chrome - How to change styles to live website in chrome - How to change background color in live website in chrome

 > Open developer tools in chrome

> Go to sources tab and select overrides tab

> Click on "select folder for overrides" and Select the folder where you want to change the overrides

> Right click on element of website and change color of background or style 

> Click on sources tab and Page tab and save the css file in folder where you select the folder above.


If you want to delete, goto sources tab and goto overrides tab and delete overrides. And the website will be able to run as it was.


or you can use stylebot extension in chrome.

Thursday, November 20, 2025

How to automatically start word and type in it with Powershell

 

#Note This first line is mandatory 

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


# Start WinWord (if not already running)

Start-Process -FilePath "winword.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


# Send some text and an Enter key

[System.Windows.Forms.SendKeys]::SendWait("This is a test message.")

[System.Windows.Forms.SendKeys]::SendWait("{ENTER}")

[System.Windows.Forms.SendKeys]::SendWait("Another line of text.")


Monday, November 17, 2025

How to stop applicaion in seconds in excel - step by step macro wait for one second - Excel Sleep

 Application.Wait (Now + TimeValue("00:00:01"))

or

Application.Wait Now + TimeSerial(0, 0, 5)


Note: This is only work in Excel VBA, Not in Word VBA.

How to copy a cell in Excel with VBA and how to show MessageBox in excel - alert in Excel

  Selection.Copy

 MsgBox "Copied ---- " & Selection


Note:- Copy Only a single cell , if more than one cell copied, it will give error

Thursday, November 13, 2025

Tuesday, November 11, 2025

How to type auto in windows 11 with powershell - sending keys in power shell

 [System.Windows.Forms.Cursor]::Position = New-Object System.Drawing.Point(100, 200)



$wshell = New-Object -ComObject wscript.shell

$wshell.AppActivate("Title of the application window") # Activate the target window

Start-Sleep -Seconds 5  # Give time for the window to activate

$wshell.SendKeys("Hello World{ENTER}")


After 5 seconds, it will paste in the window where cursor is clciked

Thursday, November 6, 2025

How to create shortcut of URL in chrome

> First Open chrome

 > Click on 3 dots and click on cast, save and share

>Click on create shortcut and a shortcut will be created.