Reply to topic  [ 7 posts ] 
Inserting links to local files 
Author Message

Joined: 2009-08-05 03:03:05
Posts: 11
Just as background, I posted quite a while back that I had rejected Nisus Writer Pro as a word processor due to unresolvable issues with line height. However I am now evaluating it, and will probably buy it shortly, for a different purpose: editing RTF files, pure and simple. It's obviously far better than TextEdit; I can use it as my external editor in combination with DevonThink; etc.

Now for my questions:

1) Is there a way to create an alias to a file via the standard Mac operations for doing so, then insert or drag this alias into an RFT or RFTD file such that it becomes a link?

2) For hyperlinks to local files, is there a way to instruct a particular application to open a file? Otherwise what happens is just that Finder gets opened with a highlight on the file. So far in my playing around I have gotten Acrobat to open as an application by adding its name a hyperlink, but not to actually open a file. Haven't found any info yet on this question in the Acrobat forums.

These are not really Nisus questions - they relate more to OS X, the RFT standard, etc. But I'm hoping someone may know the answers from experience.


2009-12-07 03:29:09
Profile
Official Nisus Person
User avatar

Joined: 2002-07-11 17:14:10
Posts: 4251
Location: San Diego, CA
Usable Thought wrote:
1) Is there a way to create an alias to a file via the standard Mac operations for doing so, then insert or drag this alias into an RFT or RFTD file such that it becomes a link?

At this time no, but I don't see why we can't add such a thing. I'll file an enhancement request.

In the meantime you might use some kind of macro to help you. Here's a macro that inserts/adds a link in the topmost NWP document. That link points to the second document open in NWP.
Code:
# gather documents we'll need
$docs = Document.openDocuments
If $docs.count < 2
   Prompt 'There must be at least two open documents to link between.'
   Exit
End

$applyDoc = $docs.valueAtIndex(0)
$targetDoc = $docs.valueAtIndex(1)
$filePath = $targetDoc.filePath
If ! $filePath
   $name = $targetDoc.displayName
   Prompt "The 2nd open document '$name' has not been saved, and thus cannot be linked to."
   Exit
End

# add link
$link = $filePath.expandedFilePath
$link = 'file://' & $link

Document.setActive($applyDoc)
If $applyDoc.textSelection.length == 0
   Insert Text $filePath.lastFilePathComponent
End
Set Link $link

Hopefully that's useful.

Quote:
2) For hyperlinks to local files, is there a way to instruct a particular application to open a file? Otherwise what happens is just that Finder gets opened with a highlight on the file.

As far as I know, this isn't possible. What you want used to be the case prior to OSX 10.5 (Leopard), but Apple changed the behavior, likely for security reasons. However, NWP could help out here; I think we already have a request filed for this feature, but I'll make sure.


2009-12-09 12:33:53
Profile WWW

Joined: 2009-08-05 03:03:05
Posts: 11
Thanks - I'll try the macro out.

I know some apps do manage to insert links that open to files they contain - e.g. Papers and DevonThink. But I don't know how they do it - I could look at the RFT code in plain text, but even then I assume the functionality that actually makes it work is in the app, not in the link.


2009-12-09 12:36:36
Profile
Official Nisus Person
User avatar

Joined: 2002-07-11 17:14:10
Posts: 4251
Location: San Diego, CA
That's correct, the behavior of NWP would need to change, not the RTF. Currently NWP just punts the link/URL to OSX to handle, which is why the behavior is dependent on which version of OSX you're using. But we could check for URLs that point to local files, decide the proper application, and launch/open the file there.


2009-12-09 13:01:28
Profile WWW
User avatar

Joined: 2008-01-20 11:08:35
Posts: 89
Location: California
How does one insert a hyper link to a local file? I know about the Hyperlink menu item, but how would you select a file with a dialog window?

thanks
Lou


2009-12-09 18:08:38
Profile WWW

Joined: 2009-08-05 03:03:05
Posts: 11
Quote:
How does one insert a hyper link to a local file? I know about the Hyperlink menu item, but how would you select a file with a dialog window?


Instead of

Code:
http://


at the start of the URL you have

Code:
file://


As for the path to the file, you could write a macro to get this. At the moment I am using Pathfinder, which has a nice context menu entry allowing you to manually copy various types of paths for a file.


2009-12-09 18:19:07
Profile
User avatar

Joined: 2008-01-20 11:08:35
Posts: 89
Location: California
Fabulous. Thanks for the response.

-L


2009-12-10 09:02:48
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 7 posts ] 

Who is online

Users browsing this forum: No registered users and 5 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