Created
September 14, 2016 13:28
-
-
Save bhavyaw/17795f2ed64ab2cba76d226f55c9e500 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set windowTitle to "" | |
set currentTabTitle to "" | |
set appID to "" | |
set appName to "" | |
set comments to "" | |
set wins to "" | |
set anyFinderWindowVisible to false | |
tell application "System Events" | |
set frontApp to first application process whose frontmost is true | |
set appName to name of frontApp | |
set appID to unix id of frontApp | |
tell frontApp | |
try | |
tell (1st window whose value of attribute "AXMain" is true) | |
set windowTitle to value of attribute "AXTitle" | |
set appName to name of frontApp | |
set appID to unix id of frontApp | |
end tell | |
on error | |
if exists ( 1st window of frontApp) then | |
set firstWindow to 1st window | |
set windowTitle to name of firstWindow | |
tell (firstWindow whose value of attribute "miniaturized" is true) | |
if appName is "Finder" then | |
set comments to "App Name is indeed finder" | |
try | |
tell application "Finder" to set wins to id of every window whose visible is true | |
on error | |
set comments to "No Visible finder window exists" | |
set windowTitle to "minimized" | |
end try | |
else | |
set comments to "App Name is Some other App" | |
set visible of frontApp to false | |
end if | |
end tell | |
else | |
set visible of frontApp to false | |
end if | |
end try | |
end tell | |
end tell | |
return {comments,wins,windowTitle,appName,appID} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment