Reply to topic  [ 11 posts ] 
Permission denied when running old macro 
Author Message

Joined: 2009-09-04 13:11:25
Posts: 28
This morning I needed to run an old macro. I had two problems:
1 All my macros had disappeared from the macro menu.
2 After doing Run macro from file, I ran the macro, I found the macro I was looking for.
But then Nisus sends me this message:
"Could not access the file... because permission was denied"

I tried to change the permissions of those documents. But it still didn't work...


2015-10-26 02:21:00
Profile
User avatar

Joined: 2007-02-07 00:58:12
Posts: 876
Location: Japan
You are using NWP 2.1.2?
This is probably a sand-boxing issue. Move your macros into the Macros folder inside the "Nisus Documents", and try again.

_________________
philip


2015-10-26 05:07:33
Profile

Joined: 2009-09-04 13:11:25
Posts: 28
I'm not sure I understood what you meant. I took the macros that were in the macros folder and I put them into the Nisus documents folder which is found in the documents folder. The macros didn't show in the macro menu anymore. When I tried to run the macro, all the related macros opened but nothing happened in the document I was trying to modify...


2015-10-26 07:13:57
Profile
User avatar

Joined: 2007-02-07 00:58:12
Posts: 876
Location: Japan
Pat wrote:
I'm not sure I understood what you meant. I took the macros that were in the macros folder and I put them into the Nisus documents folder which is found in the documents folder. The macros didn't show in the macro menu anymore. When I tried to run the macro, all the related macros opened but nothing happened in the document I was trying to modify...

Where is your macros folder? Is it inside the Nisus Documents folder? If that is the case I'm not sure I understand why they aren't loaded when you start Nisus.
Here is the things I would try and check:
  • Check your preference to make sure the Nisus Documents folder is set as your Document Manager folder
  • Make sure the macros folder is inside the Nisus Documents folder and the macros are inside
  • Make sure the macros in that folder load when you start Nisus
  • If they don't load, try using "Choose Macros Folder…" from the "Macros" menu, and choose the macros folder
  • If that still doesn't work try opening the macro (for editing) and then try "Save As Macro". Check where Nisus is trying to save the macro
If the macro does appear in your menu and it still gives you a "Permission denied" message, then I'd have to ask what the macro is trying to do. Is the macro supposed to save something? Or is it trying to open a file outside of the Nisus Documents folder?

Hope some of these ideas help

_________________
philip


2015-10-26 07:32:03
Profile

Joined: 2009-09-04 13:11:25
Posts: 28
Ok. I did everything you said this time and the macros appear in the menu but it still doesn't work even though the permissions of the rtf documents opened by the macros have been changed. Apparently, after an update, my macros were all moved in another folder. I have two Nisus folders in the Documents folder. One named Nisus documents and the other one Nisus Writer Pro. I just found that all my old macros were in fact in the Nisus Writer Pro folder and that is probably why they didn't show in the macro menu anymore. Apparently, all my rtf documents that are opened by my macros are still in the Nisus document folder. I don't know why there were restrictions access to them. As I said, I changed those permissions and it doesn't work. Should I tried to move the macro folder in the Nisus Writer Pro folder into the Nisus documents folder? I really need to be able to use all my macros...


2015-10-26 12:54:37
Profile
User avatar

Joined: 2007-02-07 00:58:12
Posts: 876
Location: Japan
Hi Pat,
the message about "Permissions denied" has nothing to do with MacOS permissions. Changing them will do nothing to solve this problem. As I was trying to say before this is likely a "sand-boxing" issue. Could you let us know what the macro is supposed to do? If your macro tries to access files on disk, it will likely need to have a line like the following added:
Code:
File.requireAccessAtPath path

This type of permissions request should solve the issue. See the Macro Language Reference for details.

_________________
philip


2015-10-26 15:42:11
Profile

Joined: 2009-09-04 13:11:25
Posts: 28
Those macros used to work fine. I really don't understand why they don't work anymore and need to be modified. This macro in particular needs to open rtf documents containing long lists of words...


2015-10-26 15:51:04
Profile
User avatar

Joined: 2007-02-07 00:58:12
Posts: 876
Location: Japan
Pat wrote:
Those macros used to work fine. I really don't understand why they don't work anymore and need to be modified. This macro in particular needs to open rtf documents containing long lists of words...

Sand-boxing is a change that was made to Nisus starting with version 2.1. It is a change made to comply with security requirements. If you're unhappy with this you can go back to version 2.0.7, but it really isn't a big deal. If you add the "require access" line to your code you will be bothered once and from then on things should run fine again.

_________________
philip


2015-10-26 15:58:42
Profile

Joined: 2009-09-04 13:11:25
Posts: 28
Ok then, in the following macro, where does the command "File.requireAccessAtPath path" fits:

$doc = Document.active
$dbPath = ‘~/Documents/Nisus Documents/ENGLISH VOCAB_2.rtf’
$dbAvailable = File.existsAtPath $dbPath
if $dbAvailable
   $dbDoc = Document.open $dbPath
else
   prompt ‘Can\’t find the corpus file.’
   exit
end
Find All ‘\b[[:alpha:]]+\b’, ‘E’
$words = $dbDoc.selectedSubtexts
$doc.show
foreach $word in $words
   Find and Replace $word, $word, 'EawUm'
end


2015-10-27 12:51:25
Profile
User avatar

Joined: 2007-02-07 00:58:12
Posts: 876
Location: Japan
Pat wrote:
Ok then, in the following macro, where does the command "File.requireAccessAtPath path" fits:



if $dbAvailable
   File.requireAccessAtPath $dbPath
   $dbDoc = Document.open $dbPath
else


To tell you the truth, I think it would have been good enough for you to simply open the database file (by hand) once. That would have already solved the problem. But if you modify the macro in this way, the macro will warn you, if necessary, in a more useful way in the future.

_________________
philip


2015-10-27 15:52:11
Profile
Official Nisus Person
User avatar

Joined: 2002-07-11 17:14:10
Posts: 4251
Location: San Diego, CA
In addition to everything Philip has said, which is all true and good advice, there is another solution: you can use the menu Macro > Application > Manage Macro File Access. It will walk you through the process of permanently granting your macros access to any files or folders outside the sandbox, without the need to modify any of your macro code.

If you want to learn more about sandboxing, you might read our FAQ topic. That doesn't cover anything about macros, but will give you some background information on why these kinds of changes are necessary.


2015-10-28 16:22:37
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 11 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software