Add a bookmark via AppleScript?

Is it possible to add a bookmark from an AppleScript? I don’t see bookmarks listed anywhere in the dictionary.

I just realized that the preference setting for “Web page format” controls how the URL record is created in EagleFiler. I guess that begs the question, is it possible for an AppleScript to override that setting when adding items?

If you have a bookmark file, you can use AppleScript to tell EagleFiler to import it, but there is currently no direct way to create a new bookmark from a URL.

It’s not currently possible to override the format via AppleScript, although that’s a feature I plan to add.

As a workaround, you could use AppleScript to construct an appropriate bookmarklet-style URL to tells it to import your URL as a bookmark, and then use AppleScript to tell EagleFiler to open the (bookmarklet) URL.

Good idea. I’ll look in to that.

I supposed I could also temporarily change the preference setting with:

defaults read…
import
defaults write…

but that feels a little risky.

That will work so long as EagleFiler isn’t running when you use “defaults”.

Doh! Yeah, good point.

The other things I’m struggling with are:

  1. EagleFiler can be running with no open databases.
  2. There’s no guarantee that any database will be opened when EagleFiler starts.
  3. There could be multiple databases opened at startup with no particular concept of a default database to put items into.

It makes capturing data highly dependent on the user having EagleFiler set up and ready first.

These don’t seem like problems to me. You can tell EagleFiler, via AppleScript, to open a library, and the import command can target a particular library if you don’t want to use the frontmost one.

That would be fine if this AppleScript were only for me. But when other people use it I won’t know what libraries they have, where they’re located, or which one they want stuff added to. I’ll probably have make the user define their preferred library, which isn’t a huge problem as you say.

FWIW, I’m putting together a tool that lets me capture data while using Windows at work and sends it to my Mac where a folder action script automatically adds it to my “anything bucket”.

I wonder if it would make sense to use Dropbox and save a .url file from your Windows computer into your library’s “To Import” folder.

I am using Dropbox as an optional method for moving the data to the Mac but once it’s there it gets processed by a folder action script. Linking a library’s “To Import” folder directly into Dropbox is not a bad idea. I had already been thinking of dropping things into the To Import folder rather than trying to import them directly. The downside is that I then have no link to the new item. One of the things I’m doing is importing some information and then creating an OmniFocus task to review the information with a link to the item.

BTW, thanks for taking the time to toss out some ideas. I appreciate it.

This is now possible with EagleFiler 1.5.4.