Skip to content

Run command hotspot

erinata edited this page May 4, 2012 · 3 revisions

Run Command Hotspot is a type of dynamic hotspot. It allows a snippet to make a system call.

The syntax is to use (run) at the beginning of the hotspot. For example, if you want to make a system call "dir", the Chain Snippet Hotspot should be $[![(run)dir]!]

The simplest case is a simple system call, say if you have a snippet

Snippet Content:

$[![(run)echo abc]!]

Trigger the snippet and you will get

abc

You can call almost all kinds of system calls in hotspot. For example:

Snippet Content:

$[![(run)dir]!]

When you trigger this snippet you will get something like this

 Volume in drive D is New Volume
 Volume Serial Number is 51CA-F184

 Directory of D:\Programs\Notepad++

04/13/2012  02:38 PM    <DIR>          .
04/13/2012  02:38 PM    <DIR>          ..
12/18/2010  02:56 AM             5,551 change.log
11/02/2011  03:53 AM            10,547 config.model.xml
05/04/2012  03:28 PM            10,459 config.xml
11/07/2010  04:56 AM             3,235 contextMenu.xml
11/14/2010  02:49 AM            91,509 langs.model.xml
01/31/2011  07:37 PM           112,855 langs.xml
04/25/2009  01:39 AM            14,971 license.txt
01/06/2011  06:53 PM    <DIR>          localization
01/08/2012  01:25 PM    <DIR>          log
01/04/2012  01:06 AM         1,605,632 notepad++.exe
10/07/2011  07:02 AM               118 npp.bat
09/22/2010  10:51 AM           395,311 NppHelp.chm
05/04/2012  01:34 PM    <DIR>          plugins
12/18/2010  01:38 PM             1,463 readme.txt
07/18/2011  11:31 PM           634,880 SciLexer.dll
05/04/2012  03:28 PM               737 session.xml
05/04/2012  03:28 PM             2,342 shortcuts.xml
10/07/2011  07:03 AM               161 snpp.bat
02/21/2010  12:45 PM            95,613 stylers.model.xml
11/07/2011  02:31 AM            50,220 stylers.xml
01/06/2011  07:01 PM    <DIR>          themes
01/08/2012  01:25 PM    <DIR>          updater
01/02/2012  05:11 PM            43,050 userdefineLang.xml
              20 File(s)      3,079,457 bytes
               8 Dir(s)  19,768,033,280 bytes free

The result may varies depends on what files are in the notepad++ folder.

You can even use it to start another program. Say if you have a snippet:

Snippet Content:

$[![(run)calc]!]

A windows calculator program will be started. Notice that this new calculator program freeze up notepad++ and you cannot type anything in notepad++ until you end the calc program. If you want to start a program but you do not want notepad++ to freeze up, you can add SILENT: in the command.

Snippet Content:

$[![(run)SILENT:calc]!]

Another way to use Run Command Hotspot is to integrate Fingertext with scripting language. For example if you have Ruby installed, you can make a snippet like this:

Snippet Content:

$[![(run)ruby -e "5.times { puts 'Hello World' }"]!]

Triggering this snippet you will get

Hello World
Hello World
Hello World
Hello World
Hello World

So you can run any ruby code and have the result pasted into Notepad++. This allow Fingertext to leverge the power of Ruby (or Python, Lua, or any program that shows text in stdout) to generate content in snippets.

Notice that

$[![(run)cd .. ]!]

won't work because changing the working directory of a sub-process will not change the working directory of notepad++. Special treatment may be implemented to make this work in the future.

Back to Main Page