Article View: comp.sys.mac.apps
Article #398UserLand Frontier programming help..
From: Alan Hoshor
Date: Thu, 05 Nov 1992 00:32
Date: Thu, 05 Nov 1992 00:32
118 lines
4459 bytes
4459 bytes
I am a novice at Frontier programming. I've written the following script.
I'm trying to add a quoted text function to MSMail. My idea
was to copy a selection of text to the Clipboard, process it in Frontier,
then place it back into the Clipboard. So that I could paste it back into
the Mail document.
Sounded simple to me anyway. My processing code works. The first script
is the example. What I can't seem to do effectively is grab the text from
the Clipboard. I could use some help.
Please reply directly back to me by email.
Thanks.
Alan
Alan Hoshor (206) 487-5906, hoshor@mdd.comm.mot.com, uunet!mdisea!hoshor
MOTOROLA INC., 19807 Northcreek Parkway North, Bothell, WA 98011-8214
==================================================
The routine below works on an open Frontier window:
==================================================
on Quotation () {
scratchpad.Quotation = "";
wp.getSelect (@start, @end);
lineLength = 66;
if end < lineLength {
lineLength = end};
wp.setSelect (start, lineLength);
f = wp.getSelText ();
n = lineLength;
t = string.mid(f,n, 1);
while (start < end) {
c = string.patternMatch (cr, f);
if c > 0 {
wp.setSelect (start, start + c);
f = wp.getSelText ();
scratchpad.Quotation = (scratchpad.Quotation + "> " + f );
start = start + c;
n = start + lineLength;
if end - start < lineLength {
lineLength = end - start + 1};
n = start + lineLength;
wp.setSelect (start, n);
f = wp.getSelText ()}
else {
while ( n > start ) and ( t != " ") and (t != "-") and (t != ".")
and ( end - start > lineLength ) {
n = n-1;
t = string.mid(f, n - start , 1)};
wp.setSelect (start, n);
f = wp.getSelText ();
scratchpad.Quotation = (scratchpad.Quotation + "> " + f + cr);
start = n;
if end - start < lineLength {
lineLength = end - start + 1};
n = start + lineLength;
wp.setSelect (start, n);
f = wp.getSelText ();
t = string.mid(f, n - start , 1)}};
clipboard.putValue (string (scratchpad.Quotation))}
============================================================================
The routine below does not work. It was trying to grab the text that had
already been placed within the clipboard. And then replace it with text
marked as quoted.
================================
scratchpad.Quotation = "";
s = evaluate (clipboard.getValue (StringType));
start = 1;
end = sizeOf (s);
lineLength = 66;
if end < lineLength {
lineLength = end};
f = string.mid (s, start, lineLength);
n = lineLength;
t = string.mid(f,n, 1);
while (start < end) {
c = string.patternMatch (cr, f);
if c > 0 {
f = string.mid (s, start, start + c);
scratchpad.Quotation = (scratchpad.Quotation + "> " + f );
start = start + c;
n = start + lineLength;
if end - start < lineLength {
lineLength = end - start + 1};
n = start + lineLength;
f = string.mid (s, start, n)}
else {
while ( n > start ) and ( t != " ") and (t != "-") and (t != ".") and
( end - start > lineLength ) {
n = n-1;
t = string.mid(f, n - start , 1)};
f = string.mid (s, start, n);
scratchpad.Quotation = (scratchpad.Quotation + "> " + f + cr);
start = n;
if end - start < lineLength {
lineLength = end - start + 1};
n = start + lineLength;
f = string.mid (s, start, n);
t = string.mid(f, n - start , 1)}};
clipboard.putValue (string (scratchpad.Quotation))
--
Alan Hoshor (206) 487-5906, hoshor@mdd.comm.mot.com, uunet!mdisea!hoshor
MOTOROLA INC., 19807 Northcreek Parkway North, Bothell, WA 98011-8214
Technical Details
Message-ID:
<hoshor-041192162157@bluesuede.mdd.comm.mot.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!charon.amdahl.com!pacbell.com!decwrl!elroy.jpl.nasa.gov!usc!wupost!uwm.edu!ogicse!news.u.washington.edu!uw-beaver!uw-coco!mdisea!bluesuede.mdd.comm.mot.com!userShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!charon.amdahl.com!pacbell.com!decwrl!elroy.jpl.nasa.gov!usc!wupost!uwm.edu!ogicse!news.u.washington.edu!uw-beaver!uw-coco!mdisea!bluesuede.mdd.comm.mot.com!user From: hoshor@mdd.comm.mot.com (Alan Hoshor) Newsgroups: comp.sys.mac.apps Subject: UserLand Frontier programming help.. Message-ID: <hoshor-041192162157@bluesuede.mdd.comm.mot.com> Date: 5 Nov 92 00:32:21 GMT Article-I.D.: bluesued.hoshor-041192162157 Sender: news@mdd.comm.mot.com Followup-To: comp.sys.mac.apps Organization: MOTOROLA Inc. Lines: 118