I have a nifty little macro that gets a file path and then prepends "file://" to the file path and inserts a link into my document which is excellent for referring to external documents.

When I click on the link it opens the folder and selects the document that the link refers to - all I have to do his Command-O to open the document. But, is there a way to have the macro open the target document for me even though the target document may be a PDF or jpg?

If not no big deal, I'm thrilled with what I have. But it doesn't hurt to ask.

Here ya go Steve. I still haven't solved the problem of getting the target file to open. If anyone would like to improve on what I've done, please do. I'm not a programmer so there are probably better ways to approach this.

Mine doesn't set a default folder path (it lets OSX decide where the file open panel should initially point), and it doesn't ask the user for the link's display text, it merely assumes the file name is good enough.

Okay, okay so your code is way more sexy than my code. What, you do this for a living or something? I replaced my macro with what you did, it works much better, not having to enter a name speeds things up considerably.

A modification to the topic
I am writing a scientific book with 400 graphs and pictures. It is increasingly difficult to keep the names of the graphs in mind and search for them...

Instead of importing a graph with shift cmd i: is it possible to make a macro which actually imports the graph, but when clicking on it, it opens the file in the refering program, which generated the file? (In my case photoshop and freehand)

So the picture also contains the link to the file and would be the link. At the end of the modification it would be necessary to reload the graph to see the changes...

Lorrymeggs wrote:Instead of importing a graph with shift cmd i: is it possible to make a macro which actually imports the graph, but when clicking on it, it opens the file in the refering program, which generated the file? (In my case photoshop and freehand)

Try this macro. Clicking on an image does not work because a macro cannot modify this kind of UI behaviour and it supports only inline images (not floating images), but . . .

• When you run it without selecting an image, [1] it invokes the Open dialog asking you to locate an image file to be inserted, [2] insert the image, and [3] set a link to the original file.

• When you run it with an image having a valid link selected, the original image file will be opened in the default application for the file type (the same application which opens it when you double click on it in the Finder).

• When you run it with an image not having any link or having a wrong link selected, it it invokes the Open dialog asking you to locate the new original image file.

At the end of the modification it would be necessary to reload the graph to see the changes...

The macro below replaces the selected image having a valid link with the original image file you have modified. Note that it does not and cannot know if the original has been really modified. It tries to retain the current size settings but is not very accurate and I have noticed a glitch: the new versin of the selected image moves a bit.

You really safe me hours and hours of searching for the right graph! Absolutely happy with the solution!

Until now I had to work with Framemaker, which was very good but only runs on the aged MacOS 9. I was looking for a reasonable competitor, desperately tested many writing programs - at least 10... was very unhappy with what I saw and really at last started to work with Nisuswriter, which is by far the most suited writing program for a job like writing a scientific book! The click and open possibility in Framemaker was the only major drawback.
BUT:After all this macro is it! It is time to say good bye to Framemaker!