How to copy a page to another folder?

Operating system

macOS

Joplin version

2.13.13

Desktop version info

Joplin 2.13.13 (prod, darwin)

Client ID: 6a443486fb4247e8aba3b23a50ff505e
Sync Version: 3
Profile Version: 44
Keychain Supported: Yes

Revision: c3cdeeb

Rich Markdown: 0.13.3

What issue do you have?

I'm coming from OneNote and there I have a macro to copy the current page to another section. I use this for various checklists that I complete from time to time (a monthly list, daily list, etc.).

So far I can't find a Copy Page function. I could hack around it with solutions like:

  • Select and copy the page content, then go to the new folder and paste it in. (This suffers from timing issues - the macro has to wait for the navigation which takes an indeterminate amount of time.)
  • Duplicate the page, navigate to the copied page, and move that page to the new folder, renaming the Title to not have the word Copy. (This seems unreliable because in my experience it's hard to predict where Joplin will place newly created pages - from a user perspective it's a bit random, at least when sorting manually.)

Is there any way I can just copy the whole page, including title, to another folder?

A bigger problem is copying multiple pages, which is also a common part of my workflows. So far I don't see a way to do that quickly/through a macro (e.g. in Keyboard Maestro).

Hi,
I don't quite understand the concept of a page in a note.
In principle, page space is related to printing or screen size.

1 Like

@betternote I'm using "page" and "note" interchangeably here - I guess "note" is a better term for Joplin, I'll work on changing that in my brain!

I would like to easily copy one or more Notes to another Folder. So far I have not found any easy way to do that. Especially relevant when I want to copy 10+ Notes at once

I'm not certain there is a particularly good way of doing this via the desktop app other than do what you have already been describing. The terminal app does have a cp command that allows you to copy a note to a new notebook (e.g. cp <note> [notebook]) and of course there is the data API which would allow you to do it programatically.

Another option would be to do a multi select on your notes, export to JEX or RAW then import and move them.

General thoughts about that workflow in general, personally I can't see myself having a use case for multiple copied notes of the same type in a different location but there is a feature of Trilium notes I really like which is the concept of a "clone" note. i.e. it isn't that the note itself is copied but instead you can place something akin to a shortcut directly in another folder that looks and behaves just the like original note but of course it is all just attached to that single master note.

Or the duplicate function from the context menu

They partially covered that with the complaint that the duplicated notes still need to be manually renamed to remove the - Copy and moved to the new notebook.

I may be able to work around this programmatically using Export. I'll check that out.

My use case mainly involves recurring lists of tasks that span multiple pages. E.g. a quarterly checklist that includes various reading, maintenance, etc. Existing solutions are clunky as far as i can see, but Joplin does have an excellent API and I've been able to automate away many rough edges so far. (Overall I find it to be a huge upgrade over OneNote.)

I have this working smoothly with a Keyboard Maestro macro. It works like:

  1. Copy the Markdown Links for the current pages (fortunately the highlight color is unique so I can trigger a right-click on the highlighted note(s))
  2. Run a TypeScript file that parses the note IDs, and copies those pages to a specified folder in the correct order

Including here with the TS code in case this is useful to others.

async function runCopyNotesToCurrent() {
  const markdownLinkText = process.argv[2];
  const matchResult = markdownLinkText.matchAll(/:\/[a-f0-9]{32}/g);
  const pageIds = Array.from(matchResult)
    .flat()
    .map(s => s.slice(2));

  const sourceNotes = await Promise.all(pageIds.map(id => fetchJoplinNote(id)));

  // Insert at top of folder... I don't see way to insert at bottom
  await resolveInOrder(sourceNotes.toReversed(), async (source, i) => {
    return await createJoplinNoteFromInput({
      parent_id: J_CURRENT_FOLDER_ID,
      body: source.body,
      title: source.title,
      created_time: source.created_time,
    });
  });
}

export async function resolveInOrder<V, R>(
  inputs: V[],
  callback: (element: V, index: number, previousResults: R[]) => Promise<R>,
): Promise<R[]> {
  return inputs.reduce<Promise<R[]>>(
    async (accArrPromise, val, i) => {
      const prevResults = await accArrPromise;
      const currResult = await callback(val, i, prevResults);
      return [...prevResults, currResult];
    },

    Promise.resolve([]),
  );
}

Copy Joplin Note to Current Folder.kmmacros (41.1 KB)

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.