Offset from right function?

2000-02-11 Thread David Cramer

Is there an offset-from-the-right function? I thought I had seen the 
use of a minus symbol with offset somehow that gave you the offset 
from the right, i.e., the end of a chunk of text.

Yes? No?

Regards,

David
-- 
David Cramer, Process Innovation Evangelist  87-1313 Border Street
PBSC Computer Training Centres (an IBM company)  Winnipeg MB R3H 0X4
Corporate Office Research  Development  Canada

This is the MetaCard mailing list.
Archives: http://www.mail-archive.com/metacard%40lists.best.com/
Info: http://www.xworlds.com/metacard/mailinglist.htm



Re: Offset from right function?

2000-02-11 Thread Kevin Miller

On 11/2/00 2:19 pm, David Cramer [EMAIL PROTECTED] wrote:

 Is there an offset-from-the-right function? I thought I had seen the
 use of a minus symbol with offset somehow that gave you the offset
 from the right, i.e., the end of a chunk of text.
 
 Yes? No?

Yes, you can use negative chunk expressions.  For example:

char -1 of "abc" is "c"
char 4 to -2 of "abcdefghij" is "defghi"

Regards,

Kevin

 Regards,
 
 David
 -- 
 David Cramer, Process Innovation Evangelist  87-1313 Border Street
 PBSC Computer Training Centres (an IBM company)  Winnipeg MB R3H 0X4
 Corporate Office Research  Development  Canada

Kevin Miller [EMAIL PROTECTED] http://www.xworlds.com/
Cross Worlds Computing, MetaCard Distributors, Custom Development.
Tel: +44 (0)131 672 2909.  Fax: +44 (0)1639 830 707.


This is the MetaCard mailing list.
Archives: http://www.mail-archive.com/metacard%40lists.best.com/
Info: http://www.xworlds.com/metacard/mailinglist.htm



Re: Offset from right function?

2000-02-11 Thread David Cramer

Argghh!! Never mind even more. I do feel dmb for missing another 
message which provides a much more efficient approach for ensuring 
one has set the global "directory" variable to a particular open 
stack's location, by using item and itemDelimiter syntax instead of 
"offset".

Here's what I ended up with, which I believe should be fairly 
bulletproof (I hope?)

global vgPath

on preOpenStack
  put the effective fileName of this stack into vgPath
  set the itemDel to "/"
  delete the last item of vgPath
  set the directory to vgPath
end preOpenStack

And to further explain, the point to all this is to allow someone to 
be able to open a stack using a link from a web page, and ensure that 
when the stack opens, all graphics, etc. will be correctly referenced 
by relative references in that stack's scripts.

Regards,

David


At 5:39 PM -0800 2/11/00, [EMAIL PROTECTED] wrote:
Aha! That's probably what I remembered seeing.

I guess what I was hoping I had seen was a way of using the "offset"
function with a from-right variation. Because it occurred to me that
I could then do something like...

put the short name of this stack into thisStack
put the long name of this stack into thePath
delete char (offsetBack(thisStack,thePath) to the length of thePath) 
of thePath

...and I would know that I was left with the correct path to a stack
even if the its long name were something like:

 /PowerBook/MetaCard/MyStuff/MyStuff.mc

Never mind 8-(

Regards,

David


At 11:15 AM -0800 2/11/00, [EMAIL PROTECTED] wrote:
On 11/2/00 2:19 pm, David Cramer [EMAIL PROTECTED] wrote:

   Is there an offset-from-the-right function? I thought I had seen the
   use of a minus symbol with offset somehow that gave you the offset
   from the right, i.e., the end of a chunk of text.

   Yes? No?

Yes, you can use negative chunk expressions.  For example:

char -1 of "abc" is "c"
char 4 to -2 of "abcdefghij" is "defghi"

Regards,

Kevin
-- 
David Cramer, Process Innovation Evangelist  87-1313 Border Street
PBSC Computer Training Centres (an IBM company)  Winnipeg MB R3H 0X4
Corporate Office Research  Development  Canada

This is the MetaCard mailing list.
Archives: http://www.mail-archive.com/metacard%40lists.best.com/
Info: http://www.xworlds.com/metacard/mailinglist.htm



Re: Offset from right function?

2000-02-11 Thread Claude Lemmel

 From: David Cramer [EMAIL PROTECTED]
 Subject: Re: Offset from right function?
 Date: Fri, 11 Feb 2000 19:36:08 -0600
 MIME-Version: 1.0
 Content-Type: text/plain; charset="us-ascii" ; format="flowed"
 
 Aha! That's probably what I remembered seeing.
 
 I guess what I was hoping I had seen was a way of using the "offset" 
 function with a from-right variation. Because it occurred to me that 
 I could then do something like...
 
 put the short name of this stack into thisStack
 put the long name of this stack into thePath
 delete char (offsetBack(thisStack,thePath) to the length of thePath) of thePath
 
 ...and I would know that I was left with the correct path to a stack 
 even if the its long name were something like:
 
 /PowerBook/MetaCard/MyStuff/MyStuff.mc
 
 Never mind 8-(
 
 Regards,
 
 David

To get the path of a stack, you can write

set the itemDelimiter to "/"
put item 1 to -2 of the long name of this stack into thePath


Regards, Claude


This is the MetaCard mailing list.
Archives: http://www.mail-archive.com/metacard%40lists.best.com/
Info: http://www.xworlds.com/metacard/mailinglist.htm