Jump to content

Snippet holder for SciTE


BigDaddyO
 Share

Recommended Posts

Just downloaded, but it is version 1.8 not 1.9. Very impressive - what a useful tool.

Steve

PS I use firefox and the download links on this forum now open the code in a new tab and don't download, I know it is only a minor irritation to cut and paste to scite, has anyone else got this problem????

Link to comment
Share on other sites

Just downloaded, but it is version 1.8 not 1.9. Very impressive - what a useful tool.

Steve

PS I use firefox and the download links on this forum now open the code in a new tab and don't download, I know it is only a minor irritation to cut and paste to scite, has anyone else got this problem????

Yea, My version is only up to 1.8... Gafrost made his own modifications and posted up his version which he labeled v1.9 so you have to try to keep that seperated.

As for the Firefox thing, Yea, I use firefox also and it's been doing that for a long time. I have just gotten used to clicking the file, then doing Ctrl+A, Ctrl+c, then pasting into a temp.au3 file that I keep open all the time in SciTE.

I know it sucks but I don't know when or if it will be fixed.

Mike

Link to comment
Share on other sites

Yea, My version is only up to 1.8... Gafrost made his own modifications and posted up his version which he labeled v1.9 so you have to try to keep that seperated.

As for the Firefox thing, Yea, I use firefox also and it's been doing that for a long time. I have just gotten used to clicking the file, then doing Ctrl+A, Ctrl+c, then pasting into a temp.au3 file that I keep open all the time in SciTE.

I know it sucks but I don't know when or if it will be fixed.

Mike

Nothing to keep seperated, removed mine, was 1 window, now has the edit window which slides out from behind the main windows when a selection is made, slides back behind and disapears when neither window has focus, this keeps the width of the gui down to just the main gui execpt when selecting a snippet.

Edited by gafrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

So, where can I find the one you describe below?

Gene

Nothing to keep seperated, removed mine, was 1 window, now has the edit window which slides out from behind the main windows when a selection is made, slides back behind and disapears when neither window has focus, this keeps the width of the gui down to just the main gui execpt when selecting a snippet.

[font="Verdana"]Thanks for the response.Gene[/font]Yes, I know the punctuation is not right...

Link to comment
Share on other sites

Thanks

Gene

Added option of docking the edit window on left or right of main window, just select File, then Dock Edit Window, then either Dock Left or Dock Right, the window will slide out from that direction.

Gary

[font="Verdana"]Thanks for the response.Gene[/font]Yes, I know the punctuation is not right...

Link to comment
Share on other sites

  • Developers

Also,

A friend of mine uses another application for vb scripting and he says that he just highlights the code in his editor window, Right clicks, then clicks add as Snippet. I don't know if this is possible but I think I will look into adding an item into SciTE's Right click menu.

This can be done...

To demo do the following steps:

- Edit SciteUser.properties and add the following lines:

user.context.menu=\

||\

Create snippet|1140|

command.40.$(file.patterns.au3)="$(SciteDefaultHome)\snippet\demo.exe" "$(CurrentSelection)"

command.subsystem.40.$(file.patterns.au3)=2

command.name.40.$(file.patterns.au3)=Create snippet

command.shortcut.40.$(file.patterns.au3)=

command.save.before.40.$(file.patterns.au3)=2

command.replace.selection.40.$(file.patterns.au3)=0

command.quiet.40.$(file.patterns.au3)=1

Create a Autoit3 script in AutoItdirectory\snippet called demo.au3 and add this line:

Msgbox(0,"selection",$cmdlineraw)

Compile demo.au3.

This should do it. You have now a right click menu item that says Create snippet which will sent the selected text into an MsgBox...

:lmao:

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

I'll jump into the fray as well :lmao:

I had snippet functionality written into AutoEd and had written a stand alone version as well some time ago

I thought I would update it and post it here as well.

so now you have a 3rd choice, it's pretty basic (no categories)

http://www.autoitscript.com/fileman/users/lookfar/snippets.rar

delphi source:

http://www.autoitscript.com/fileman/users/lookfar/snippets-src.zip

Now that I think about it, I could probably get the code Explorer out of AutoEd and use similar to integrate a code Explorer into Scite..hmmm

Edited by lookfar
Link to comment
Share on other sites

This should do it. You have now a right click menu item that says Create snippet which will sent the selected text into an MsgBox...

;)

JdeB,

Thanks for the info. It took me a while to figure out a way to use this.

With my Version 1.9 it will now launch the Snippet.exe, If you launch it again it will load the entire GUI window again then check if there was a command line, if so it will close the previous Snippet.exe instance and automatically open the new Snippet window in the new snippet.exe instance. if there was no command line then it will close the new Snippet.exe window. it also performs the cmdline check upon the initial launch.

I don't exactly feel all warm and fuzzy about the way this works but I couldn't think of any other way to do this. :lmao:

Mike

Edited by MikeOsdx
Link to comment
Share on other sites

JdeB,

Thanks for the info. It took me a while to figure out a way to use this.

With my Version 1.9 it will now launch the Snippet.exe, If you launch it again it will load the entire GUI window again then check if there was a command line, if so it will close the previous Snippet.exe instance and automatically open the new Snippet window in the new snippet.exe instance. if there was no command line then it will close the new Snippet.exe window. it also performs the cmdline check upon the initial launch.

I don't exactly feel all warm and fuzzy about the way this works but I couldn't think of any other way to do this. :lmao:

Mike

I started to look at that, decided not to mess with it at this time, check out my previous post you might find it interesting.

Gary

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

I started to look at that, decided not to mess with it at this time, check out my previous post you might find it interesting.

Gary

I like that you can switch over to basically the way I have it since I am still not a fan of the listview.

Here are a couple things I noticed about your listview.

1. How do I move a snippet from one Category to another?

2. If I right click on a snippet you can select rename Category which shouldn't be there, I would suggest since your Categories are in a combo box you add the rename feature in file, or Config options.

3. If you are viewing a current category and you choose the insert snippet here from the right click, it should automatically populate the Category combo in the New Snippet window.

4. You can only modify the snippet via the slide out window, which isn't bad but I would have made the slide out window un-editable and give a modify button or checkbox to enable the edit box.

5. Actually, I think I would take the entire Right click ability off the listview and add those options into the slide out window.

6. Maybe even add the slide out window as the add new snippet window since that is where it has to be edited also. You would have to add more stuff to the slide out but that would be cool.

Mike

Link to comment
Share on other sites

I like that you can switch over to basically the way I have it since I am still not a fan of the listview.

Here are a couple things I noticed about your listview.

1. How do I move a snippet from one Category to another?

2. If I right click on a snippet you can select rename Category which shouldn't be there, I would suggest since your Categories are in a combo box you add the rename feature in file, or Config options.

3. If you are viewing a current category and you choose the insert snippet here from the right click, it should automatically populate the Category combo in the New Snippet window.

4. You can only modify the snippet via the slide out window, which isn't bad but I would have made the slide out window un-editable and give a modify button or checkbox to enable the edit box.

5. Actually, I think I would take the entire Right click ability off the listview and add those options into the slide out window.

6. Maybe even add the slide out window as the add new snippet window since that is where it has to be edited also. You would have to add more stuff to the slide out but that would be cool.

Mike

I like your suggestion about the slide out, the right click on the listview has been a thorne the whole time, when I get time I'll make those changes, see how it turns out.

I'll have to figure out something else about the categories, maybe combo next to it, if not "List All" then show the combo, selections would be New, Rename, Delete. I'll have to see how it looks/feels, thanks for the input.

Gary

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

OK,

I just posted up 2.0 to the first post.

With some inspiration from JdeB I totally changed how it accepts the SciTE's Right click, Add as Snippet. It still launches the program a 2nd time but all it does is reads the command line and sends it into "CMDtmp", "Value" in the INI, and sets "CMDtmp", "New" to 1. then it exists the 2nd instance of snippet.exe.

In the main While statement it is always checking to see if the "CMDtmp", "New" variable has been set to 1. if it has then it knows there is a new Snippet. So it will then read the Temp Snippet and open the New Snippet window and populate the info. Then it deletes all the temp stuff.

I also added some checking to verify that when you add a new snippet you are not overwriting an existing one with the same name.

Mike

Link to comment
Share on other sites

  • Developers

I get the below error when i install it and have no snippet yet and then right click "Add as Snippet" or create the first snippet manually:

---------------------------

AutoIt Error

---------------------------

Line 0 (File "C:\Program Files\AutoIt3\SciTe\snippet\snippet.exe"):

for $t = 1 to $verifyName[0][0]

for $t = 1 to $verifyName^ ERROR

Error: Subscript used with non-Array variable.

---------------------------

OK

---------------------------

EDIT: FIX

lines:283-291

If Not @error Then
        For $a = 1 To $Sections[0]
            If $Sections[$a] <> "~xx123Data" Then
                If $Sections[$a] <> "CMDtmp" Then
                    $SectionStrings = $SectionStrings & "|" & $Sections[$a]
                EndIf
            EndIf
        Next
    EndIf

Lines:309-317

If Not @Error Then
                            For $t = 1 To $verifyName[0][0]
                                If $verifyName[$t][0] == $newName & Chr(160) Then
                                    MsgBox(0, "Duplicate Name", "This snippet name already exists")
                                    $Duplicate = 1
                                    ContinueLoop 2
                                EndIf
                            Next
                        EndIf
Edited by JdeB

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Moved to own thread

v 1.0.1.4

Added the command line option for snipping code from scite

example au3.properties

#Modify Context Menu to add Right Click, Add as Snippet
user.context.menu=||Add as Snippet|1117|

# 17 Gary's Code Snippet
command.17.$(file.patterns.au3)="$(SciteDefaultHome)\Snippets\CSnippet.exe" "$(CurrentSelection)"
command.name.17.$(file.patterns.au3)=Code Snippets
command.shortcut.17.$(file.patterns.au3)=Ctrl+Alt+s
command.subsystem.17.$(file.patterns.au3)=2
command.save.before.17.$(file.patterns.au3)=2
command.replace.selection.17.$(file.patterns.au3)=0
command.quiet.17.$(file.patterns.au3)=1

Gary

Edited by gafrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

I get the below error when i install it and have no snippet yet and then right click "Add as Snippet" or create the first snippet manually:

---------------------------

AutoIt Error

---------------------------

Line 0 (File "C:\Program Files\AutoIt3\SciTe\snippet\snippet.exe"):

for $t = 1 to $verifyName[0][0]

for $t = 1 to $verifyName^ ERROR

Error: Subscript used with non-Array variable.

---------------------------

OK

---------------------------

Thanks JdeB,

I have made the corrections you posted and made a few other corrections. v2.1 has been posted in the first post.

I must say that since I made this I am starting to write more and more so I can easily reuse my code in the future.

Mike

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...