-
-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix System Events got an error: Can't get window 1 of process whose value of attribute \"AXMain\" = true
- Loading branch information
Maigo Erit
committed
Feb 21, 2017
1 parent
f9190e1
commit 4446bf8
Showing
4 changed files
with
74 additions
and
50 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
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,14 +1,20 @@ | ||
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 | ||
tell (1st window whose value of attribute "AXMain" is true) | ||
set windowTitle to value of attribute "AXTitle" | ||
end tell | ||
end tell | ||
end tell | ||
set windowTitle to "NO_TITLE_FOUND" | ||
try | ||
tell application "System Events" | ||
set frontApp to first application process whose frontmost is true | ||
set frontAppName to name of frontApp | ||
tell process frontAppName | ||
if exists (1st window whose value of attribute "AXMain" is true) then | ||
tell (1st window whose value of attribute "AXMain" is true) | ||
set windowTitle to value of attribute "AXTitle" | ||
end tell | ||
end if | ||
end tell | ||
end tell | ||
on error errorMsg | ||
set windowTitle to errorMsg | ||
end try | ||
|
||
return {frontAppName, windowTitle} |
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,6 +1,6 @@ | ||
{ | ||
"name": "Tockler", | ||
"version": "2.4.0", | ||
"version": "2.4.3", | ||
"description": "Automatically track applications usage and working time", | ||
"main": "app.js", | ||
"author": "Maigo Erit <[email protected]>", | ||
|
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