NPBuilder defines controls on a Plugin Form using ID numbers. These numbers must be in the positive range (greater than zero),


NPBuilder also predefines a number of Pseudo Control ID's to represent controls in the NPBuilder app that a Plugin can communicate with. These ID numbers are always negative (less than zero) and are predefined in the header file.


There is also a Pseudo Control ID for special commands which can be sent from a Plugin to NPBuilder.


You can send text to a Pseudo Control ID using the NP_SetText routine in the header file and retrieve text from it using the NP_GetText routine in the header file.


Here is a list of the current Pseudo Control ID's:



You can send text to the following Pseudo Control IDs:


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


%NPID_Script is an ID for the BScript control in the BScript editor. Sending text to it overwrites the current text in the control. Getting text from it retrieves the entire BScript.


%NPID_ScriptInsert is an ID for the BScript control, but instead tells NPBuilder to insert the text at the current cursor position in the control.


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


%NPID_ClipBoard is an ID for the Windows clipboard. You can pass it a text string. You can also retrieve a string from it.


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


You can send  text which is interpreted as commands to the following Pseudo Control IDs. Once you send a command to the Pseudo Control ID, then you should retrieve text back from the same ID to gets its reply.


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


%NPID_CodeBlock can be sent one of two special commands:


"<PRG>"


When you retrieve text from this ID after this command, it will return the Code Block program currently displayed in the Code Block Editor. Each line of the program will be separated by a Carriage return character (ascii 13). You can then parse the program one line at a time for Plugins which generate source code. Each line of a Code Block may have multiple data fields in it, each separated by the | character (ascii 124).  The first field for each line is a descriptor of what the line contains.  If a Line contains a BSCRIPT then the next field (after | ) is the BScript Name plus 4 extra bytes. You can parse out the BScript and remove the last 4 bytes to get the actual BScript name.


You can then pass that BScript name to this Pseudo ID using the next command:


"<BSC>"


If your program line returned:


"BSCRIPT|MySub1????"


You would parse out the part MySub1 (BScript name) and then create a new command string like this:


"<BCS>MySub1"


Send this command to this ID and then retrieve the reply (Get text) and you will have the actual BScript which can then be used by your Plugin.


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


%NPID_Cmd can be sent special commands for NPBuilder to execute. They are as follows:


"SEND,asciicommand"


This sends a Commander ascii command to the Commander module to be executed. You can then retrieve the reply.


"GETDEVICES"


This requests a list of the available devices separated by the | character (ascii 124) which you can retrieve.


"GETDEV"


This requests the currently selected device in the Combobox list in the BScript Editor or Code Block Editor.


"OPEN,devicename"

    or

"OPENDEV,devicename"


This opens the device (device name) you pass.


"CLOSE"

   or

"CLOSEDEV"


This closes the currently opened device.


"EXIT"

   or

"ABORT"


This closes and exits your Plugin Dialog. Your Plugin form will get the %NP_Close event when this happens.


"OPENFILEDLG,filefilter"


This displays the Windows Open File Dialog and you can retrieve the selected file path after it closes.

The filefilter parameter is defined like this:


"OPENFILEDLG,Text (*.txt))|*.txt|All Files (*.*)|*.*|"


You build this filter first with what will be displayed in the file selection type list (ie.  Text (*.txt) ). You then add the DOS filter for this file type in between | characters (ie.  |*.txt| )

You can define multiple file types in this filter. 


"READFILE"


This will request reading the entire file which was previously selected using the OPENFILEDLG command into memory. You can retrieve the data afterwards.


"COPYFILES,filenamelist"


This will display a Copy Files dialog and will allow the user to copy the files you define to any other folder on their computer. The files must be in the same folder as NPBuilder or a subfolder of it. If in a subfolder define the filename with the subfolder name in front of it (ie.   \AppPlugins\mydll.dll )


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



Note:


%NPID_VScroll and %NPID_HScroll are for future implemention and not currently supported.