menu item "Open macro folder"

Get help using and writing Nisus Writer Pro macros.
Post Reply
js
Posts: 229
Joined: 2007-04-12 14:59:36

menu item "Open macro folder"

Post by js » 2008-11-26 13:42:56

Is the menu item "Open macro folder" itself a macro?
Is it possible to write a macro that opens any given folder?

User avatar
martin
Official Nisus Person
Posts: 4288
Joined: 2002-07-11 17:14:10
Location: San Diego, CA
Contact:

Re: menu item "Open macro folder"

Post by martin » 2008-11-26 16:28:46

That particular menu isn't a macro, but you can easily replicate its effect with any folder you like:

Code: Select all

File.revealPathInFinder('~/Documents')

js
Posts: 229
Joined: 2007-04-12 14:59:36

Re: menu item "Open macro folder"

Post by js » 2008-11-27 09:11:57

Thank you Martin. I hope someday we will get a book or a file to teach the less talented among us some of these more basic things one can do with the Nisus macro language. Or is there one already?

As to the macro itself I still would need some fine tuning to get what I want. The first problem is: Your sample macro shows the documents folder within the next higher level which is opened. But I would want the macro to open the documents folder itself.

The second problem is: I wanted to open a folder with a two word name (within another folder with another two word name). I thought I could copy the path I get by pulling the folder onto the terminal window and copy it from there. This did not work. I tried to outquote the space character with backslashes, but maybe I did not do it properly. How should one proceed with special characters in the file name to make the macro work?

js
Posts: 229
Joined: 2007-04-12 14:59:36

Re: menu item "Open macro folder"

Post by js » 2008-11-28 04:51:01

Addendum:

I take my first question back: When I changed the filename, deleting an empty space. Now the macro worked, as expected. Strange as it may sound, when I put put the space back again, it worked also, with the space. No idea why. What I learned in the process is, that Nisus can handle spaces without the backlashes added, if you pull a file icon onto the terminal. In fact you have to take them out again to work in Nisus.

As to opening a older rather than only showing it's name in the higher level folder I realize that this can be solved by adding an empty dummy folder together with the files and calling that instead ...

Thanks for your help anyway.

User avatar
martin
Official Nisus Person
Posts: 4288
Joined: 2002-07-11 17:14:10
Location: San Diego, CA
Contact:

Re: menu item "Open macro folder"

Post by martin » 2008-12-01 16:30:46

js wrote:Thank you Martin. I hope someday we will get a book or a file to teach the less talented among us some of these more basic things one can do with the Nisus macro language. Or is there one already?
The best we have is the Nisus Macro Reference, which is included in every NWP download, or can be obtained separately from the macro repository. It's been often commented that the document is terse and could use more examples and do a better job of teaching, so I don't know how much it would help someone in your position. It does however at least detail every command available, which is the primary intent of the guide.
When I changed the filename, deleting an empty space. Now the macro worked, as expected. Strange as it may sound, when I put put the space back again, it worked also, with the space. No idea why. What I learned in the process is, that Nisus can handle spaces without the backlashes added, if you pull a file icon onto the terminal. In fact you have to take them out again to work in Nisus.
That's exactly right, the strings/paths in NWP don't require any special escaping/backslashes. For a full list of special characters that require escaping see the "Literals" section in the Macro Reference.
As to opening a older rather than only showing it's name in the higher level folder I realize that this can be solved by adding an empty dummy folder together with the files and calling that instead ..
I'm glad you discovered a work around- it's the best you can do I think. The "reveal" command just tells the Finder to do the showing, so we're really at the mercy of whatever Apple decided is best for showing the requested file/folder. In my own experience the Finder's decisions aren't always that great.

Nobumi Iyanaga
Posts: 151
Joined: 2007-01-17 05:46:17
Location: Tokyo, Japan
Contact:

Re: menu item "Open macro folder"

Post by Nobumi Iyanaga » 2009-02-08 06:12:04

Hello js,

I think the simplest in such a situation is to use the Terminal command "open", via Perl block. An example:

Code: Select all

Begin Perl
	`open "/Volumes/myVolume/myDocument/temp/Eudora Pro 4.2-J/"`;
End
The Terminal command in a Perl block must be enclosed between two "`" ("grave accent" or "backticks"); and it is better to enclose the file path between double quotes.

I hope this helps.
Best regards,

Nobumi Iyanaga
Tokyo,
Japan

Post Reply