Na forum dotyczącum "C# NET" zamiesciłem wiadomość o językach skryptowych w Notepadzie++. Również PHP jako języka skryptowego. Razem z notepadem który mozna uzywać portable, stanowi on kompletne środowisko PHP bez instalacji PHP i Apache. Można używać wowczas mobilnie z pendrajwa.
http://4programmers.net/Forum/C_i_.NET/242329-c_i_php_jako_jezyki_skryptowe_w_notepad++
jeżeli kogoś zainteresuje temat to zamieszczam poniżej mocno uproszczone, wprowadzenie do API poleceń PHP dotyczących bezpośredniego sterowania dokumentami Notepada z użyciem skryptów PHP.
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
(
=> Andrzej
=> Kmicic
=> 185
=> [email protected]
)
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