how to run a notepad++ macro from vbscript or powershell?

  • I 'm trying to run a vbscript and to open notepad++ , open a txt file and run a macro that i have allready made.

    is that possible?



  • till now I have this…

    Dim objShell
    Set objShell = WScript.CreateObject( “WScript.Shell” )“notepad++.exe <path\name.txt>”)
    Set objShell = Nothing

    but I dont know how to run the macro command

  • Hello Thanasis,

    1. Assign a shortcut to your macro via Settings -> Shortcut Mapper -> Macros.
    2. Add the following lines to the script.
    WScript.Sleep(100)    ' Let NPP load and open the file. Adjust the number of milliseconds to your machine.
    objShell.SendKeys("^+9")    ' "^+9" is Ctrl+Shift+9. Replace it with your preferred shortcut. 

    Best regards.

  • thank you
    that worked fine!!!

Log in to reply