Re: NTLK Quote It

From: Gary Moody (gmoody@hotmail.com)
Date: Fri Apr 07 2000 - 11:18:07 EDT


Hi Robert,

The Newton uses Unicode as the character encoding scheme of choice. A
tabular layout of Unicode encoding can be viewed at
http://charts.unicode.org/PDF/U0000.pdf.

The local variable defined in the existing script:

local kQuote := "\u0022";

would have to be replaced with two local variables (for example, kOpenParen
and kCloseParen), since there is but one double quote character, but two
parenthetical characters. The Unicode code for an Open Parenthesis is 0028,
and for Close Parenthesis is 0029.

Therefore, the script would look something like this:

//
// ParenIt: derivative of Ron Risley's QuoteIt
//
// Places Parentheses around the selected text.
//
// QuoteIt Copyright © 1997 Ron Risley <rrisley@pobox.com>
// http://www.pobox.com/~rrisley/
// ParenIt Modification April, 2000 Gary Moody <gmoody@hotmail.com>

             local itemText := nil;
             local offsets := getHiliteOffsets();
           //local kQuote := "\u0022";This line can be removed (Xed)
           //Now, the two new local variables:
             local kOpenParen := "\u0028";
             local kCloseParen := "\u0029";

             if offsets then begin

           // get the text of the selected item
             local offsetArray := offsets[0];
             if offsetArray[0].text
                             then itemText :=

SubStr(offsetArray[0].text,offsetArray[1],offsetArray[2]-offsetArray[1]);
else if offsetArray[0].realData.text then itemText :=
SubStr(offsetArray[0].realData.text,offsetArray[1],offsetArray[2]-offsetArray[1]);

        // add the quotes
        // itemText := kQuote & itemText & kQuote; Line can be Xed
         itemText := kOpenParen & itemText & kCloseParen;

         // replace it
         local frontView := GetView('viewFrontKey);
         if frontView then postKeyString(frontView, itemText);

         end;

That *should* do it. Try it and let us know of it worked. :)

Regards,

Gary

----Original Message Follows----
From: Robert Benschop <robertbenschop@bigfoot.com>
To: NewtonTalk <newtontalk@planetnewton.com>
Subject: NTLK Quote It
Date: Fri, 07 Apr 2000 12:49:25 +0200

I have the following Gesture Launch script that puts quotes "" around
selected text and I would like to change it into a script that will put
brackets () around the text.
I mailed Ron Risley a while back and never got an answer and his website
seems to be gone, since I don't really have a clue about scripting, is there
maybe anybody else on the list that could help me out ?

Robert Benschop

The script:

//
// Quote It
//
// Places double quote marks around the selected text.
//
// Copyright © 1997 Ron Risley <rrisley@pobox.com>
// http://www.pobox.com/~rrisley/

             local itemText := nil;
             local offsets := getHiliteOffsets();
             local kQuote := "\u0022";

             if offsets then begin

             // get the text of the selected item
             local offsetArray := offsets[0];
             if offsetArray[0].text
                             then itemText :=

SubStr(offsetArray[0].text,offsetArray[1],offsetArray[2]-offsetArray[1]);
else if offsetArray[0].realData.text then itemText :=
SubStr(offsetArray[0].realData.text,offsetArray[1],offsetArray[2]-offsetArra
y[1]);

          // add the quotes
          itemText := kQuote & itemText & kQuote;

         // replace it
         local frontView := GetView('viewFrontKey);
         if frontView then postKeyString(frontView, itemText);

         end;

______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com

******************************************
This NewtonTalk Message brought to you by:

EVOTE.COM, the ESPN of Politics on the
Internet. Visit EVOTE.COM for all the latest
news on Campaign 2000!

Visit http://www.evote.com today!

******************************************

Need Subscribe/Unsubscribe Info?
visit http://www.planetnewton.com

******************************************



This archive was generated by hypermail 2b29 : Wed May 03 2000 - 09:41:19 EDT