Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am doing something like this in my F5 command (execute)

C:\Python27\pythonw.exe G:\my_python_script.py

I want to run this script everytime i save file. When i save this command as ctrl+s, notepad++ does not run it, only save my file.

share|improve this question
    
So, instead of pressing [Ctrl]+[S], then [F5] and [Enter], you just want to press [Ctrl]+[S] to save and run? –  iglvzx Feb 16 '12 at 20:24
    
Yes. (characters_needed_to_send) –  SuitUp Feb 16 '12 at 20:33
add comment

3 Answers

If you use the NppExec plugin, the following macro will do what you want:

npp_save
C:\Python27\pythonw.exe G:\my_python_script.py

This can be bound to any key combination, does not rely on any existing shortcuts, and will bring up a save dialog if necessary.

share|improve this answer
    
took some fiddling on my part, but indeed, this is a good solution. –  automatonic Aug 20 '12 at 23:44
add comment

You can use AutoHotkey to easily create macros. For your case, the following script will work:

#IfWinActive, ahk_class Notepad++
^s:: ;Ctrl+S
{
    Send, ^s{F5}
    WinWaitActive, Run...
    Send, {Enter}
    return
}
#IfWinActive

You may need to run the script as an administrator, since Notepad++ uses it's own keyboard hooks.


Download: http://ahk.igalvez.net/Notepad++SaveRun.exe, 784KB

share|improve this answer
add comment

You can save a macro that will do this.

First, change the file so you can save. Then Start Macro, Ctrl+S, Execute your script, Stop Recording, Save recorded Macro.

Now you can either save this macro as Ctrl+S plus something, or just Ctrl+S, the latter would require you to un-map Ctrl+S.

If you must have it as a global hook into Ctrl+S (as Save) I do not have an answer for you, as I do not believe this is allowed, though you can macro any combination of events you want.

Hope this helps!

share|improve this answer
    
Oh, I need to have 15 reputation to vote up you. :( –  SuitUp Feb 16 '12 at 20:31
1  
It does not work, how should i execute script so it will be recorded? –  SuitUp Feb 16 '12 at 20:40
    
I believe you can give it a shortcut and then run that shortcut, in this case I was using a Python Script Plugin found here: npppythonscript.sourceforge.net –  jidar Feb 16 '12 at 20:52
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.