My wife is using OS 9 and the old Nisus -- which is still a remarkable program. I am trying to ween her from OS 9, which is horrible, and to get her to use NWP on OS 10. She doesn't like the fact that NWP opens files based on how they were saved -- she wants all of them to open in draft mode with 125% zoom. I know this can be done with a macro, but she's used to just opening a file and editing it and doesn't want to run a macro every time. My question: is there any way to make a macro run automatically when a file is opened or any way to make NWP open always open with the desired view and zoom. Thanks!
(As I remember it, the old Nisus did have a macro that would run automatically every time the program was invoked).
Want to open always in same view, zoom
- martin
- Official Nisus Person
- Posts: 5230
- Joined: 2002-07-11 17:14:10
- Location: San Diego, CA
- Contact:
Re: Want to open always in same view, zoom
You remember correctly- Classic Nisus Writer did have provisions for running a macro every time a file was opened. That's something NWP doesn't do, though I'll file it as a feature request. I can see how it would be quite handy for cases like this.
As for her desires, I don't think there's anything she can do at the moment, sorry. Manually running a macro is the best she can do (I'd configure a custom keyboard shortcut for the macro).
As for her desires, I don't think there's anything she can do at the moment, sorry. Manually running a macro is the best she can do (I'd configure a custom keyboard shortcut for the macro).
Re: Want to open always in same view, zoom
Thanks, that's very helpful. I have one more question: Is it possible to adjust the window size using a macro?
- martin
- Official Nisus Person
- Posts: 5230
- Joined: 2002-07-11 17:14:10
- Location: San Diego, CA
- Contact:
Re: Want to open always in same view, zoom
Not using the NWP macro language, but you can use an AppleScript macro. Assuming you want to resize the frontmost window:
Save that code as a plain text file, with an extension of ".scpt" (or create/save the macro using Apple's Script Editor). You can then add that macro to the NWP macros menu just as with any other macro. You can also run that macro from within another macro, eg: your full window reconfiguration macro might look like:
Code: Select all
tell application "Nisus Writer Pro"
activate
set the bounds of the first window to {200, 100, 500, 500}
end tell
Code: Select all
Menu "Draft View"
Set Zoom 125
Menu "Resize Window Macro"
Re: Want to open always in same view, zoom
Thanks, Martin -- that's exactly what I need. I already have an applescript file that converts classic Nisus files to the new format, preserving the dates, etc. I can add the code you suggest -- I'm giving it below in case anyone is interested. George
property script_fname : "font_conversion.pl" -- your "external script" name
on open (droppedItemList)
set my_path to POSIX path of (path to me)
repeat with aFile in droppedItemList
set shell_scpt to "" as Unicode text
set shell_scpt to shell_scpt & "perl " & quoted form of (my_path & "Contents/Resources/" & script_fname)
set fpath to aFile as Unicode text
set CaptureFilepath to quoted form of POSIX path of (aFile as text)
set rtffpath to fpath & ".rtf"
set BackupFilepath to quoted form of POSIX path of (rtffpath as text)
set POSIX_rtffpath to POSIX path of rtffpath
set shell_scpt to shell_scpt & space & quoted form of POSIX_rtffpath
set theInfo to info for aFile
set theCreator to file creator of theInfo
-- if theCreator is not "NISI" or fpath ends with ":" then
-- display dialog "Please drop a Classic Nisus Writer file on this droplet..."
-- return
-- end if
if fpath ends with ":" then
display dialog "Please drop a Classic Nisus Writer file on this droplet..."
return
end if
tell application "Finder"
set ItemColor to label index of aFile
end tell
-- open application "Nisus Writer Pro"
tell application "Nisus Writer Pro"
activate
try
open aFile
on error errMsg
display dialog "Couldn't open the file " & fpath & ": " & errMsg
return
end try
try
-- save document 1 as "rtf" in rtffpath
save document 1 in rtffpath
close window 1
on error errMsg
display dialog "Couldn't save the file as " & rtffpath & ": " & errMsg
return
end try
end tell
-- try
-- do shell script shell_scpt
-- on error errMsg
-- display dialog "Couldn't convert the font with the shell --script " & shell_scpt & ": " & errMsg
-- return
-- end try
-- close Nisus
-- close application "Nisus Writer Pro"
-- set complete to do shell script "cp -pRf " & CaptureFilepath & " " & BackupFilepath
-- display dialog "File: " with title ("Test")
-- & POSIX path of (CaptureFilepath as text)
--display dialog "mdls " & quoted form of POSIX path of (aFile as text) with title ("Test")
do shell script "mdls " & quoted form of POSIX path of (aFile as text) & " | grep 'kMDItemContentCreationDate' | awk '/ = / {print $3,$4}'"
--tell the result to set ModDate to text 3 thru 4 & text 6 thru 7 & text 9 thru 10 & "_" & text 12 thru 13 & "-" & text 15 thru 16 & "-" & text 18 thru 19
tell the result to set ModDate to text 6 thru 7 & "/" & text 9 thru 10 & "/" & text 1 thru 4 & text 11 thru 19
--display dialog "Date " & ModDate with title ("Test")
--display dialog "File: " & "setfile -d " & "\"" & ModDate & "\" " & BackupFilepath with title ("Test")
set complete to do shell script "setfile -d " & "\"" & ModDate & "\" " & BackupFilepath
do shell script "mdls " & quoted form of POSIX path of (aFile as text) & " | grep 'kMDItemContentModificationDate' | awk '/ = / {print $3,$4}'"
tell the result to set ModDate to text 6 thru 7 & "/" & text 9 thru 10 & "/" & text 1 thru 4 & text 11 thru 19
set complete to do shell script "setfile -m " & "\"" & ModDate & "\" " & BackupFilepath
set FileToChange to rtffpath
--display dialog "rtffile: " & rtffpath with title ("Test")
tell application "Finder"
-- select FileToChange
set label index of file FileToChange to ItemColor
end tell
end repeat
end open
property script_fname : "font_conversion.pl" -- your "external script" name
on open (droppedItemList)
set my_path to POSIX path of (path to me)
repeat with aFile in droppedItemList
set shell_scpt to "" as Unicode text
set shell_scpt to shell_scpt & "perl " & quoted form of (my_path & "Contents/Resources/" & script_fname)
set fpath to aFile as Unicode text
set CaptureFilepath to quoted form of POSIX path of (aFile as text)
set rtffpath to fpath & ".rtf"
set BackupFilepath to quoted form of POSIX path of (rtffpath as text)
set POSIX_rtffpath to POSIX path of rtffpath
set shell_scpt to shell_scpt & space & quoted form of POSIX_rtffpath
set theInfo to info for aFile
set theCreator to file creator of theInfo
-- if theCreator is not "NISI" or fpath ends with ":" then
-- display dialog "Please drop a Classic Nisus Writer file on this droplet..."
-- return
-- end if
if fpath ends with ":" then
display dialog "Please drop a Classic Nisus Writer file on this droplet..."
return
end if
tell application "Finder"
set ItemColor to label index of aFile
end tell
-- open application "Nisus Writer Pro"
tell application "Nisus Writer Pro"
activate
try
open aFile
on error errMsg
display dialog "Couldn't open the file " & fpath & ": " & errMsg
return
end try
try
-- save document 1 as "rtf" in rtffpath
save document 1 in rtffpath
close window 1
on error errMsg
display dialog "Couldn't save the file as " & rtffpath & ": " & errMsg
return
end try
end tell
-- try
-- do shell script shell_scpt
-- on error errMsg
-- display dialog "Couldn't convert the font with the shell --script " & shell_scpt & ": " & errMsg
-- return
-- end try
-- close Nisus
-- close application "Nisus Writer Pro"
-- set complete to do shell script "cp -pRf " & CaptureFilepath & " " & BackupFilepath
-- display dialog "File: " with title ("Test")
-- & POSIX path of (CaptureFilepath as text)
--display dialog "mdls " & quoted form of POSIX path of (aFile as text) with title ("Test")
do shell script "mdls " & quoted form of POSIX path of (aFile as text) & " | grep 'kMDItemContentCreationDate' | awk '/ = / {print $3,$4}'"
--tell the result to set ModDate to text 3 thru 4 & text 6 thru 7 & text 9 thru 10 & "_" & text 12 thru 13 & "-" & text 15 thru 16 & "-" & text 18 thru 19
tell the result to set ModDate to text 6 thru 7 & "/" & text 9 thru 10 & "/" & text 1 thru 4 & text 11 thru 19
--display dialog "Date " & ModDate with title ("Test")
--display dialog "File: " & "setfile -d " & "\"" & ModDate & "\" " & BackupFilepath with title ("Test")
set complete to do shell script "setfile -d " & "\"" & ModDate & "\" " & BackupFilepath
do shell script "mdls " & quoted form of POSIX path of (aFile as text) & " | grep 'kMDItemContentModificationDate' | awk '/ = / {print $3,$4}'"
tell the result to set ModDate to text 6 thru 7 & "/" & text 9 thru 10 & "/" & text 1 thru 4 & text 11 thru 19
set complete to do shell script "setfile -m " & "\"" & ModDate & "\" " & BackupFilepath
set FileToChange to rtffpath
--display dialog "rtffile: " & rtffpath with title ("Test")
tell application "Finder"
-- select FileToChange
set label index of file FileToChange to ItemColor
end tell
end repeat
end open