Jump to content

AlfredBookmarklet — Use a browser bookmarklet via Alfred


Recommended Posts

Update:

  • It now auto-detects your frontmost browser, and acts on it.
  • Added support for Safari Technology Preview.
  • New icon.
  • Updated instructions.


To update, download the latest version (same URL).
 

Link to post

Update.


Code is now pasted in an Arg and Vars. I figure that’ll be less intimidating that pasting it together with other code, where mistakes are easier to happen. Also added a note on Safari and variants.


To update, download the latest version (same URL) or wait a few days (15 or less) and it’ll prompt you to on next usage, since it uses OneUpdater.

Link to post
  • 4 weeks later...

This is such a great workflow, vitor. Thanks for making such great stuff. I'm now using it for Slicereader. A couple of years ago I wasn't able to get it to work, but the updated workflow makes it magically work. Now, when I want to read an article online, all I have to do is trigger Alfred, type 'read', then Slicereader opens and I can concentrate and read. Now I just wish Slicereader imported GIFs in addition to text/images. 

Link to post
  • 4 months later...

Yeah I read your explanation about that, sorry if I sounded obnoxious. And you are right, that's what I'm mostly interested. But if we ditch the "read from browser" thing, maybe an easier way to add bookmarklets and be sure they stick somewhere between updates/reinstalls?

Edit: Also, just a way to search for them without entering a specific keyword/trigger, just a global search.

Edited by limacohen
Added feature requests
Link to post
1 hour ago, limacohen said:

And you are right, that's what I'm mostly interested.

 

Then I don’t intend to build that into the Workflow, for the reasons described earlier. The code is open, however, so you’re free to do so.

 

1 hour ago, limacohen said:

maybe an easier way to add bookmarklets

 

How? I’m open to that, but if I’d already though of an easier way to do it I’d have already done it (unless the drawbacks were bigger).

 

1 hour ago, limacohen said:

and be sure they stick somewhere between updates/reinstalls?

 

I’m not sure what you’re talking about. I have multiple bookmarklets built this way and they’ve always came with me through clean reinstalls of the whole system. They’re synced like every other Workflow.

 

1 hour ago, limacohen said:

Also, just a way to search for them without entering a specific keyword/trigger, just a global search.

 

Alfred doesn’t provide such global search. And the way you’re describing it there’d need to be multiple bookmarklets in the same Workflow, interacting with one of the filters Alfred provides. Seeing as bookmarklets are user-added, there’s no way I could build that into the Workflow, as I can’t predict what users will add. That method would make adding to the Workflow harder, not easier, with extra steps.

 

Looks to me like what you want is fundamentally different from this Workflow. The part you like about it is that it runs bookmarklets, and that’s easy to replicate if you extract the code. But the other part — how it’s built to call said bookmarklets — is so alien to the way it’s currently constructed it’s a whole different Workflow.

Link to post

Yeah it's probably radically different. What I meant by "global search" would be indeed just a filter to look up within the already added bookmarklets, but as it stands now I understand how that can't be accomplished. I was hoping you could see something I could be missing. Guess I'll give it a try and work something from ~scratch~, probably reuse (and credit) some of your code to actually send the JS to the browser. Thank you again for this workflow and taking your time answering (:

Link to post
7 minutes ago, deanishe said:

Are we talking about Safari here?

 

I have a workflow for Safari that handles bookmarks amongst other  things. It understands bookmarklets, although I haven’t implemented the front-end yet.

 

Chrome in my case (actually Vivaldi but same thing).

Link to post
4 hours ago, Vero said:

@limacohen Welcome to the forum. Could you please fill in your Powerpack email address in your forum profile? This is only visible to admins and allows us to confirm your Powerpack status, as you're asking Powerpack-specific questions. :)

 

Cheers,
Vero

 

Hi! Done. Sorry I missed that guideline.

 

Cheers!

Link to post
  • 4 months later...

I have found this workflow very useful. For example:

In github commit the edited file:      document.getElementById('submit-file').click();. 

 

I am totally unfamiliar with javascript, Is there also an option to  "EDIT" the file in github?

 

If so what would be the command?

 

Help is highly appreciated.

 

 

P.S. Where can I find some commands like: document.getElementById('submit-file').click();.  online ?

These commands are new to me.

Link to post
19 hours ago, Bhishan said:

Is there also an option to  "EDIT" the file in github?

 

That will be more complex.

 

19 hours ago, Bhishan said:

P.S. Where can I find some commands like: document.getElementById('submit-file').click();.  online ?

 

By learning about JavaScript and the DOM. Those aren’t pre-built commands, you need to learn what they mean to build something custom. Unfortunately, that falls way out of scope. Stack Overflow is the appropriate place for this kind of question, but don’t mention Alfred or this Workflow, as that will only breed confusion. Ask of it like building a browser bookmarklet (“How to make browser bookmarklet to edit file in Github”).

Link to post
  • 4 weeks later...

I would just like to add my 2cents here. Whenever, I scroll down a long markdown or script file in github, I see something off and needs to edit it. Then I have to scroll back to top and then click the edit button. That is tedious and I found a better way of doing it using Alfred.

 

We can use AlfredBookmarklet with following command:

document.querySelector('[aria-label="Edit this file"]').click();

 

Hope it would be beneficial for others too.

Edited by vitor
Use proper code block
Link to post
  • 5 months later...
1 minute ago, romebot said:

I'm stuck on this step: :cleanbookmarkletcode ... nothing happens when I enter that into alfred

 

It happens in the background after you action it. You don’t need to do anything else.

 

7 minutes ago, romebot said:

I want to use this for a raindrop bookmarklet in firefox. will it work?

 

Not in Firefox, because it doesn’t support AppleScript. If the bug tracking that omission were a person, it would be old enough to vote. If you want that to be changed, make your voice heard on that page. If you need any kind of outside automation from your browser, you’ll have to ditch Firefox.


It should work in almost every other browser, though, because Firefox is the only major browser that doesn’t support AppleScript (many of the small ones support it as well, because they get it for free from Chromium).

 

12 minutes ago, romebot said:

p.s. i dont understand this. I think it's only safari related, but not sure: "Note that you may need to Allow JavaScript from Apple Events in your Browser. "

 

Most browsers have a variant of the option now. Not Firefox, for the reason mentioned above.

Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...