The Omni Group Forums

The Omni Group Forums (http://forums.omnigroup.com/index.php)
-   AppleScripting Omni Apps (http://forums.omnigroup.com/forumdisplay.php?f=46)
-   -   Scripting to work with Lion's full screen window. (http://forums.omnigroup.com/showthread.php?t=23211)

RobTrew 2012-01-13 08:19 AM

Scripting to work with Lion's full screen window.
 
Traditional references to the 'front window' of Omni apps will now fail on Lion if it is in full screen mode.

The case of OmniFocus has been helpfully dealt with in [URL="http://forums.omnigroup.com/showthread.php?t=22468&highlight=lion+front+window"]this post[/URL], which suggests:

[CODE]tell application "OmniFocus"
tell first document window of front document
...
end tell
end tell[/CODE]

I think that the following approach should work for OmniGraffle and OmniOutliner in both 10.6 and 10.7 (full screen or otherwise).

[CODE]set winOG to GetFrontWin("OGfl")

set winOO3 to GetFrontWin("OOut")


on GetFrontWin(strAppID)
tell application id strAppID
if my isFullScreen(strAppID) then
window 2
else
window 1
end if
end tell
end GetFrontWin

on isFullScreen(strAppID)
tell application "Finder" to set blnPreLion to (version < "10.7")
if blnPreLion then
return false
else
tell application id "sevs"
set lstApps to application processes where creator type = strAppID
if length of lstApps < 1 then return false
set lstWins to windows of first item of lstApps
if length of lstWins < 1 then return false
return value of attribute "AXFullScreen" of item 1 of lstWins
end tell
end if
end isFullScreen[/CODE]


All times are GMT -8. The time now is 08:47 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.