Unless you have a reason for using Perl, I'd convert your macro to a regular Nisus Writer macro. The code is pretty simple:
Code: Select all
Document.open "~/Documents/MIKE/JOURNALS/2010s/2016/02.16.rtf"
However, whether you're using Perl or a Nisus Writer macro, you will need to take into account
sandboxing restrictions. Basically the system (OSX) will deny access to the desired file unless Nisus Writer has been given access to it by some kind of user interaction– usually by selecting the file in a standard system dialog.
A revised Nisus Writer macro that correctly takes into account sandboxing would be:
Code: Select all
File.requireAccessAtPath "~/Documents/MIKE/JOURNALS/2010s/2016/02.16.rtf"
Document.open "~/Documents/MIKE/JOURNALS/2010s/2016/02.16.rtf"
That macro will ask you to select the target file the first time you use it. After that, on any subsequent uses, the macro will open the target file without interruption.
If you do use a macro like that, you probably want to declare the target file's path once. That will eliminate the redundancy and make it easier to edit:
Code: Select all
$path = "~/Documents/MIKE/JOURNALS/2010s/2016/02.16.rtf"
File.requireAccessAtPath $path
Document.open $path
If you have a lot of these files and plan to create macros for them all, another way to comply with sandboxing is to declare that you need access to the enclosing folder, eg:
Code: Select all
File.requireAccessAtPath "~/Documents/"
Document.open "~/Documents/MIKE/JOURNALS/2010s/2016/02.16.rtf"
In this way you'll only be prompted to grant access to the Documents folder once, no matter how many macros you have.
I hope that helps, and wasn't confusing. Please let me know if you have any questions.