After copy and pasting the script, it first did not work, but then I noticed that the single and double quotes in the script got mangled when the code was posted to the forum. Here is a fixed version for anyone else interested in trying this out:
let bookmarkName = "Obsidian"
let fm = FileManager.iCloud()
if(fm.bookmarkExists(bookmarkName)) {
let folder = fm.bookmarkedPath(bookmarkName)
let files = fm.listContents(folder)
files.forEach(f)
function f(name) {
let filePath = fm.joinPath(folder, name)
fm.downloadFileFromiCloud(filePath)
}
return ("Bookmark '" + bookmarkName + "' found\n\n" + "Files found:\n" + files)
} else {
return "Bookmark '" + bookmarkName + "' not found"
}
Script.complete()
I just got it working, so I donât have a sense yet, to what extent it will actually reduce/eliminate the âWaiting for iCloud to synchronizeâ wait times for me, but I donât see why it wouldnât. Iâm very glad I found this thread.
For anyone else trying this out:
The script looks like itâs supposed to display either a âBookmark âObsidianâ not foundâ message or a list of the files that it found. Those messages are only shown, however, when you run the script from inside the Shortcuts app (i.e., by pressing the little blue âplay iconâ button in the bottom right while editing the Run inline script action). When the actual automation is triggered, you only get a generic âRunning your automationâ notification, which is preferable anyway, because the point of the script is only to trigger an iCloud sync for the Obsidian folder.
@einfachJens@BeR Iâm not seeing the Obsidian folder in my iphone (possibly because I chose icloud to store the vault from the start in Osidian app. Am I missing something?