The RP Photonics Software News
New Feature: Code Snippets Library
Posted on 2016-06-21 in the RP Photonics Software News (available as e-mail newsletter!)
Permanent link: https://www.rp-photonics.com/software_news_2016_06_21.html
I have just implemented a nice new feature for the software RP Fiber Power, RP Coating, RP ProPulse and RP Resonator. There is now the so-called code snippets library. Its purpose is to conveniently provide certain parts (snippets) of script code, which you can directly insert in the script editor. You will normally find it quite easy to understand the snippets, which also contain some comments, and can adapt them to your application.
You can reach the code snippet library with the Edit menu or (more quickly) with a new item in the toolbar of the main window, and here is what you will see (in case of RP Fiber Power):
(In other programs, you will find a different set of specialized snippets.)
The library is very easy to handle. You just select a snippet in the list on the left side, and see its content on the right side. With the button “Copy to clipboard” you can copy it to the Windows clipboard; with “Insert into script editor” it is also inserted into the active script editor – just at the location of the cursor. (If you got the wrong position, press Ctrl-Z to redo, move the cursor to the correct location, and press Ctrl-V for pasting again.)
Using this feature is certainly easier than searching for some solution in the documentation, e.g. in the online help system, or in the demo files. When you find a command or function in the code which you do not know, just place the cursor on it in the script editor and press F2 to call the corresponding help page.
The software comes with some set of code snippets, and you can also add your own snippets quite easily. With the button at the bottom, you can open a file in a user folder where you can place your own snippets; these will be used in addition, and will not be lost if the original snippets file is changed due to a software update, for example.
I will probably add quite a few more snippets in the coming weeks, trying to provide useful things for a lot of common purposes.
As always, users of our software can have a free update in order to get this feature – just contact us. This holds even if you are using a quite old version. You know, many other software companies want you to regularly pay for maintenance subscriptions, while we are very generous to our customers.
If you like this article, share it with your friends and colleagues, e.g. via social media: