Menu

Plugin Basic Info

2010-01-03
2013-04-24
  • Andrzej Kmicic

    Andrzej Kmicic - 2010-01-03

    Plugin AutomationPHP scripting language is inserted to control the Editor Notepad + + and text processing.
    I use it very often because my hobby is working texts. Why did I choose PHP?. There is a specialized language to use hypertext. PHP is a scripting programming language - programs written in it are not compiled into a machine code understandable by the processor, but performed by a special application called PHP interpreter. PHP was originally created to support the creation of dynamic web pages, but now it can also write ordinary applications for the operating system. A wide selection of free examples of functions, examples and libraries, has prompted me to write a scripting language that can run on texts Notepad + +, and control its functions. Like doing it in Excel Visual Basic.
    A set of commands allows you to control and manipulate text directly in Notepad + +. Command syntax is based on the communications interface based on windows Notepad + +, and Scintilla.

    The main commands are:

    **delphi_date**   *Returns the current date.*

    example :

        <?php
        $date=delphi_date();
        print $date."\n";
        ?>
    result :

    Date in Delphi DateTime Format   40181

      **npp_extract_file_dir** - *Extracts the drive and directory parts from FileName*.

      **npp_extract_file_drive** - *Returns the drive portion of a file name.*

      **npp_extract_file_name** - *Extracts the name and extension parts of a file name.*

    example :

            <?php
           
            print  npp_extract_file_dir("C:\\Program Files\\Notepad++\\Notepad++.exe")."\n";
       
            print  npp_extract_file_drive("C:\\Program Files\\Notepad++\\Notepad++.exe")."\n";
       
            print  npp_extract_file_name("C:\\Program Files\\Notepad++\\Notepad++.exe")."\n";
       
            ?> 
    result :

           C:\Program Files\Notepad++
      
           C:
      
           Notepad++.exe
      
          .exe
     
    **npp_show_message** - *Displays a message box with an OK button.*

    example :

          <?php
     
          npp_show_message("This is Test Plugin AutomationPHP");
     
          ?>
     
    **npp_plugin_get_author** - *Returns TAuthor object*

    example:

       <?php

       $a=npp_plugin_get_author();

       print_r($a);

       ?>

    result :

        php4delphi_author Object

        (

         => Wojtek

         => Jarzecki

         => 185

         => wojtek.jarzecki@vipserv.org

        )

    **npp_str_date** - *Converts a TDateTime value to a string.*

    example :

        <?php

        $date=delphi_date();

        print npp_str_date($date)."\n";

        ?>

    result :

        2010-01-03

    **npp_Get_System_Directory** - *Returns Windows system directory*

    example:

        <?php

    print npp_Get_System_Directory();

        ?>

    result :

        C:\WINDOWS\system32

    **npp_input_box** - *Displays an input dialog box that enables the user to enter a string.*

    example:

        <?php

    $title="Input box";

    $prompt="Enter Value";

    $default="100";

    $input=npp_input_box($title,$promopt,$default);

    print $input;

        ?>

    result:
       
    99 if You enter value 99 else 100 (default value)

    **nppMenuExec** - *Execute notepad++ menu command send as string of name eg messsage*

    example:

        <?php

    nppMenuExec("IDM_VIEW_ZOOMIN");

        ?>

    result: Emulate click for N++ ZoomIn Menu Item

    **nppGetOpenFiles** - *Return assoc array with open filenames*

    example:

         <?php
      
         $a=nppGetOpenFiles();

         print_r($a);

         ?>
      
    result :

        Array

        (

         => Array

           (
      
                 => D:\My Documents\plugin_descr.txt

                 => D:\My Documents\example.php

                 => D:\My Documents\plugin_description_foramat.txt

            )

         => Array

            (
                 => new  1

            )

        )

    **nppUserCommand** - *Return data from npp group command for NPP commands :*

        nppUserCommand("NPPM_GETCURRENTSCINTILLA");

    return Current View Number 0 or 1

        nppUserCommand("NPPM_GETCURRENTLANGTYPE");

    return Lang Type Number 1 for PHP .. 8 for HTML etc…

        nppUserCommand("NPPM_SETCURRENTLANGTYPE",$lang_type_number); 

    Set current Lang Type parameter - number lang

        nppUserCommand("NPPM_GETFULLCURRENTPATH")

    return Full Current Path

        nppUserCommand("NPPM_GETCURRENTDIRECTORY");

    return Full Current Directory

        nppUserCommand("NPPM_GETFILENAME");

    return Current FileName
       
    nppUserCommand("NPPM_GETEXTPART");

    return Extension from Current FileName
       
    nppUserCommand("NPPM_GETCURRENTWORD");

    return Current word from caret position
       
    nppUserCommand("NPPM_GETNPPDIRECTORY");
       
    return Notepad++ directory

        nppUserCommand("NPPM_GETPLUGINSCONFIGDIR");
       
    return Notepad++ plugin config directory
                                                                                                    
        nppUserCommand ("NPPM_DOOPEN",$full_path);
       
    Open file from parameter (fuul path) in current view in new tab
    example:

        <?php

        nppUserCommand ("NPPM_DOOPEN","C:\\Windows\\Notepad.exe");

        ?>

         nppUserCommand ("NPPM_SAVECURRENTSESSION",$full_path);
      
    Save current session as parameter (full path)
        
    nppUserCommand ("NPPM_LOADSESSION",$full_path);

    Save current session as parameter (full path)

         nppUserCommand ("NPPM_SWITCHTOFILE",$full_path);
      
    Switch view to file as parameter (full path)
                                                               
         nppUserCommand ("NPPM_GETCURRENTDOCINDEX");

    return Current doc index 0…n                         

         nppUserCommand ("NPPM_ACTIVATEDOC",$view,$doc);
      
    activate documnet for view number parameter 1 (0..1) doc number parameter 2 (0..n)         
                             
         nppUserCommand ("NPPM_SAVECURRENTFILE");,

         nppUserCommand ("NPPM_SAVEALLFILES");

    Save current or all files to disk        
                                                    
         nppUserCommand ("NPPM_RELOADFILE");
      
    reload file as parameter (full path)         

    **sciGetText** - *Return text from current Scintilla*

    example:

        <?php

    nppUserCommand("",0,0); set current view=0, current doc tab =0;

    // activate doc

        $text = sciGetText();

    // get text from active doc

        ?> 

    result:
    $text containing all text fom view 0 and doc 0

    **sciText** - *Text operation for Scintilla*

        sciText("SCI_GETTEXT");

        sciText("SCI_GETLINE",$line_num);

        sciText("SCI_SETTEXT",$text);

        sciText("SCI_INSERTTEXT",$position,$text);

        sciText("SCI_ADDTEXT",$text);

        sciText("SCI_APPENDTEXT",$text);

        sciText("SCI_GETTEXTRANGE",$from_position,$to_position);

        sciText("SCI_GETSTYLEDTEXT",$from_position,$to_position);
       
    return array

        sciText("SCI_ADDSTYLEDTEXT",$celltextstring);

        sciText("SCI_CLEARALL");

        sciText("SCI_CLEARDOCUMENTSTYLE");

        sciText("SCI_GETCHARAT",$position);

        sciText("SCI_GETSTYLEAT",$position);

        sciText("SCI_SETREADONLY",$bool_readonly);

        sciText("SCI_SETSTYLEBITS",$numbits);

        sciText("SCI_GETSTYLEBITS");

        sciText("SCI_GETREADONLY");

        sciText("SCI_REPLACESEL",$textToReplace);

        sciText("SCI_SETSAVEPOINT");

    Commands below this command windows Scintilli messages to different operations.

    Each command consists of a command group, "ID" and possibly parameters:

    example :

        sciSelectInfo("SCI_POSITIONFROMPOINT",$xpoint,$ypoint);

    "IDs" and "PARAMETERS" Find SCINTILLA DOCUMENTATION:

    http://www.scintilla.org/ScintillaDoc.html

    **sciOvertype** - *Overtype operation for Scintilla*
      
    **sciErrorHandle** - *ErrorHandle operation for Scintilla*
      
    **sciUndoRedo** - *UndoRedo operation for Scintilla*

    **sciSelectInfo** - *SelectInfo operation for Scintilla*

    **sciScroll** - *Scroll operation for Scintilla*

    **sciWhiteSpace** - *WhiteSpace operation for Scintilla*

    **sciLineEnding** - *LineEnding operation for Scintilla*

    **sciStyle** - *Style operation for Scintilla*

    **sciMargins** - *Margins operation for Scintilla*

    **sciOtherSetings** - *OtherSetings operation for Scintilla*

    **sciTabsIdents** - *absIdents operation for Scintilla*

    **sciMarkers** - *Markers operation for Scintilla*

    **sciAutocompletion** - *Autocompletion operation for Scintilla*

    **sciCalltips** - *Calltips operation for Scintilla*

    **sciKey** - *Key operation for Scintilla*

     
  • Andrzej Kmicic

    Andrzej Kmicic - 2010-02-09

    Attention Plugin Working only ANSI version on Notepad++. Sorry, My compilator not working in UTF.

    The new version is available for download. For both versions of the ANSI and UNICODE.

    Next version 1.01 plug-in  News:

    Addition - realisation of my old idea-Torrent. Displaying hints contextual found invisible pair of braces {}.
    New Categories to scripts for sorting and replaces with preg regular expressions
    Unique script for editing simultaneously in multiple selection.

    Short help for this script : Edit multiple.

    Notepad++/Scintilla editor supplied with multiple editing. But it is not easy, multiple selection. You must hold down the CTRL key and handy select sequentially certain words. This script allows you to select words throughout the document automatically.
    How to do the step by step:

    1. Choose from Multiple Script Repository Script Editing.

    2. Select a specific word in the document that you want to change the whole document at once.

    3. Press the Run Script

    4. Start typing a new word, you change all the words in the document at the same time.

    A great tool for developers to change the variable names throughout the code.

    (AK) Wojtek Jarzecki

     
  • etylocus

    etylocus - 2011-08-30

    Is there a chance that you release the saource code for your plugin? I had some issues installing it in windows (i.e., was looking in the wrong place for the sqlite dll) and some of the configurations don't work as expected (Or don't work at all)

    Thanks

     
  • mithrin

    mithrin - 2012-02-29

    Hi, I've downloaded meny times over the past months today being the latest but the program still does work. The current error that I had is      "Exception EReadError in module AutomationPHP.dll at 00027C93.
                          Error reading sqdb. Connected: Could notload SQLLite library(sqlite3.dll) "
    I was resolved to let you know this time in the hopes it could get it working.
    I use notepad++ in ANSI/UNI and Installed/Portable

     
  • dodfr

    dodfr - 2012-12-30

    Once installed under XP SP3 I noticed it as I could not run "net" command line nor start "regedit" or any other usual command line, they  that returned "command not found".

    After some research I found that the plugin (or the NSIS installer) erased the HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment -> PATH key and filled it with a single entrie into PATh key that pointed to NPP plugin directory, as I always have a full system backup I have been able to load the Registry Hive file from backup and get back original PATH value that contain many paths inside.

    This is a dangerous situation.

     

Log in to post a comment.