This script will allow you to easily store and retrieve commonly used code.
This Script will only work properly if you have SciTE installed in the standard location. If you installed SciTE into a custom location you will have to modify the code to show that location.
v 2.1 Fixed / added the following
- <Added> file, exit
- <Added> the Help, About with a hyperlink to the Forum thread for more info
- <fixed> the Add New Snippet problem if no catagories exist (Thanks JdeB)
- <Fixed> The Category CMDtmp was showing on the main screen
- <Fixed> Overwrite of Snippet checking was preventing the Modifications of current Snippets
v 2.0 Much better handling of the Right Click in SciTE, modification made to the ini structure to handle this... "Thanks again JdeB"
Also put in checking so you don't accidently overwrite an old snippet when you name a new one, "can't imagine how I found this bug. :">
v1.9 Allow new Snippet creation via, Right Click in SciTE
v1.8 Used gafrost code to automatically update the stored x,y coords when ever they change, Also added the hotkey of Ctrl+Alt+s to automatically add any selected text in scite into a new Snippet.
v1.7 Modified the already launched function to show msgbox. & modified the way it attempts to find the SciTE directory to launch SciTE.
v1.6 modified the GUI so it is a MDICHILD of SCITE so it will minimize with SciTE and is only on top of SciTE
v1.5 Added ability to modify code before adding into ini
- Added ability to modify a snippet that is currently stored
- added the abiltiy to move a snippet from one category to another
- modified ini structure slightly
- The code is too long now to paste directly into this so I have attached the file below
v1.4 Added ability to rename and delete Categories and snippets
v1.3 no longer replaces the clipboard contents when retrieving a snippet
v1.2 Improved the Paste into SciTE, Added a Right click, Preview Snippet option.
v1.1 fixed an issue with unable to paste code back into SciTE
Instructions for Use
Upon the initial launch of Snippet you will only see a blank white box with a menu option of Commands.
You must first add some categories to the Snippet holder by clicking Commands, Create a new Category.
You must then specify a name for that Category; an example could be COM Objects or GUI Stuff
Once you have your Categories setup you can then add snippets of code into those Categories.
There are several ways to now add code into those Categories. You may select the category then right click and choose Add new Snippet here.
Or you can Select the Category then click Commands, Add SciTE code as Snippet
Or you can not select any Category and just click Commands, Add SciTE code as Snippet
Or you can Highlight a section of Text in SciTE and right click then choose Add as Snippet. (Only available if you have modified your au3.properties file, See below for more info)
Once the Snippet Code window opens you must specify the Snippet Name you want to use. You must also select a Snippet Category. This will automatically be filled in if a Category was selected before opening this window.
In the large edit box you must now type in or paste in the Code you wish to store.
Click on Save Snippet once finished.
You will now have that snippet name listed under the Category you just selected.
You now have more options when you select a Snippet and right click.
You may perform any of the following
- Send to SciTE
o This will copy and paste this code directly into the SciTE editor where your cursor is
- Preview Snippet
o This will display the snippet in a message box so you can verify it is the one you were looking for
- Modify this Snippet
o This will open the snippet in the Add Snippet window so you can modify the Name, Category, or code
- Rename Selection
o This will allow you to rename the Snippet or Category that is selected
- Delete Selection
o This will allow you to delete the Snippet or Category that is selected
How to Integrate with SciTE
Below are some steps that I have done to make my life easier.
(Warning, perform these options at your own risk)
I created a folder off the SciTE directory called Snippets where I have saved the Snippet.exe
I then modified my SciTE shortcut to point to the new Snippet.exe file since it auto-launches SciTE if its not already open. That way I only have one shortcut to launch SciTE and the Snippet holder.
I have also added a Ctrl+Alt+s command to launch the Snippet.exe once I am in SciTE if I accidentially closed it. Modify SciTEs au3.Properties file by adding the following lines "For me it starts at line 140". Once added, close and re-open SciTE to initialize the changes.
Thanks to JdeB's info I now have added the ability to create a new Snippet by Highlighting text, Right click, click on Add as Snippet. The new version 1.9 supports this feature.
# 16 MikeOsdx Snippet holder
#Modify Context Menu to add Right Click, Add as Snippet
user.context.menu=||Add as Snippet|1116|
Edited by MikeOsdx, 27 January 2006 - 04:13 PM.