New plugin: Simple Script 0.9

fidvo
2007-11-30
2012-11-14
  • fidvo

    fidvo - 2007-11-30

    Simple Script is now up on the Notepad++ Plugins Project.

    You can download it here:

    http://sourceforge.net/project/showfiles.php?group_id=189927&package_id=254135

    Simple Script allows you to write a series of functions with parameters to process and replace the selected text or the entire document.  See the Readme included with the download for more information.

    Version 0.9 is a public beta.  It's finished but not fully tested.  There are no known bugs at the moment, so you can go ahead and dowload it now and start playing around with it.  Once I've rigorously tested each function I'll upload version 1.0.

     
    • Nobody/Anonymous

      Thank you for the new release.
      One thing in my mind. Its not so important, but easier handling.
      In plugins folder is an config folder, where other .ini files are stored.
      Would you also store your .ini file in it?
      Best Regards.

       
      • fidvo

        fidvo - 2007-12-09

        I'm actually planning to switch over to an xml-based (or at least xml-like) configuration file.  I'll put the SimpleScript.xml file in the Config folder, but for legacy purposes, I'll leave the SimpleScript.ini file in the plugins folder as I phase it out, just to make the transition as easy as possible (I don't want a dozen people on these forums asking why their list of favorite scripts disappeared).  Eventually I'll do away with the .ini file completely.

         
    • Greg Bullock

      Greg Bullock - 2007-12-01

      Thank you for the nice plugin, fidvo. Good job.

      Sorry for the cross-post.  I posted this on the Notepad++ Plugins: SimpleScript forum, but those fora don't seem to get used much.

      I've emailed you a minor modification to make it simpler to write scripts. Please let me know if you don't receive it. I hope you'll consider merging it with the main version. 

      The modification allows the user to view a hierarchical list of the available script functions and to double-click a function to insert its template into the script.

      Regards.
      Greg

       
      • fidvo

        fidvo - 2007-12-01

        I look forward to seeing it.

        I just sent you an alternate email address to send it to, since for some reason I've been having trouble with my SourceForge email.

        If it's anything like it sounds like, I'd love to merge it into the plugin.  I realized as I was testing that I needed a way to help users write scripts.  The documentation is all in the Readme file, which is a text file and therefore if the users need to look at it they'll most likely open it in Notepad++.  Unfortunately, that means that when the script window is open, they can't scroll through the documentation.

        I'll look it over and if I like it I'll add it to the 1.1 version (the 1.0 will just be bug fixes).  Of course I'll give you full credit in the source and Readme.

         
        • Greg Bullock

          Greg Bullock - 2007-12-01

          I'm glad you're interested.

          I just emailed it to your alternate address.  Let me know if it does not arrive.

          After sending it, I thought of another small improvement I could make to the function list.  I'll send that to you once it's finished.

          Regards.
          Greg

           
    • Hashim Kubba

      Hashim Kubba - 2007-12-05

      Thank you for a really nice plug-in, fidvo. Great job.
      As it is release 0.9, I will add some suggestions
      * function conform(padchar):
          very useful function, yet I think you should add the option to handle the prefix manually, so for example if you have:
         
          start at line7
          end at line8
          start at line9
          end_line at line10
         
          and you want to conform line, a user should be able to write conform("0","line"), you should then look for line "words" and replace them so the end_line shouldn't be replaced
          running conform("0") on last lines will get you:
         
          0000start at line7
          000000end at line8
          0000start at line9
          end_line at line10
         
          what I want to see when we run conform("0","line") is

          start at line07
          end at line08
          start at line09
          end_line at line10
         
      * functions insert(text,linenumber), replaceline(text,linenumber)
          instead of linenumber may be you can use linenumber|[linenumbers]|step number, the vertical line means OR, so for your example:
         
          This is the first line.
          This is the second line.
          This is the third line.
          This is the fourth line.
         
          running insert("This is a new line.",2):
         
          This is the first line.
          This is a new line.
          This is the second line.
          This is the third line.
          This is the fourth line.
         
          running insert("This is a new line.",[2,3]):
         
          This is the first line.
          This is a new line.
          This is the second line.
          This is a new line.
          This is the third line.   
          This is the fourth line.
         
          running insert("This is a new line.",step 2):
         
          This is the first line.
          This is the second line.
          This is a new line.
          This is the third line.
          This is the fourth line.
          This is a new line.
         
          This will help you later in your variables goal, something like:
          var x = getlineswithtext("test")
          insert("this line is before test lines",x)

          x might be [4,6,89,678,900]

      * function merge(delimiter):
          very useful function, I would just suggest another one, translate(delimiter), so having this in your clipboard
         
          yes,we
          no,ne
         
          and you run translate(",") on :
          say yes if you want, don't say no ( a really silly sentence .. any way)
         
          will result on
          say we if you want, don't say ne ( a really silly sentence .. any way)
         
          and may be you should also have mergecase and translatecase
         
      *    Using ini file format, will really limit the plug-in, a real useful addition to the it (later) is to have a docable pane, just like the     function list, in there I suggest that you put a pull down menu with the language choice, and three text areas, language specific scripts, general scripts and all scripts, a typical scenario would be:
         
          I open java program:
              pull down menu: java language
              language specific scripts:
                  delete_java_remarks
              general scripts
                  clean_blank_lines
              all scripts
                  clean_blank_lines
                  delete_C_remarks
                  delete_java_remarks

          I open C program:
              pull down menu: C language
              language specific scripts:
                  delete_C_remarks
              general scripts
                  clean_blank_lines
              all scripts
                  clean_blank_lines
                  delete_C_remarks
                  delete_java_remarks

      this is probably for later, and needs a lot of discussions, yet my point is using the ini will limit the capability of grouping scripts, or assigning a group to a language, i think you should use XML or Jason format, what do you think?

      Wow ... that was a long post, I actually used your functions in editing some parts of it, thanks again for the great plug-in

       
      • fidvo

        fidvo - 2007-12-07

        Thanks.  It looks like you picked out some of my favorite functions.  A couple of notes:

        conform:

        Good idea.  I think I'll leave the conform function as it is, but I'll probably add another function, such as conformtag(padchar,tag) that will do what you're talking about.

        insert, replaceline:

        More complex data structures are, sadly, beyond the scope of the plugin as it is right now.  Possibly when I start working on version 2.0 (which may be called something other than Simple Script because it won't be so simple any more).  I might design some more functions to help out here, though.

        Translate:

        This would be an alternative to the replace function, I take it, so you can run a series of replaces with a single function.  I'm assuming this would be mainly for throwaway functions that you run once, because otherwise you would simply design the script using replace, and save it for future reference.

        I'll think about it.  It probably won't be called Translate, because that's too generic a term and doesn't really describe what it does.  (I know, "conform" is also generic, but I couldn't think of anything more specific)

        mergecase, translatecase:

        Mergecase wouldn't make sense, since the placeholders don't have any alphabetical characters in them anyway.  But if I do a Translate function, I suppose a TranslateCase function wouldn't be any more difficult to add.

        Dockable pane:

        I've always had this as sort of my goal, but I wanted to get something out quickly, which was why I went with a separate window, which is much easier to implement.  It's definitely  something I'm hoping to add in a future version.

        XML/Jason:

        Same thing.  I wrote a quick parser for the .ini file just to have something done fast.  I do agree that XML would be a better choice, and it will probably happen some time in the future.

        Grouping/language-specific scripts:

        That's a good idea too.  I hadn't users storing more than a couple dozen of their favorite scripts, but I suppose it could happen.  I'll keep it in mind for a future version.

        By the way, version 1.0 should be out some time this weekend.  It doesn't add any new features; it only fixes the (embarrassingly many) bugs that I found in the 0.9 version.

        Once it's out, I can start to work on the 1.1, which will add some new functions and probably have a selectable list of functions that you can double-click on to copy into the current script (Thanks, Greg).  1.2 will include several new features, including many of the ones that have been suggested on this forum.

         
    • fidvo

      fidvo - 2007-12-08

      I just uploaded version 1.0 to the Notepad++ Plugins Project.

      You can find it here:

      http://sourceforge.net/project/showfiles.php?group_id=189927&package_id=254135&release_id=560211

      It fixes all of the (many) bugs I found after uploading 0.9, so if you downloaded 0.9, I would suggest you download the fix immediately.

      Now I can start adding new functions for version 1.1, so keep the ideas coming.  I want to make it as useful as I can.

       

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks