Reply to topic  [ 6 posts ] 
menu item "Open macro folder" 
Author Message

Joined: 2007-04-12 14:59:36
Posts: 229
Is the menu item "Open macro folder" itself a macro?
Is it possible to write a macro that opens any given folder?


2008-11-26 13:42:56
Profile
Official Nisus Person
User avatar

Joined: 2002-07-11 17:14:10
Posts: 4251
Location: San Diego, CA
That particular menu isn't a macro, but you can easily replicate its effect with any folder you like:
Code:
File.revealPathInFinder('~/Documents')


2008-11-26 16:28:46
Profile WWW

Joined: 2007-04-12 14:59:36
Posts: 229
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?


2008-11-27 09:11:57
Profile

Joined: 2007-04-12 14:59:36
Posts: 229
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.


2008-11-28 04:51:01
Profile
Official Nisus Person
User avatar

Joined: 2002-07-11 17:14:10
Posts: 4251
Location: San Diego, CA
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.

Quote:
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.

Quote:
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.


2008-12-01 16:30:46
Profile WWW

Joined: 2007-01-17 05:46:17
Posts: 145
Location: Tokyo, Japan
Hello js,

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

Code:
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


2009-02-08 06:12:04
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 6 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest


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