paulw Posted Monday at 06:21 PM Share Posted Monday at 06:21 PM 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
Stephen_C Posted Monday at 07:50 PM Share Posted Monday at 07:50 PM I wonder whether in fact your Alfred Preferences are, at the time you're running the workflow, the frontmost app. Make sure the current browser tab you want really is the frontmost app when you run the workflow. Does that help at all? Stephen Link to comment
paulw Posted Monday at 08:48 PM Author Share Posted Monday at 08:48 PM 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
vitor Posted Monday at 11:33 PM Share Posted Monday at 11:33 PM (edited) 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 Monday at 11:35 PM by vitor Link to comment
paulw Posted Tuesday at 01:29 AM Author Share Posted Tuesday at 01:29 AM Thanks for the reply and explanation, @vitor! 1 hour ago, vitor said: I’ll test a bit more, and if it continues to be viable this improvement will be available in the next Automation Tasks release Great to hear, I'll look forward to it! Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now