Notepad++: how to save edited file automatically before launching in browser?

0

I am editing say an HTML file in Notepad++ and want to see the result in a browser launched by a keyboard command defined in the Run menu. The problem is that I always need to press Ctrl+S to save my edits before launching the browser. Is there a way to configure Notepad++ to save the file automatically on the browser launch so that I will only press the keyboard combination to launch the browser?

TecMan

Posted 2019-12-24T07:37:35.127

Reputation: 966

Have you tried to create a macro that save the file & launch the browser? – Toto – 2019-12-24T09:36:56.593

@Toto, No. Any example how to do that? – TecMan – 2019-12-24T13:38:16.957

You could find some tips here

– Toto – 2019-12-24T14:15:10.873

@Toto, I can't find how to run an external app with parameters from a native Notepad++ macro. I need this command to launch the browser with the full path to the current file. Perhaps, we need to use NppExec or something like that to implement what I need. – TecMan – 2019-12-25T17:01:08.113

@Toto, see my answer to the question. – TecMan – 2019-12-25T17:35:01.057

Answers

1

I implemented what I need with the NppExec plugin. After installing it, I opened its Execute dialog and wrote the following script:

npp_console 0
npp_save
"C:\Program Files\Mozilla Firefox\firefox.exe" "$(FULL_CURRENT_PATH)"

Then saved it as a macro with the name 'Save and Open in Firefox'. After this I opened the Advanced Options for the NppExec plugin and added my script to the Macros submenu using the corresponding button in the options dialog. And finally, I assigned the ALT+F1 key to this macro using the standard 'Modify Shortcut/Delete Command' dialog in Notepad++ (can be found in the Macro or Run menu).

TecMan

Posted 2019-12-24T07:37:35.127

Reputation: 966