GithubHelp home page GithubHelp logo

Comments (11)

chhoumann avatar chhoumann commented on May 20, 2024

Hey @jacklaing, thanks for your report!

I'm having a hard time reproducing this.
Does it give any errors? Maybe in the console?

from quickadd.

arumazu avatar arumazu commented on May 20, 2024

Hi! Looks like I have similar issue. I can send you errors from my console log

C:\Users\user\knowledgebase\Scripts\move.js:23 Uncaught (in promise) TypeError: fileCache.frontmatter?.tags?.split is not a function
    at VM551 C:\Users\user\knowledgebase\Scripts\move.js:23
    at Array.forEach (<anonymous>)
    at moveFilesWithTag (VM551 C:\Users\user\knowledgebase\Scripts\move.js:11)
    at async MacroChoiceEngine.onExportIsFunction (eval at <anonymous> (app.js:1), <anonymous>:9669:23)
    at async MacroChoiceEngine.userScriptDelegator (eval at <anonymous> (app.js:1), <anonymous>:9653:17)
    at async MacroChoiceEngine.executeUserScript (eval at <anonymous> (app.js:1), <anonymous>:9648:9)
    at async MacroChoiceEngine.executeCommands (eval at <anonymous> (app.js:1), <anonymous>:9622:17)
    at async MacroChoiceEngine.run (eval at <anonymous> (app.js:1), <anonymous>:9615:9)
    at async ChoiceExecutor.onChooseMacroType (eval at <anonymous> (app.js:1), <anonymous>:12585:9)
    at async ChoiceExecutor.execute (eval at <anonymous> (app.js:1), <anonymous>:12561:17)
(anonymous) @ C:\Users\user\knowledgebase\Scripts\move.js:23
moveFilesWithTag @ C:\Users\user\knowledgebase\Scripts\move.js:11
async function (async)
callback @ VM545:12737
yS @ app.js:1
t.onChooseItem @ app.js:1
t.onChooseSuggestion @ app.js:1
t.selectSuggestion @ app.js:1
e.useSelectedItem @ app.js:1
(anonymous) @ app.js:1
e.handleKey @ app.js:1
e.onKeyEvent @ app.js:1

from quickadd.

arumazu avatar arumazu commented on May 20, 2024

I tried to run this macro inside default Obsidian Help vault and it worked out properly. So, I decided to switch off all community plugins on my vault and tried again, but problem is the same, doesn't work.

from quickadd.

twakas avatar twakas commented on May 20, 2024

In my case, tag descriptions in YAML frontmatter like:

tags: [tag1, tag2]

or

tags:
- tag1

caused the same problem.
Worked properly after removing the above types of tags inside my vault.

from quickadd.

jacklaing avatar jacklaing commented on May 20, 2024

I can confirm all of the above:

  • It worked in Help vault
  • I got the exact same console error as @arumazu
  • As with @twakas case, it was frontmatter of the format tags: [] that was causing the issue. Once I deleted the offending frontmatter the folder picker appeared properly. Luckily I don't use frontmatter and it was just an example page.

from quickadd.

dummifiedme avatar dummifiedme commented on May 20, 2024

I was trying the plugin just now, initially the picker didn't work, but after a reload, it did.

So everything works for me now.
Just for everyone's information (I was maybe dumbo)

Copy the code using the button only :D Else it adds some spaces here and there. Messes up the code and adds additional spaces to the new file path.

image

from quickadd.

icytree avatar icytree commented on May 20, 2024

In my case, tag descriptions in YAML frontmatter like:

tags: [tag1, tag2]

or

tags:
- tag1

caused the same problem.
Worked properly after removing the above types of tags inside my vault.

Hi, I am having the same issue. How did you manage to transform your frontmatter tags to inline tags in you whole vault ? I've tried to find a way with Regex and VSC but without sucess...

I was also wondering if it would be possible to modify the js script to make it work with frontmatter tags ?

from quickadd.

Khoding avatar Khoding commented on May 20, 2024

Update on this? still the same for me

from quickadd.

astutecat avatar astutecat commented on May 20, 2024

I also have hit the same issue myself.

Developer console has the following:

VM145:23 Uncaught (in promise) TypeError: fileCache.frontmatter?.tags?.split is not a function
    at eval (eval at getUserScript (eval at <anonymous> (app.js:1)), <anonymous>:23:67)
    at Array.forEach (<anonymous>)
    at moveFilesWithTag (eval at getUserScript (eval at <anonymous> (app.js:1)), <anonymous>:11:11)
    at async MacroChoiceEngine.onExportIsFunction (eval at <anonymous> (app.js:1), <anonymous>:11649:23)
    at async MacroChoiceEngine.userScriptDelegator (eval at <anonymous> (app.js:1), <anonymous>:11632:21)
    at async MacroChoiceEngine.executeUserScript (eval at <anonymous> (app.js:1), <anonymous>:11613:9)
    at async MacroChoiceEngine.executeCommands (eval at <anonymous> (app.js:1), <anonymous>:11583:17)
    at async MacroChoiceEngine.run (eval at <anonymous> (app.js:1), <anonymous>:11576:9)
    at async ChoiceExecutor.onChooseMacroType (eval at <anonymous> (app.js:1), <anonymous>:15884:9)
    at async ChoiceExecutor.execute (eval at <anonymous> (app.js:1), <anonymous>:15860:17)
eval @ VM145:23
moveFilesWithTag @ VM145:11
async function (async)
callback @ VM105:16036
WR @ app.js:1
t.onChooseItem @ app.js:1
t.onChooseSuggestion @ app.js:1
t.selectSuggestion @ app.js:1
e.useSelectedItem @ app.js:1
(anonymous) @ app.js:1
e.handleKey @ app.js:1
e.onKeyEvent @ app.js:1
manager.ts:100 Uncaught (in promise) TypeError: Cannot read property 'undefined' of undefined
    at DataManager.setTotalStats (eval at <anonymous> (app.js:1), <anonymous>:5939:21)
    at eval (eval at <anonymous> (app.js:1), <anonymous>:6225:34)

from quickadd.

gradyhandle avatar gradyhandle commented on May 20, 2024

Same issue here. So how to solve it?

from quickadd.

icytree avatar icytree commented on May 20, 2024

If any of you guys really needs to move/copy notes based on tags (or any metadata used in Obsidian), I might have a workaround to offer. Here's the instructions :

  1. Assuming :

    • You are on Windows
    • You are using the wikilinks with the shortest path when possible in your vault
    • None of your file have the same name especially regarding attachments (all unique file name)
  2. Select the desired filter in the Obsidian search to find the files to move or copy (path, tags, file name, content, ...)

  3. Search it in Obsidian search. Copy the result with the following config :

    • Show path : Off
    • List style : Wikilinks
    • List prefix : Any
  4. Paste the result in a buffer note.

  5. Paste the following Dataview "script" in the same buffer note :

```dataview
list WITHOUT ID file.outlinks from outgoing([[#]])
```

(Details: Will return a list of the files linked within the notes that resulted from your query (the links you pasted in the buffer note). This includes attachements linked in them. Which is why this step is necessary.)

  • Note: This method can be used to extract all files linked to a map of content (MOC) for instance with the possibility to go multiple level deep (file.outlinks -> file.outlinks.outlinks -> ...)
  1. Select and copy that list. Paste it in your buffer note.

    • Note: The copied list might contain duplicate but this will be automatically addressed in the next steps.
  2. Using multi cursor, you want to :

    1. Put each file name in double quote
      • Note: If one of the note in your list as its name contained in another of your note that you don't necessary want to send (ex. MOC also in Biology MOC), it might be best to try to add .md to your note name OR to manually verify for this issue in the search result of step 8.
    2. Add OR between each file name and place them on one line. Add your resulting line in a file:() operator.

Example :

note1
note2
note3
note4
"note1"
"note2"
"note3"
"note4"
"note1"
 OR "note2"
 OR "note3"
 OR "note4"
file:("note1" OR "note2" OR "note3" OR "note4")
  1. You now have a query that will return you your files and their attachements. Input it in the Obsidian search.

    • Note: If needed you can add other operator to make sure your only get the notes you want to share
      • Ex. Add -path:(<path to folder with things you do not want to share>) or -tag:(<tags to exclude>)
  2. Once again copy the search result from the Obsidian search. This time, use this config :

    • Show path : On
    • List style : None
    • List prefix : None
  3. Paste it in a new note. We will name it file_list. Note the path of this note on your computer.

  4. Prepare the list :

    • Using multicursor or search and replace, add the missing part of your file path so each of them end up with an absolute path instead of the initial relative path. In other word, add the location of your vault on your computer at the beggining of each line.
      • Ex.: /path_to/file.md => C:\User\rest_of_path_to_vault/path_to/file.md
    • Using search and replace, fix the slashes in your path (/ -> \)
  5. Open a terminal running PowerShell Core 7

    • From my experience regular PowerShell can very well do the job UNLESS your file name includes emojis.
  6. In the terminal, change directory to the location of your file (file_list.md).

Example:

cd "C:\Users\path_to_my_vault\myVault\any_folder_leading_to_file_list.md"
  1. Use the following script and adjust it to your need.
    • Note: This example is configured to copy the notes. If you want to move them instead, replace copy-item by move-item.
      • Be aware that moving notes in Obsidian can be problematic namely if :
        • The names of you notes are not all unique.
        • You are not using the wikilink with the shortest path when possible.
    • Input the location of the folder you want to send these files to after -Destination in double quote as shown bellow.
Get-Content .\file_list.md | Foreach-Object { copy-item -Path $_ -Destination "C:\Users\path_to_folder_to_move_or_copy_files"}
  1. Run the script.

Granted it is somewhat cumbersome so it should not be something you have to do too often but once in a while, when you want to share part of your vault with a high level of precision in selecting the notes, it can be great !

Final note: Keep in mind I putted up this little explaination quickly so their might be some variant/use case I haven't tested that could be problematic (for example see things related to moving notes outside the vault) so be careful before running these and maybe test it first with some dummy notes and do back ups of your files.

I hope it can be of use to some of you !

from quickadd.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.