Re: Change identical style in several files
Posted: 2022-07-16 00:12:11
Thanks again to all who have been helping. Combining elements of what I learned I found that a single import can be done comfortably like this:
For importing same styles on many files it's probably easiest to manually choose the styles file and use only
Code: Select all
$doc = Document.active
# choosing the style set from Style Library:
$folderPath = '/Applications/nisus writer settings/Style Library/'
File.requireAccessAtPath($folderPath) # exclude sandboxing
$files = File.namesInFolderAtPath $folderPath
$fileName = Prompt Options 'Select a file...', "from files under $folderPath", 'Open', $files
# applying the style set to the active document:
$styleDoc = Document.withDisplayName $fileName
$doc.addStyles $styleDoc.allStyles, "replace"
Code: Select all
$doc = Document.active
$styleDoc = Document.withDisplayName $fileName
$doc.addStyles $styleDoc.allStyles, "replace"
Code: Select all