NISUS Archives

December 2010

NISUS@LISTSERV.DARTMOUTH.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Nobumi Iyanaga <[log in to unmask]>
Reply To:
Date:
Mon, 27 Dec 2010 17:47:01 +0900
Content-Type:
text/plain
Parts/Attachments:
text/plain (65 lines)
Hello Kino,

Thank you very much for your reply.

On Dec 27, 2010, at 2:28 AM, Kino wrote:

>
>> foreach $num in $selectedTexts
>> 	$theNum = Cast to Int $num
>> 	if $theNum == 0
>> 		if $num != '0'
>> 			exit "$num is not a digit"
>> 		end
>> 	end
>> 	$theExpression &= $num & $theOperator
>> end
>
> Yeah, NWP macro does not have a proper command for that kind of  
> verification. That is a bit annoying, but, in a certain sense, it  
> is those shortcomings which make us more familiar with the macro  
> language. Doing trials and errors to write a viable alternative,  
> surely we learn something.

Yes, I completely agree with you. On the other hand, I think that one  
thing which still lacks in Nisus macro language is the possibility of  
using sub-routine. When this will be possible, I think/hope that  
writing macros will be much simpler (but before that, we -- I --  
should master the current macro language, which is not easy at all...!).

>> $theLength = $theExpression.length
>> $theLength = $theLength - 1
>> $theRange = Range.new (0, $theLength)
>
> You can condense these three lines into:
>
> $theRange = Range.new (0, $theExpression.length - 1)

Ah, I would have not been able to find this by myself. Very  
intelligent and helpful!

>
>> $theExpression = $theExpression.substringInRange ($theRange)
>
> For such a purpose, I think you can use join command  
> advantageously, like in the macro below.

This is also very useful. It seems there are many interesting and  
useful commands in the macro language, but it is difficult to  
understand and use them when one is not familiar with it. Exercise  
and experience...!

> ### another version ####
...

This version is much simpler and cleverer. Thank you very much. I  
will keep it in my macro file.

I will reply to your other posting, and please wait some time...

Best regard,

Nobumi Iyanaga
Tokyo,
Japan

ATOM RSS1 RSS2