andy4222 Posted May 30 Share Posted May 30 Trying to trigger File > Tags... for finder via this but it's not working for some reason. I tried using `Tags...` and `Tags…` (ellipsis with ⌥+;) Alfred 5.5 2257 macOS 14.4.1 log: ``` 23:08:49.493] Label Colour Tag[Automation Task] Running task 'Click Menubar Item in Front App' with no arguments [23:08:49.710] ERROR: Label Colour Tag[Automation Task] Task Error (1): /Users/user/Library/Caches/com.runningwithcrayons.Alfred/Workflow Scripts/Automation Tasks/417bcd70c5bad56358be1184939e45491ef292a7c831177fa5e4123d341a9bed: execution error: Error: Error: Can't get object. (-1728) ``` Link to comment
zeitlings Posted May 30 Share Posted May 30 Just an observation: The Menu Bar Search workflow can't find the "Tags..." item either. It looks like you've run into an inconsistency with this particular menu item. Both the Automation Task and the Menu Bar Search workflow failing to interact with it suggests this simply might be an outlier in its behaviour. Aaand some probing seems to confirm it. Apparently the item doesn't even exist 🥲 on run argv tell application "System Events" set finderProcess to a reference to (first application process whose name is "Finder") set fileMenuBar to (a reference to menu 1 of menu bar item "File" of menu bar 1 of finderProcess) --set tagsMenuItem to (first menu item of fileMenuBar whose name begins with "Tags") -- no match set allMenuItems to menu items of fileMenuBar --set probablyTagsMenuItem to item 39 of allMenuItems -- Should be "Tags..." but fails --click probablyTagsMenuItem -- no effect --return set allMenuItemsCount to count of allMenuItems repeat with i from 1 to allMenuItemsCount set menuItem to item i of allMenuItems -- Get the menu item at index i set theName to name of menuItem as text display dialog theName & " - Number: " & (i as text) end repeat end tell end run Link to comment
Stephen_C Posted May 30 Share Posted May 30 …and (perhaps unsurprisingly) Keyboard Maestro has exactly the same problem with that menu item. Stephen Link to comment
vitor Posted May 30 Share Posted May 30 While there is something funky with this menu item (thank you @zeitlings and @Stephen_C for the confirmations), note that the Automation Task is also misconfigured. Apple cares about correct typography, so entries never end in ... (three periods) but with … (one ellipsis, ⌥ + . on my keyboard layout). Link to comment
Stephen_C Posted May 30 Share Posted May 30 2 minutes ago, vitor said: While there is something funky with this menu item Yes… 2 minutes ago, vitor said: Apple cares about correct typography, so entries never end in ... (three periods) but with … I tried that and that didn't seem to work either: so I suspect "funky” may be the correct analysis. 😀 Stephen Link to comment
andy4222 Posted May 31 Author Share Posted May 31 BetterTouchTool - which I use to trigger all menu bar items, also has the same problem. So other way to trigger "Tags" then? (I already tried tags with `...` both ways) Link to comment
Stephen_C Posted May 31 Share Posted May 31 Maybe it's better to look at it in a different way…starting with searching for tags in Automation Tasks. Stephen Link to comment
vitor Posted May 31 Share Posted May 31 3 hours ago, Stephen_C said: starting with searching for tags in Automation Tasks. No can do. Apple doesn’t provide an API to retrieve your custom tags. Link to comment
Stephen_C Posted May 31 Share Posted May 31 (edited) Sorry badly phrased…what I meant was approaching tags from a different angle and exploring what Automation Tasks can do with them. I didn't mean searching for tags, as such! Stephen Edited May 31 by Stephen_C vitor 1 Link to comment
andy4222 Posted May 31 Author Share Posted May 31 I modified the existing workflow that Vitor created and added a script filter for "add" functionality. But then I have to manually update the workflow every time a new tag is added. 🙁 Link to comment
Stephen_C Posted June 1 Share Posted June 1 I think nobody can really help unless, instead of picking on isolated problems, you tell us exactly what you're trying to achieve in general terms. Just describe it in plain English without reference to Alfred's functionality and maybe someone will be able to come up with an idea to assist. Stephen vitor 1 Link to comment
andy4222 Posted June 1 Author Share Posted June 1 Being able to add/remove tags on a file with autocomplete functionality if the tag already was added previously. Link to comment
Stephen_C Posted June 1 Share Posted June 1 59 minutes ago, andy4222 said: Being able to add/remove tags on a file That part is surely relatively straightforward by using a Universal Action (or, indeed, a File Action) linked a relevant Automation Task (List Tags, Add Tags, Clear Tags, Remove Tags, Set Tags—as appropriate). 1 hour ago, andy4222 said: with autocomplete functionality if the tag already was added previously. I've not had the chance to think that through but it must be possible to create either a text file or even an SQLite database of tags you have used against which a comparison might be run. However, that's obviously the icing on the cake. I can't see any significant problem with the first step above, however. Stephen Link to comment
Stephen_C Posted June 1 Share Posted June 1 This is extremely quick and basic but indicates what can be done at the base level: Note: I don't use tags so set something up just to experiment. The Large Type Outputs are solely to show what has happened. Notifications would be rather more sophisticated. Stephen vitor 1 Link to comment
Stephen_C Posted June 1 Share Posted June 1 My simple workflow requires slight refinement when removing all tags, as here: The Conditional is testing for whether {query} is empty. Of course when all tags are cleared the Large Type Output won't display because there'll be nothing to display. Stephen Link to comment
andy4222 Posted June 2 Author Share Posted June 2 Thanks @Stephen_C. I think autocomplete is the important feature here - everything else can be achieved with the Label Colour Tag workflow from the gallery. Like you mentioned, I could dump these tags to a text file and offer them every time in add/remove flows. I'm thinking how can I action on a new item that does not exist in the ones offered by script/list filter. options shown via script filter from text file: new item that doesn't exist in the filter Link to comment
andy4222 Posted June 2 Author Share Posted June 2 Also, I'm curious how is Hazel (file automation app) getting the list of tags automatically from macOS. I added a new tag in finder and it showed up in Hazel magically Link to comment
vitor Posted June 2 Share Posted June 2 3 hours ago, andy4222 said: I'm curious how is Hazel (file automation app) getting the list of tags automatically from macOS. They’re the only ones who can answer that, I encourage you to ask! Hazel runs all the time in the background, so for example they could periodically (or in response to file system events) check tags applied to files and update the database. Or they could be using some feature from macOS which shows that information for free without feeding it back to apps (that interface looks quite similar to a Finder search). Or they could be using a private API. Or they’re using a solution I and the other users who looked at it haven’t found or thought about. Lots of possibilities, all of them speculation, several of them wouldn’t work in this context, none of them can be confirmed except by the source. andy4222 1 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