Jump to content

"Frontmost browser" automations don't work from other active apps

Recommended Posts

I'd like to get the title and url of the active tab in the frontmost browser, using the automation task "Get Current Frontmost Browser Tab".


I expected the automation to detect which browser is frontmost, no matter what app is active, but it doesn't seem to work that way.


For example, if I make a simple workflow with a keyword to trigger "Get Current Frontmost Browser Tab", and trigger it from the Alfred UI, the debugger shows


[Automation Task] Task Error: ../../../../com.alfredapp.automation.core/safari/.common/tabs-current: execution error: Error: Error: Alfred Preferences is not a supported browser: Safari, Webkit, Orion, Google Chrome, Chromium, Opera, Vivaldi, Brave Browser, Microsoft Edge, Arc (-2700)


Is that expected? It seems like it would be more useful for the automation task, and others like it, to find open browsers in the background, find the frontmost one, and get its active tab.

Link to comment

Thanks @Stephen_C. What you described is an example of the issue, but unfortunately not a solution for what I was looking for/expecting, which is that the automation would work even when an app that isn't a browser is active. I'm was trying adapt @dfay's very useful Browser snippets workflow to work with any browser, using Alfred's built-in automations rather than adding a bunch of extra scripting to account for other browsers.


I would have expected "Current Frontmost Browser Tab" to basically:

- determine what browsers are running

- determine which window among those browsers is in front of the others

- return the URL and/or Title of the current tab from that browser window 


This would allow the action to return the active tab of whatever browser I was most recently working with, even if I'm using a different app. Ause case would be to grab the url and title from the tab and paste it into a text document, for example, with one quick keyboard shortcut or snippet.


Instead, "frontmost browser" really seems to mean "frontmost app, which also must be a browser".

Link to comment
5 hours ago, paulw said:

Is that expected?


Correct. On the technical side, this is because AppleScript (needed for the action) can get either the frontmost app or a list of apps, but not a list of app windows in order. It is possible to get a list of app windows in order via other means (I already wrote the code) but when I tested it before it required asking for screen recording permissions so I debated on whether to add it. Testing further, I see I already had made it work without that requirement.

I’ll test a bit more, and if it continues to be viable this improvement will be available in the next Automation Tasks release. If you have auto updates set up, you’ll get the new behaviour without having to do any changes.


Note that as part of an unrelated improvement these will get shorter names for better fitting in the palette. That one will be “Current Front Browser Tab”. But again, you don’t have to do anything, the ones you have will get the new name without your intervention.


Edited by vitor
Link to comment

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...