Jump to content

Simple Snippet Manager


Dan_555
 Share

Recommended Posts

Hi, 

i'v just uploaded my latest project: Simple Snippet Manager to the Downloads. area :
mainwindow-examplelanguage.png.b33aaa19476a2d4c3c41394ba329a258.png

 


 The intended usage is to select a Snippet, and to copy it's contents into your favorite Editor.
    The Copy/Paste process happens over the (windows)Clipboard. 
    The previous clipboard content is not restored.

    There is a time limit of 60 seconds, in which the pasting of the text is allowed (starting when the App window gets inactive).  
    The Hotkey is reenabled, when the main Window is activated.
    
    This is a File/Folder based manager. 
    The App is configured to hold 4000 files and 400 folders with searching depth of 5 sub-folders.
    
    The root folder is freely selectable, but it  should be a Folder with writing permission.
    Please install the App in a folder with Writing permission, too. 
    This App only uses an .ini file to save it's configuration, which has to be in the same folder as the App.
    
First configuration:

1. Open the config Window.
2. Enter the Language name, create or seek a root folder, enter an extension.
3. Click on Set button.
4. Click on the Exit button.

The Language configuration is done, adding files or folders are needed:

 1. Select the language from the dropbox list, and click on Get Lang button.
2a. Right Click on the root folder, chose New folder to add categories.
2b. or chose New/Edit file to open the builtin text editor
 3. Paste or Write a snippet-code, enter a filename and save it.
 
 (Repeat the 3. as needed)
 
Usage:

Select a language, then click on Get Lang button.
Choose a file with the left mouse button.
Check if the code was loaded in the Textarea at the bottom.
Switch to your Sourcecode editor, and press the Hotkey (default= Ctrl/Strg b) to copy and paste the text.

There is a time limit of 60 seconds, after the main window gets inactive, in which the copy&pasting is allowed.

Changelog:

V1.02        (24.06.2020)
            Addition: Undocumented ini setting: StartLoadLastUsedLanguage
                      Setting this to 1 (default value) will now reload the Last used language at start.
                      Last used language counts for the Language, selected with [Get Lang] button. The [Config] button will delete the last used language.
                      LastUsedLanguageNr, LastUsedLanguageName ini settings are used internaly for the above function.
             Added version string to the main Window title.

V1.01        (23.06.2020)
            Bugfix    : Starting the App without the ini file now sets the correct starting Hotkey (Ctrl b)
            Addition: Clipboard is saved, before pasting, and restored after pasting. (May work with text data only. p.s. untested!)

Edited by Dan_555
Updates

Some of my script sourcecode

Link to comment
Share on other sites

wow, this brought back some old memories.  Myself and GaryFrost built separate Snippet holders back in 2006.

Looks like the code is gone from those old threads though I found mine and re-uploaded it.  But it doesn't seem to work anymore.

There is a section that shows how to edit Scite to add your own hotkey so you can highlight code within Scite hit a hotkey and save it into your Snippet Manager.

You should be able to save and restore the clipboard by storing the existing to a var with ClipGet() and once you are done with your insert, put back with ClipPut()

Also, I don't see the code in your post.

 

 

Here is GaryFrost's version that for a while was part of the Scite install but I don't see the code, though there is a link to the compiled download.

 

Link to comment
Share on other sites

Ah, right, the source code and the executables are in the download section. Simple Snippet Manager 

Because it has over 1k of lines, i didn't pasted it.

I have downloaded cSnippet (sometime) last year, and today again, and it gives an error when i switch to Scite ... 

I guess if it worked, i would probably use it, instead of writing a new one.

 

Quote

You should be able to save and restore the clipboard by storing the existing to a var with ClipGet() and once you are done with your insert, put back with ClipPut()

 

Edit: Uploaded a new version with this addition (and a bugfix).

Edited by Dan_555

Some of my script sourcecode

Link to comment
Share on other sites

  • 11 months later...

I've copy&pasted this text from the other thread, in case someone else wants to remove the double clicks to close the windows.

 

The double click is there to prevent closing the window/app by misclicks.

If you do not like it, the source code is in the archive.

Change the following code 

Case $GUI_EVENT_CLOSE
            If $closecounter = 1 Then
                If TimerDiff($TimeHandle) <= 1000 Then
                    ExitLoop
                EndIf
            EndIf
            If $closecounter = 0 Then
                $closecounter = 1
                $TimeHandle = TimerInit()
                WinSetTitle($h_SnipForm, "", "Doubleclick to close")
            EndIf

Into

Case $GUI_EVENT_CLOSE
                    ExitLoop

And the main window will close on single click.

 

Then seek the

Case $GUI_EVENT_CLOSE, $BTN_EXIT
                If $closecounter = 1 Then
                    If TimerDiff($TimeHandle) <= 1000 Then
                        $snipeditclose = 0
                        If $snipeditchanged = True Then
                            $iMsgBoxAnswer = MsgBox(8244, "Exit without saving ?", "Do you want to close the editor without saving the changes ?")
                            If $iMsgBoxAnswer = 7 Then $snipeditclose = 1       ;No
                        EndIf
                        If $snipeditclose = 0 Then
                            GUIDelete($Form1)
                            ExitLoop
                        EndIf
                        WriteToolBar("Please save your file.")
                    EndIf
                EndIf
                If $closecounter = 0 Then
                    $closecounter = 1
                    $TimeHandle = TimerInit()
                    WinSetTitle($Form1, "", "Doubleclick to close")
                EndIf

code and change it into:

Case $GUI_EVENT_CLOSE, $BTN_EXIT
                        $snipeditclose = 0
                        If $snipeditchanged = True Then
                            $iMsgBoxAnswer = MsgBox(8244, "Exit without saving ?", "Do you want to close the editor without saving the changes ?")
                            If $iMsgBoxAnswer = 7 Then $snipeditclose = 1       ;No
                        EndIf
                        If $snipeditclose = 0 Then
                            GUIDelete($Form1)
                            ExitLoop
                        EndIf
                        WriteToolBar("Please save your file.")

And the editor will close on single click.

Then compile the code.

Edited by Dan_555

Some of my script sourcecode

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...