-
-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
try to fix error: Can’t get window 1 of process . Invalid index
- Loading branch information
Maigo Erit
committed
Jan 8, 2017
1 parent
5a6906e
commit 761b237
Showing
2 changed files
with
17 additions
and
8 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,15 @@ | ||
global frontApp, frontAppName, windowTitle | ||
set windowTitle to "" | ||
global frontApp, frontAppName, windowTitle | ||
|
||
set windowTitle to "" | ||
tell application "System Events" | ||
|
||
set frontApp to first application process whose frontmost is true | ||
set frontAppName to name of frontApp | ||
|
||
tell process frontAppName | ||
set windowTitle to title of 1st window | ||
end tell | ||
set frontApp to first application process whose frontmost is true | ||
set frontAppName to name of frontApp | ||
tell process frontAppName | ||
tell (1st window whose value of attribute "AXMain" is true) | ||
set windowTitle to value of attribute "AXTitle" | ||
end tell | ||
end tell | ||
end tell | ||
|
||
return {frontAppName, windowTitle, frontApp} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/bash | ||
for i in `seq 1 5`; | ||
do | ||
echo $i | ||
echo `osascript get-foreground-window-title.osa` | ||
sleep 1 | ||
done |