Files
munki/code/MunkiStatus/MunkiStatus.applescript
2009-05-18 20:18:32 +00:00

87 lines
2.7 KiB
AppleScript
Executable File

-- MunkiStatus.applescript
-- MunkiStatus
-- Created by Greg Neagle on 4/17/09.
--
-- Copyright 2009 Greg Neagle.
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
on clicked theObject
if the name of theObject is "stopBtn" then
set the state of theObject to 1
set enabled of theObject to false
end if
end clicked
--#define kCGNormalWindowLevel 0
--#define kCGStatusWindowLevel 25
--#define kCGScreenSaverWindowLevel 1000
property kCGNormalWindowLevel : 0
property kCGStatusWindowLevel : 25
property kCGScreenSaverWindowLevel : 1000
on awake from nib theObject
if name of theObject is "backdropWindow" then
copy "" to cfuser
copy (call method "consoleUser") to cfuser
if cfuser is "" then
call method "setCanBecomeVisibleWithoutLogin:" of theObject with parameter 1
call method "setLevel:" of theObject with parameter (kCGStatusWindowLevel)
copy (call method "mainScreenRect") to screenRect
call method "setFrame:display:" of theObject with parameters {screenRect, true}
try
tell application "System Events"
set DesktopPicture to value of property list item "DesktopPicture" of property list file "/Library/Preferences/com.apple.loginwindow.plist"
if exists (POSIX file DesktopPicture as file) then
--do nothing; just trying to trigger an error
end if
end tell
on error
set DesktopPicture to "/Library/Desktop Pictures/Aqua Blue.jpg"
end try
set bgPicture to load image DesktopPicture
set contents of image view "imageFld" of theObject to bgPicture
show theObject
end if
end if
if name of theObject is "mainWindow" then
-- Leopard is picky about what we can display over the loginwindow
call method "setCanBecomeVisibleWithoutLogin:" of theObject with parameter 1
--if we are in the loginwindow context, we need to set the window level so
--it displays above the loginwindow
copy "" to cfuser
copy (call method "consoleUser") to cfuser
if cfuser is "" then
call method "setLevel:" of theObject with parameter (kCGScreenSaverWindowLevel - 1)
end if
set visible of theObject to true
activate
end if
end awake from nib
on resigned active theObject
copy "" to cfuser
copy (call method "consoleUser") to cfuser
if cfuser is "" then
tell me to activate
end if
end resigned active