As I rename documents or move them in the binder, the document link changes. What are the rules ?

I have written quite a few keyboard maestro macros to manage Scrivener documents which use the document link. I notice that in some circumstances, the macros cease to work. I am just guessing, but I think that the link changes when the document is moved in the binder ? when it is renamed ?
I would like to understand the rules, ie under which circumstances my macros will no longer work until I change the document link in the macro.
thank you very much

Internal document links, bookmarks and for that matter external links between projects or from other software, all operate upon the internal ID that is assigned to an item when you create it. No amount of moving it around or renaming it will ever sever that link. The only action I can think of off of the top of my head that would break a link is if you drag an item with internal links from one project into another—but in that case, it should be removing the link formatting from the text (unless it was dragged along with the target, and then the link should be fixed to point to the new internal ID).

So I would suspect there is some other issue going on with the macro. I would suggest running Keyboard Maestro in debugging mode when this happens, so you can step through each action one by one and observe where the failure occurs.

Thank you IOA. Its strange because
1- the macro works
2- I rename or move the document
3- the macro stops working
4- I re-copy the link into the macro
5- the macro works.
I wil so more testing and give you a follow-up. thanks again.

All right, I can only say what Scrivener is expecting. Lacking any knowledge of what the macro is meant to do, how it works, or what parts of the Scrivener UI it is tapping into, I couldn’t say what is going wrong.

The only thing I can think to elaborate on is that if you copy some text with an internal link into another program that takes rich text, like TextEdit, and then edit the link from there, you should see what the internal URL looks like. As you can see, it has nothing to do with the name or position of the item. If you then copy and paste that text from TextEdit back into the same project, it should continue working as an internal link. So long as KM is doing something similar to that interaction, and not attempting to “fix” the link or anything, then in theory that hyperlink should permanently work within that project. In my testing, this works fine:

  1. Copy text with a link into TextEdit in rich text mode.
  2. Change the name of the target item in Scrivener.
  3. Copy the text from TextEdit.
  4. Create a new item in Scrivener and paste the text in, then click the link.

I tried the instructions at the end of your post, AmberV, and find that Textedit throws and error saying that there is no application to open the link. When I go to Applications to choose Scrivener to open the link, Scrivener is greyed out. Odd. I remember this working fine.

this is probably what is happening with the macro which is one line: open this link in Scrivener. Note that the link is not formatted so it’s not a formatting issue.

So to rephrase my problem: it’s not that the link has changed (IOA you are right). It is that the link can no longer open in Scrivener. Why this would or could be I have no clue.

thank you for your post

When you say “the document link”, what exactly do you mean? How do you create it and put it in KM? What Action do you use to activate it?

This seems reliable, as far as I can tell:


I think that the issue lies with the macro settings (gear to the top right of the macro).
Discussed here … ile/6992/8
thank you for your post and illustration

Hmm …

[attachment=0]process text normally.png[/attachment]

That would be expected behaviour, it is a meaningless link outside of Scrivener. This test that I described was not meant to be used to test the link inside of TextEdit, but rather only to demonstrate that the URL does not change when passed through the pasteboard, even when coming from other software. It is still going to be an invalid URL everywhere except for in Scrivener, and then only within a project where that UUID is present.

External links, on the other hand, should work from anywhere, and continue to work so long as the project itself is never renamed or moved.