Other Software > Developer's Corner
[BEST] Boxer Editor Scripting Thread
AbteriX:
Boxer Editor Scripting Thread to learn and exchange scripts for Boxer Text Editor
Boxer Text Editor at DonationCoder
Boxer Text Editor - 51% Off!
Boxer includes a powerful macro language ... similar in style to the C programming language
--- End quote ---
===> Boxers Example Macros
Learning C:
Wiki english
The C Book — Table of Contents and free PDF download
C lernen:
Wiki deutsch
Galileo Computing <openbook> C von A bis Z kostenloser download
- - -
Hi, i just trying myself learning how to scripting Boxer
My first attempt is to make an ROT13-macro ('cus i see no such function in Bx and i want to encrypt an Reg-key)
Infos about ROT13:
http://www.senses0.org.mv/popzees/rot/rotn.php
http://en.wikipedia.org/wiki/ROT13
Infos bezüglich ROT13:
http://holger.thoelking.name/skripten/rot13
http://de.wikipedia.org/wiki/ROT13
With PSPad i have simply an Tool "user conversion" with an text file like:
[Table]
97=110
98=111
With Bx (Boxer) i think i have to do an script?
If anyone is interested to take part in ... ('cus my lunch break is over :P )
I tried the following till now (partly pseudo code)
--- Code: C ---// macro description goes here// modify char to value-x higher char like ROT13// f.ex. A=65ascii > 65+13=78 > 78ascii=N >>> char 'A' convert to char 'N'macro newmacro(){Const X = 13;GetSelection(mySEL); For Each SingleChar in mySEL isalpha(SingleChar) newchar = ToAsciiValue(SingleChar) + X newchar = ToChar(Newchar) InsertCharacter(newchar) Next}
f0dder:
I wonder why you want to "encrypt a registry key" with ROT13? Just for fun and testing? It's pretty useless for anything else :)
Boxer Software:
Stefan,
Here's a Boxer macro that will get the selected text, add 13 to each character within the selection, and then replace the selection with the new text:
--- Code: C ---macro newmacro(){string str;int i, len;int constant = 13; // get the length of the selected textlen = GetSelectionSize(); // make sure selection size won't// exceed maximum string sizeif (len >= 2048) { Message("Error", "Too much text is selected."); return; }else if (len == 0) { Message("Error", "No text is selected."); return; } // get selection into 'str' GetSelection(str); // loop to process each character in 'str'for (i = 0; i < len; i++) if (str[i] != '\r' && str[i] != '\n') str[i] += constant; PutSelection(str);}
Best,
David Hamel
Boxer Software
allen:
That's not an actual rot13 conversion, though--it's a literal +13 and only one direction I think. . .
This does rot13
--- Code: C ---// Macro for rot13 text conversion macro rot13(){ // Define primary alphabet key string base = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; // Define the conversion key string conv = "NOPQRSTUVWXYZABCDEFGHIJKLMnopqrstuvwxyzabcdefghijklm"; // Declare some vars string output,sel; // selection text char thischar; // Check for selected text; if none, // print message to status bar and exit macro if ( getselectionsize <= 0 ) { statusmessage("Nothing was selected."); return; } else if (getselectionsize >= 2048) { statusmessage("Selected text exceeds allowed size."); return; } // Fetch selected text int thispos=0,thischarpos,selsize=getselection(sel); // Convert text while(thispos<selsize) { thischar = sel[thispos]; thischarpos=strchr(base,thischar); if ( thischarpos >= 0 ) { thischar = conv[thischarpos]; } output += thischar; thispos++; } Delete; PutString(output);}
Boxer Software:
Hi Allen,
Thanks for jumping in. I'm unfamiliar with ROT13, so I just worked from his pseudo-code.
Between our two macros, I think we've shown the concepts pretty well.
Best,
David Hamel
Boxer Software
Navigation
[0] Message Index
[#] Next page
Go to full version