In finishing a macro I'm using within Premiere Pro (earlier discussion here), as the last thing the macro does, I want the Finder window that got opened earlier in the macro to close without going to or activating the Finder. I looked for a way in the forum here but no one has ever needed to have this done. I would assume there's a System Event (I don't know what I'm talking about) to just say, "Hey Finder, close that front-most window" while keeping me in Premiere Pro. Probably easy but can't figure it out. Thanks.
Have you tried using Keyboard Maestro to: 1) switch to Finder, 2) close the frontmost window in Finder and then 3) switch back to Premiere Pro? It should happen so fast that to all intents and purposes you haven't left Premiere Pro.
I'm not so sure about that...
In any case:
tell application "Finder" if front window exists then close front window end tell
Execute an AppleScript action.
AppleScript is quite flexible for this task.
Yep, there it is...figured it would be horribly simple but I wasn't sure if maybe there was something native to KM that might've done it...thanks!
Understood, but my curiosity made me want to find out if there was a way to do it without switching apps.
Well, there it is, right in front of me! Duh! Thanks!
Heh. Well, don't feel too bad. That action isn't named "Close Front Window" by default; it's a subset of the Manipulate a Window action's functionality. If you didn't already know about that action, the only way you might stumble across it is with the Insert Action by Name command, and even then, it isn't intuitively obvious:
Yeah, I thought I had looked for "close" and nothing (except closing a CD tray) came up.
I guess that's on KM itself: If I search on close, as in, "I'm trying to find an action related to closing a window" and "Manipulate a Window" comes up, that really seems like an oversight, especially for something so basic. I think this is why there is the occasional rant from newcomers about the steepness of the learning curve. (Note that I would never want KM to get dumbed down, but I do think the Powers That Be might be a little too close to their app to see this type of thing.)
Your point, about the newcomers rants, is well taken and understood. The problem sometimes is people are jumping on a highly developed moving train. I had Keyboard Maestro for about 3 or so years before I joined the forum. So I put some work in and learned most of what I needed via the Keyboard Maestro Wiki Page, going through many menus and action gears. I remember I had the same issue of closing windows. I found it by typing close in the wiki.
When I reached my limits with the wiki, I joined the forum. It felt like I wasted 10 years of knowledge, in that first week. The forum taught/teaches the different experiences and situations (simple and complex) of and from a bunch of the most giving individuals on the internet. As far as the steep learning curve, there are so many different solutions, for each problem, when using powerful software (i.e. Photoshop, Final Cut Pro X, Davinci etc.). I actually enjoy the learning curve. The only thing that I needed more work on was the discipline to except how the developer(s) imagined the usage... then I modified accordingly. With the help of many posts, I have been adjusting quite well.
Just to finish up this thread, I put in close window into the wiki page and will say that technically it gives you the information but from a newbie POV, I'd say there's more of a "technical manual" result rather than a friendly "how to use" approach. I can see a lot of time and effort has gone into it but (just based on my one test) it would be wonderful to have a set of easy-to-view examples after the tech manual wording. (A long time ago, my first "real" job after discovering a BA in philosophy and Masters in History of Religions had no market value outside of academia, was as a technical writer. It reinforced a rule I developed: Assume the reader knows nothing as the starting point.) The wiki is good, really good, but lacks friendliness...again, just based on a quick look. Although I'll try that first before immediately whining to the forum.
Hi @rowan. My suggestion doesn't directly address the issue you pointed out, but to more quickly climb the KM learning curve, consider purchasing Keyboard Maestro Field Guide | MacSparky Field Guides. The author, David Sparks, includes a substantial free preview if you are interested.
You're both right and wrong about this – the wiki's friendliness varies quite a lot.
It changes over time when I (or other moderators, or Peter) get frustrated enough to fix something. We're not unaware of the wiki's shortcomings.
However – Peter is only one guy, and I only have so much time and oomph to donate.
(Keyboard Maestro Moderator)