Hi all, I'm struggling with, ultimately, trying to use a dictionary with an If Then Else condition. Am posting here for troubleshooting help, because for the life of me I can't work out why this macro's not working the way I'd like it to...
Background: I've recently adapted @BKannerBKannerBKannerBKanner's Favorite Finder Directories macro into my workflow. Partly so I can categorise list prompts (which I was doing before with many ludicrously long Switch action lists), but mainly just to make the macros themselves easier to maintain, given that I am definitively Not A Coder and the whole thing is held together mainly with guesswork.
Part of my existing workflow involves opening Finder windows in certain ways, depending on the file path/window title, like so:
-
if that path is already open in Finder, bring that tab to the front and reposition the window to e.g. bottom-right sixth desktop area;
-
if there's a Finder window open in that desktop area to a different path but not the desired one, open a new tab in the existing window;
-
if there's no Finder window *or* there's just no Finder window in that area (e.g. there's one in upper-right sixth), open the path in a new window.
Is all this perhaps slightly ridiculous? Yes, obviously. But it helps me keep a. my desktop and windows lists tidy, b. my sanity (in theory).
Currently, this is all dictated by a series of nested If Then Else actions, which currently have ever-growing lists of window titles hard-coded in as conditions (e.g. 'if a window title matches x, do y'). Inspired by my dictionary adventures, I'd hoped to put these window title lists into dictionaries, then use For Each to create a Lines collection with a variable (as in the FFD macro), and check each line against the currently open window titles using the per-line variable in the If Then Else action. Which seems like it should be possible?
Except... no matter where I position the If The Else action in relation to the For Each action, I can't get the macro to work properly. Specifically: if there's an existing file path open in the desired window area, it will always move to a new window instead of opening in a new tab, i.e. the exact opposite of what I want it to do. Here’s what one of them (the least chaotic) currently looks like: what does it need to be?
I'm guessing this will ultimately be something simple, but after everything from regex errors (no idea) to the 'bring to front' action visibly looping for ages and *still* ultimately opening in a new window, I'm admitting defeat. Um... help, please? ![]()






