How can I close a finder window using a variable as the name of window

I am trying to create a workflow to open a bunch of apps in the spaces that I want them in. Everything works as I want. Then I thought, what if I change the locations of some of the files in the future? Then I figured that if I put the path to a folder in a variable then all I would have to do is change that variable and the appropriate actions would use that particular path.

It works fine for opening that folder but when it tries to close the folder it gives me an error saying:
"Manipulate window could not find any matching windows in macro "path variable test" (while executing close window named "%Variable%Dbase folder location%".

So the core of my problem is how do I use a variable to specify which folder I want to close using Manipulate Window?

For more/better help, you need to upload your macro .
For more info, see Manipulate a Window action

You Can Identify the Window by:

  • the front window.
  • the window with title.
  • windows with title containing.
  • windows with title matching regular expression.
  • the window with window index (Z-order, negative windows order from the back (eg -1 is last window)).

Thanks for your help. I just thought it odd that you can open a window using a variable but not the converse.

Oh well, lesson learned.

This is NOT correct.
Close a Window using its title in a Variable: