DefineGlobalConstant('kfour,GetBMPAsBits("four.BMP", true)); InstallScript := func(partFrame,removeframe) begin local notes; notes:=getroot().paperroll; CountView:=buildcontext(getlayout("CountView.lyt")); if IsReadOnly(notes.routeScripts) then (notes.routeScripts := clone(notes.routeScripts)); ArrayInsert(notes.routeScripts, {title: "Count Words", icon: kfour, routeScript: func(target, targetView) begin if CountView then CountView:Open(); CountView:CountWords(target) end}, 0); end; RemoveScript := func(removeFrame) begin local notes,index,iLenght; Notes := GetRoot().paperroll; iLength := length(Notes.routeScripts); for index := 0 to iLength - 1 do if StrExactCompare(Notes.routeScripts[index].title, "Count Words") = 0 then begin ArrayRemoveCount(Notes.routeScripts, index, 1); break; end; end;