Andrzej Kmicic - 2010-01-07

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 selections
    for($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 number
    
    scisearchreplace("SCI_SETTARGETSTART",$sel_start); // set replace start position
    scisearchreplace("SCI_SETTARGETEND",$sel_end); // set replace stop position
    scisearchreplace("SCI_REPLACETARGET",$text); // replace to new num
    }

    function myhexdec($item) {
    return hexdec($item[0]);
    //return dechex($item[0]); // if dec to hex is needed
    }   
    ?>