Welcome Guest.   Make a donation to an author on the site October 31, 2014, 05:16:57 PM  *

Please login or register.
Or did you miss your validation email?


Login with username and password (forgot your password?)
Why not become a lifetime supporting member of the site with a one-time donation of any amount? Your donation entitles you to a ton of additional benefits, including access to exclusive discounts and downloads, the ability to enter monthly free software drawings, and a single non-expiring license key for all of our programs.


You must sign up here before you can post and access some areas of the site. Registration is totally free and confidential.
 
The N.A.N.Y. Challenge 2012! Download dozens of custom programs!
   
   Forum Home   Thread Marks Chat! Downloads Search Login Register  
Pages: [1]   Go Down
  Reply  |  New Topic  |  Print  
Author Topic: [BEST] Boxer Editor Scripting Thread  (Read 4783 times)
AbteriX
Charter Honorary Member
***
Posts: 1,050


Member #520

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« on: March 25, 2008, 07:16:42 AM »

Boxer Editor Scripting Thread to learn and exchange scripts for Boxer Text Editor


Boxer Text Editor at DonationCoder
Boxer Text Editor - 51% Off!


Quote
Boxer includes a powerful macro language ... similar in style to the C programming language

===> 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  tongue )

I tried the following till now (partly pseudo code)


Formatted for C with the GeSHI Syntax Highlighter [copy or print]
  1. // macro description goes here
  2. // modify char to value-x higher char like ROT13
  3. // f.ex.  A=65ascii    >    65+13=78    >     78ascii=N    >>>  char 'A' convert to char 'N'
  4. macro newmacro()
  5. {
  6. Const X = 13;
  7. GetSelection(mySEL);
  8.  
  9. For Each SingleChar in mySEL
  10.    isalpha(SingleChar)
  11.       newchar = ToAsciiValue(SingleChar) + X
  12.   newchar = ToChar(Newchar)
  13.  
  14.   InsertCharacter(newchar)
  15.  
  16. Next
  17. }

« Last Edit: March 25, 2008, 06:10:04 PM by AbteriX » Logged

Greetings, Stefan.
f0dder
Charter Honorary Member
***
Posts: 8,774



[Well, THAT escalated quickly!]

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #1 on: March 25, 2008, 08:49:13 AM »

I wonder why you want to "encrypt a registry key" with ROT13? Just for fun and testing? It's pretty useless for anything else smiley
Logged

- carpe noctem
Boxer Software
Supporting Member
**
Posts: 31


Author of the Boxer Text Editor

View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #2 on: March 25, 2008, 09:23:55 AM »

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:

Formatted for C with the GeSHI Syntax Highlighter [copy or print]
  1. macro newmacro()
  2. {
  3. string str;
  4. int i, len;
  5. int constant = 13;
  6.  
  7. // get the length of the selected text
  8. len = GetSelectionSize();
  9.  
  10. // make sure selection size won't
  11. // exceed maximum string size
  12. if (len >= 2048)
  13. {
  14. Message("Error", "Too much text is selected.");
  15. return;
  16. }
  17. else if (len == 0)
  18. {
  19. Message("Error", "No text is selected.");
  20. return;
  21. }
  22.  
  23. // get selection into 'str'
  24. GetSelection(str);
  25.  
  26. // loop to process each character in 'str'
  27. for (i = 0; i < len; i++)
  28. if (str[i] != '\r' && str[i] != '\n')
  29. str[i] += constant;
  30.  
  31. PutSelection(str);
  32. }

Best,

David Hamel
Boxer Software
Logged
allen
Charter Member
***
Posts: 1,173



Powered by Beard

see users location on a map View Profile Read user's biography. Give some DonationCredits to this forum member
« Reply #3 on: March 25, 2008, 09:36:30 AM »

That's not an actual rot13 conversion, though--it's a literal +13 and only one direction I think. . .

This does rot13
Formatted for C with the GeSHI Syntax Highlighter [copy or print]
  1. // Macro for rot13 text conversion
  2.  
  3. macro rot13()
  4. {
  5.  // Define primary alphabet key
  6.  string base = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
  7.  // Define the conversion key
  8.  string conv = "NOPQRSTUVWXYZABCDEFGHIJKLMnopqrstuvwxyzabcdefghijklm";
  9.  // Declare some vars
  10.  string output,sel; // selection text
  11.  char thischar;
  12.  // Check for selected text; if none,
  13.  // print message to status bar and exit macro
  14.  if ( getselectionsize <= 0 ) {
  15.    statusmessage("Nothing was selected.");
  16.    return;
  17.  } else if (getselectionsize >= 2048) {
  18.    statusmessage("Selected text exceeds allowed size.");
  19.    return;
  20.  }
  21.  // Fetch selected text
  22.  int thispos=0,thischarpos,selsize=getselection(sel);
  23.  
  24.  // Convert text
  25.  while(thispos<selsize) {
  26.    thischar = sel[thispos];
  27.    thischarpos=strchr(base,thischar);
  28.    if ( thischarpos >= 0 ) {
  29.      thischar = conv[thischarpos];
  30.    }
  31.    output += thischar;
  32.    thispos++;
  33.  }
  34.  Delete;
  35.  PutString(output);
  36. }
Logged
Boxer Software
Supporting Member
**
Posts: 31


Author of the Boxer Text Editor

View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #4 on: March 25, 2008, 09:44:54 AM »

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
Logged
allen
Charter Member
***
Posts: 1,173



Powered by Beard

see users location on a map View Profile Read user's biography. Give some DonationCredits to this forum member
« Reply #5 on: March 25, 2008, 09:53:42 AM »

ROT13 is just a silly way of rotating through the alphabet as a 52 character index (caps and lowercase unique) to mask text. It's naturally bi-directional, not at all secure, but I guess can mask things from search engines and obfuscates the information from those unfamiliar with ROT13 . . . (Yvxr lbh svir zvahgrf ntb!) smiley
Logged
AbteriX
Charter Honorary Member
***
Posts: 1,050


Member #520

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #6 on: March 25, 2008, 10:22:42 AM »

Thanks fellows!  You are quick and helpful, very kind of you.  Kiss
So i have smtg to learn this evening. And i hope this thread will encourage people to try this scripting too.

.. .. .. .. .. ..

WRT ROT13 and Registry?
Some key in Reg are "encrypted" by M$ thereself, like
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\UserAssist\....

I can remember there is an other key too,   
and i had known an trick to decrypt this key automatically by adding an new key (and/or value)
But ths trick is not presend right now  undecided  Cry

EDIT: here a few links about this topic
http://www.codeproject.co...y/registryencryption.aspx
http://www.autohotkey.com/forum/topic9154.html
http://blog.didierstevens...ws-you%E2%80%99re-joking/

EDIT:
And here is the trick

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\ Explorer\UserAssist\
New key "Settings"
New DWORD "NoEncrypt"   set to "1 "

Found by
http://www.winhelpline.in...erassist-schluessels.html


And sorry for false "encrypt" / "decrypt" using/mix-up.

---

That's why i want use ROT13... to de-crypt an key/value like them above.
And for to see how this works in Boxer  cheesy

.. .. .. .. .. .. .. .. ..

ROT13 is also handy to exchange text (email addy f.ex.) in forum not all should read easily (or crawl) .
F.ex. to ask an trick-question and add the answer "rot-ed"  tongue

.. .. .. .. .. .. .. .. ..

Please people, come on and fill this tread with live..... what's to script next?
« Last Edit: March 25, 2008, 11:02:59 AM by AbteriX » Logged

Greetings, Stefan.
allen
Charter Member
***
Posts: 1,173



Powered by Beard

see users location on a map View Profile Read user's biography. Give some DonationCredits to this forum member
« Reply #7 on: March 25, 2008, 10:34:32 AM »

Here's one I use fairly frequently. It takes the body of a text file and activates it as a mailto link, sending it to your default e-mail client.  The arbitrary buffer size limits the size of document this works with, but it's handy if I'm working on something and want to jot down a quick message without switching to my mail client.
- If nothing is selected, line 1 is subject and the rest is the body
- If there is a selection, it is treated as the body and you are prompted for the subject
Formatted for C with the GeSHI Syntax Highlighter [copy or print]
  1. // Send the selected text as an e-mail message
  2.  
  3. macro SendAsEmail()
  4. {
  5.  // Set prompt to 0 to disable subject prompt
  6.  int prompt = 1;
  7.  int inc;
  8.  string line;
  9.  string sel;
  10.  string subj;
  11.  string strout;
  12.  // Check for selection, if nothing selected
  13.  // Line 1 = subject, rest = body
  14.  // This is to ensure cursor placement doesn't
  15.  // truncate the url encoding
  16.  if ( GetSelectionSize <= 0 ) {
  17.    GetLineText(1,subj);
  18.    ChangeString(subj," ","%20");
  19.    for ( inc = 2; inc <= LineCount(); inc++ ) {
  20.      GetLineText(inc,line);
  21.      ChangeString(line," ","%20");
  22.      line += "%0a";
  23.      sel += line;
  24.    }
  25.  } else {
  26.    // Prompt for SUBJECT only if "prompt" is not 0
  27.    // Otherwise, blank subject is sent
  28.    if ( strlen(subj) < 1 && prompt > 0 ) {
  29.      GetString("Subject of Message",subj);
  30.      ChangeString(subj," ","%20");
  31.    }
  32.    // Fetch body, add spaces and line endings
  33.    GetSelection(sel);
  34.    ChangeString(sel,"\n","%0a");
  35.    ChangeString(sel," ","%20");
  36.  }
  37.  // Assemble mailto string
  38.  strout = "?subject=";
  39.  strout += subj;
  40.  strout += "&body=";
  41.  strout += sel;
  42.  // Send to mail client
  43.  OpenEmail(strout);
  44. }
Logged
AbteriX
Charter Honorary Member
***
Posts: 1,050


Member #520

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #8 on: March 29, 2008, 07:23:08 PM »

I have thought i have seen this feature in Boxer, but didn't find it. So i have taken this to try my first Boxer script.

Find user string and select lines till the string occurs first.
f.ex.
- scroll through an long text and wrote an char didn't exist in the whole text, like an '#'
- go back above to your start line (hint: bookmark) and search(via script) for '#' .... the script will select all lines between.

Find-and-select-to-find
Formatted for C with the GeSHI Syntax Highlighter [copy or print]
  1. // Find an string. Select all lines till the line where this string occurs first.
  2.  
  3. macro newmacro()
  4. {
  5. int LineStart, LineEnd, LineCurr;
  6. string FindAndSelectmyFind, myFind;
  7.  
  8. LineStart = LineNumber; // current line number at macro start
  9.  
  10. //REM ReadValue(FindAndSelectmyFind, myFind); // read last stored search value
  11. GetString("Find what: ", myFind); // string to find and select to
  12. //REM WriteValue(FindAndSelectmyFind, myFind); // save value for re-use
  13.  
  14. if (myFind != "")
  15. {
  16. // go across all lines from current start line to EOF, line by line
  17. for (LineCurr = LineStart; LineCurr <= LineCount(); LineCurr++)
  18.   {
  19.   if (LineContainsREi(LineCurr, myFind)) // if search string is found in line
  20.       {
  21. LineEnd = LineCurr; // set var LineEnd to number of current line
  22.         break; // stop the for loop
  23.   }
  24. }
  25.  
  26. GoToLine(LineStart); // go back to start line where we came from
  27. // go through all lines from our start line to the line where the string was found, line by line    
  28. for (LineCurr = LineStart; LineCurr <= LineEnd; LineCurr++)
  29.   {
  30. SelectDown; // select each line between
  31.   }
  32. }
  33. }


Unfortunately it seams as " GetString("Find what: ", myFind); "  didn't support to show user an suggestion?
I exspected something like: " int GetString(string prompt, string result, string suggestion) "
I will search for an alternative.



Perhaps this script is an improvement-idea for David.  Wink Smtg similar like "Go to..." and []extend selection ?

Next i will try to script  Find-and-select-to-bookmark ;-)

.
Logged

Greetings, Stefan.
Boxer Software
Supporting Member
**
Posts: 31


Author of the Boxer Text Editor

View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #9 on: March 30, 2008, 09:12:30 AM »

Hi Stefan,

Quote
I have thought i have seen this feature in Boxer, but didn't find it. So i have taken this to try my first Boxer script.

If you have a selection started, and then issue the Find command, there's an "Extend Selection" option on the Find dialog that should do what you like.

(Note: if the existing selection is of any size, the Scope will default to searching within the selection, so be sure to change the Scope to suit your need in order to enable the Extend Selection option.)


Best,

David Hamel
Boxer Software
Logged
Pages: [1]   Go Up
  Reply  |  New Topic  |  Print  
 
Jump to:  
   Forum Home   Thread Marks Chat! Downloads Search Login Register  

DonationCoder.com | About Us
DonationCoder.com Forum | Powered by SMF
[ Page time: 0.078s | Server load: 0.01 ]