automationasfen.blogg.se

Wiki text cleaner in r
Wiki text cleaner in r











Local ind = ' ' while ( string.len(ind) result: '.count. Local str = string.gsub( ' '.editor:GetLine(l), '%s+', ' ') While s do local l = editor:LineFromPosition(s) Local s,e = editor:findtext(findText,flag,0) If not f then print( ">Calculator: cannot evaluate selection") return endįind selection local findText = editor:GetSelText() If not expr or expr = "" then return end local f, msg = loadstring( "return ".expr) Highlight a valid Lua expression and run the script to perform the calculation or evaluation. If Linea1 = nil then Linea1 = "0000" endĮditor:AddText( "\n\n-\n")Įditor:AddText( os.date( "%d.%b.%Y_%Hh:%Mm"))Įditor:AddText( "\n-\n")Ī simple Lua expression evaluator for calculating stuff. LOG (similar notepad)Īdd the following lines into User Options File (SciTEUser.properties)Īdd the following lines into Lua Startup Script: function InsertDateTimeLog() INSERT automatic current date time in mode. ReplaceOrInsert( os.date( "%H:%M:%S %Z"))

wiki text cleaner in r

insert the current time in HH:MM:SS Timezone format function insertTime() replace current selection with text - if there is none, insert at cursor position function replaceOrInsert(text)Įnd end - insert the current date in YYYY-mm-dd format function insertDate()Īnd another function for inserting the current time: This version replaces the current selection, if there is one: I missed this feature in SciTE.Add the following lines into User Options File (SciTEUser.properties)Īdd the following lines into Lua Startup Script: function InsertDate() Insert the current date at the cursor position This script flips the positions of two adjacent characters.Įditor:ReplaceSel( string.sub(sel, 2, 2). Local fs,fe = editor:findtext( "\-*+", SCFIND_REGEXP,StartPos) Local CurLine = editor:LineFromPosition(StartPos) This script increment and decrement the next number found in text. Script for increment and decrement number save position local StartPos = editor.CurrentPos

wiki text cleaner in r

TogglePairTable = "1" - replace left column string in table with righ column string for findString,replaceString in pairs(TogglePairTable) do if string.find(str, findString) then return string.gsub(str, findString, replaceString) end end - replace right column string in table with left column string for replaceString,findString in pairs(TogglePairTable) do if string.find(str, findString) then return string.gsub(str, findString, replaceString) end end return strĮnd - For use in SciTE - this selects the the word under the caret - side effect: discards existing selection function scite_ToggleBoolean() create a 2 colum table with toggle expressions local TogglePairTable = general lua function to alternatingly replace a bool-ish word in a string function ToggleBoolean(str) Both functions are needed, link to scite_ToggleBoolean() in your SciTE Options file. Here is a more complicated version that is more robust. "if (false)" will toggle, while "if ( false )" won't. The simple script has a flaw, when a toggle-word is followed by one or more whitespaces. If Word = "FALSE" then editor:ReplaceSel( "TRUE") end if Word = "TRUE" then editor:ReplaceSel( "FALSE") end if Word = "false" then editor:ReplaceSel( "true") end if Word = "true" then editor:ReplaceSel( "false") end if Word = "False" then editor:ReplaceSel( "True") end if Word = "True" then editor:ReplaceSel( "False") end if Word = "YES" then editor:ReplaceSel( "NO") end if Word = "NO" then editor:ReplaceSel( "YES") end if Word = "yes" then editor:ReplaceSel( "no") end if Word = "no" then editor:ReplaceSel( "yes") end if Word = "0" then editor:ReplaceSel( "1") end if Word = "1" then editor:ReplaceSel( "0") endĬomplicated script to toggle binary value This simple script toggle the word under the cursor.

wiki text cleaner in r

This page contains some small miscellaneous SciteScripts. Lua-users wiki: Scite Misc Scripts Scite Misc Scripts













Wiki text cleaner in r