NISUS Archives

May 2011

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:
Þorvarður Davíðsson <[log in to unmask]>
Reply To:
Date:
Tue, 31 May 2011 10:41:21 +0200
Content-Type:
text/plain
Parts/Attachments:
text/plain (63 lines)
On 30.05.2011, at 23:51, Bob Stern wrote:

>> Þorvarður Davíðsson wrote:
>> 
>> Type text $startNumber+1 & '.    '
>> 
>> then I get an error. Obviously & is not the sign to be used. What am I supposed to use then instead?
> 
> 
> I'm not a macro expert

Well, from now on you are because you solved the problem. :-)



> 
> Incidentally, your variable name $startNumber is confusing because you are incrementing it so that it actually becomes the current row number, not the start number.  You might want to rename it as $rowNumber.

An interesting suggestion, Bob. The underlying idea was to draw up a table of, let’s say, 4 columns and 10 or more rows. I might not always want to start in raw 1. Suppose I want to start in row 4, then I place the insertion point in column 1, row 4 and run the macro. 

The macro asks for the number I want to begin with, that is, I can place the insertion point in row 2 and start with the number 34, if I wish to do so. This is the start number, hence the name $startNumber.

As next the macro asks for how many rows are to be filled with numbers and text.

Explanations are placed under macro lines.

I would like to highlight the cells by dragging the mouse over them in the beginning and let NWP determine where the first cell is and how many cells were highlighted, but I don’t know how to do that yet. Perhaps somebody can do that.


BEGINNING OF MACRO

$startNumber = Prompt Input 'Enter a number to start with…'
# This is the cell where you start and refers to the number you want to begin with. 


$howManyRows = Prompt Input 'How many rows should be involved?' 
# Much better would be to highlight the part by dragging the mouse over the cells and let NWP determine the number. I don't know how to do that yet. 


$rowText = $startNumber & '.    '
# This is the number + point + 4 spaces as Doug Browne wanted to have it

$Cell = 0

Select Relative Table Cell $Cell, 0
Type text $rowText

$Cell = $Cell + 1
# We go downwards 1 cell

$startNumber = $startNumber +1
$rowText = $startNumber & '.    '

$count = 1
While $count < $howManyRows
	Select Relative Table Cell $Cell, 0
	Type text $rowText
$startNumber = $startNumber +1
$rowText = $startNumber & '.    '
$count = $count +1
End

### END OF MACRO

ATOM RSS1 RSS2