A few years ago, I posted a macro for a similar purpose at
http://www.nisus.com/forum/viewtopic.php?p=16135#p16135 that I modified now so that, hopefully, it meets your needs.
Code: Select all
Require Pro Version 1.3
$indexToDayName = $indexToMonthName = Hash.new
$i = $j = 1
while $i < 8
$indexToDayName{$i%7} = Date.nameOfWeekday $i
$i += 1
end
while $j < 13
$indexToMonthName{$j} = Date.nameOfMonth $j
$j += 1
end
$now = Date.now
$today = $now.year & '-'
$today &= $now.month & '-'
$today &= $now.day
$date1 = Prompt Input 'From (year-month-day):', '', '', $today
$date2 = Prompt Input 'To (year-month-day):', '', '', $date1
$date1 = $date1.split '-'
$date2 = $date2.split '-'
$output = ''
Set Exported Perl Variables 'date1', 'date2', 'indexToDayName', 'indexToMonthName', 'output'
begin Perl
use Time::Local;
$i = timelocal (0, 0, 12, $date1[2], $date1[1]-1, $date1[0]);
$j = timelocal (0, 0, 12, $date2[2], $date2[1]-1, $date2[0]);
while ($i <= $j) {
@lt = localtime($i);
$output .= sprintf ("%s %01d %s\f", $indexToDayName{$lt[6]}, $lt[3], $indexToMonthName{$lt[4]+1});
$i += 86400;
}
end
$doc = Document.active
if $doc == undefined # if no document is open...
Document.new
end
Insert Text $output
jb wrote:For my purposes it would be best to insert page break after month, but I *do* know how to do that

I'm not very sure but am I right in supposing that page break should be inserted at the end of each date generated? In the macro above, page break is represended by
\f in
Code: Select all
$output .= sprintf ("%s %01d %s\f", $indexToDayName{$lt[6]}, $lt[3], $indexToMonthName{$lt[4]+1});
(if you prefer return, replace
\f with
\n.) But if you want page break to be inserted only after the last day of months, something a bit more complicated would be necessary.