This script replace in selected text hex value to dec value. Selection maybe both (normal or column mode).
<?php$view=0;$docid=0;nppUserCommand("NPPM_ACTIVATEDOC",$view,$docid);// activate view=0 and first docid(document)=0// mouse drag and drop all document to first tab position$sel_count=scimultipleselection("SCI_GETSELECTIONS");// number lines in selectionsfor($i=0;$i<$sel_count;$i++){// for all selections$sel_start=scimultipleselection("SCI_GETSELECTIONNSTART",$i);//get start position$sel_end =scimultipleselection("SCI_GETSELECTIONNEND",$i);//get stop position$text=sciText("SCI_GETTEXTRANGE",$sel_start,$sel_end);// get text from start to stop$text=preg_replace_callback("@\b[0-9a-f]+\b@si","myhexdec",$text);// replace number with new numberscisearchreplace("SCI_SETTARGETSTART",$sel_start);// set replace start positionscisearchreplace("SCI_SETTARGETEND",$sel_end);// set replace stop positionscisearchreplace("SCI_REPLACETARGET",$text);// replace to new num}functionmyhexdec($item){returnhexdec($item[0]);//return dechex($item[0]); // if dec to hex is needed}?>
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
This script replace in selected text hex value to dec value. Selection maybe both (normal or column mode).