NISUS Archives

February 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:
Reply To:
Date:
Wed, 9 Feb 2011 23:09:14 +0900
Content-Type:
text/plain
Parts/Attachments:
text/plain (67 lines)
NWP version of my NW Classic macro discussed here years ago and I had been using.
<http://www2.odn.ne.jp/alt-quinon/files/NWPro/file/SaveAsNewVersion_20110209_nwm.zip>


I uploaded yet another macro which might be of some interest.
<http://www2.odn.ne.jp/alt-quinon/files/NWPro/select/SelectByCriteria_20110209_nwm.zip>
It will show you character attributes of the insertion point as a check list. Then, it will find and select all text portions having attributes of your choice in the text areas of your choice. For example, you run it with the insertion point having attributes such as Optima, 14 pt., Bold, Dark Blue text colour, etc. and you can let the macro select, for example, Dark Blue texts in Optima in footnotes only, regardless of the other attributes: boldness, font size, etc.


Kino

--

### Save as a New Version ###

# Save a file with a new number at the end of file name.
# If a file name does not have a number, a separator ($sep)
# and a number ($initlNum) will be added so that, for example,
# 'filename.rtf' will be saved as 'filename-1.rtf'.

# With a file name having a number, the separator will not be added.
# Only the number will be updated.
# In other words, 'filename39.rtf' will be saved as 'filename40.rtf'
# and 'filename_011.rtf' as 'filename_012.rtf' regardless of $sep.

# A new file name will be checked against existing files so that
# any of them will not be overwritten.
# For example, 'filename-023.rtf' will be saved as 'filename-025.rtf'
# if there is already 'filename-024.rtf'.

$sep = '-'  # between filename and number
$initNum = '001'  # '1', '01', '001', etc.

$doc = Document.active
if $doc == undefined
	exit
end

if $doc.filePath == undefined
	exit 'Unsaved new file, exiting...'
end
$fileName = $doc.filePath.lastFilePathComponentWithoutExtension

if ! $fileName.findAndReplace('(?<n>[0-9]+)$', '', 'E$')
	$n = $initNum  # $n is a string
	$fileName &= $sep
end

$len = $n.length

$baseFilePath = $doc.filePath.filePathByRemovingLastComponent.filePathByAppendingComponent $fileName
$newFilePath = $baseFilePath.textByAppending $n, '.', $doc.filePath.filePathExtension

while File.existsAtPath $newFilePath
	$n += 1  # $n treated as an integer
	$n &= ''  # make $n a string
	while $n.length < $len
		$n = '0' & $n
	end
	$newFilePath = $baseFilePath.textByAppending $n, '.', $doc.filePath.filePathExtension
end

# exit $newFilePath  # for debugging
Save As $newFilePath

### end of macro ###

ATOM RSS1 RSS2