Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Use Xbench to fix screen burn-in' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Use Xbench to fix screen burn-in
Authored by: regulus on Jan 29, '09 12:47:33PM

In my effort to fix my screen problem I wrote this applescript to make running the test multiple times easy. Maybe some of you will find it useful. Instructions for how to use the script are included. My screen problem wasn't fixed unfortunately, but I think it's different than the problem described here.

-- this will run the graphics test in xbench in an effort to fix lcd screen burn-in
-- I found this solution on Mac OS X Hints here: http://www.macosxhints.com/article.php?story=20090123111428872#comments
-- the Xbench application can be found here: http://www.xbench.com/

-- How to use this script:
-- you don't have to do anything to set up the Xbench application. The script does everything for you.
-- look at the "variables to change" section of the script and adjust the 3 variables as you want
-- variable timesToRunTest: the number of times to run the quartz graphics test in Xbench
-- variable shouldCloseStatusWindows: set to true or false, as each graphics test is run, the xbench program opens a status window with the results of the ongoing graphics test. This script will automatically close those windows when the number of tests you indicated are completed. You can change this behavior by changing the value of the variable shouldCloseStatusWindows to false.
-- variable myDelay: if the script doesn't work properly then try changing the value of the variable myDelay to a bigger value. This is the delay in seconds that the script waits between doing some actions, so giving the script more time may solve your problem. You may also want to shorten the delay time to make the script run a little faster.
-- during the running of the tests, you can move the graphics test window anywhere you need on your screen and the script will remember that position so that subsequent tests will open their graphics test windows in the same position. Put the window where you want to fix the LCD screen.

-- variables to change
set timesToRunTest to 20
set shouldCloseStatusWindows to true
set myDelay to 0.5

property windowPosition : null

-- make sure access for assitive devices is enabled
enable_GUI_scripting()

tell application "Xbench" to launch
delay 1
tell application "System Events"
	tell process "Xbench"
		-- setup the buttons of the xbench window to only perform the quartz graphics test
		if value of attribute "AXValue" of checkbox "CPU Test" of window "Xbench" is 1 then
			click checkbox "CPU Test" of window "Xbench"
		end if
		if value of attribute "AXValue" of checkbox "Thread Test" of window "Xbench" is 1 then
			click checkbox "Thread Test" of window "Xbench"
		end if
		if value of attribute "AXValue" of checkbox "Memory Test" of window "Xbench" is 1 then
			click checkbox "Memory Test" of window "Xbench"
		end if
		if value of attribute "AXValue" of checkbox "Disk Test" of window "Xbench" is 1 then
			click checkbox "Disk Test" of window "Xbench"
		end if
		if value of attribute "AXValue" of checkbox "Quartz Graphics Test" of window "Xbench" is 0 then
			click checkbox "Quartz Graphics Test" of window "Xbench"
		end if
		if value of attribute "AXValue" of checkbox "OpenGL Test" of window "Xbench" is 1 then
			click checkbox "OpenGL Test" of window "Xbench"
		end if
		if value of attribute "AXValue" of checkbox "User Interface Test" of window "Xbench" is 1 then
			click checkbox "User Interface Test" of window "Xbench"
		end if
		
		-- run the test the appropriate number of times
		repeat with i from 1 to timesToRunTest
			-- start the test
			delay myDelay
			click button "Start" of window "Xbench"
			
			-- move the window to the correct position
			delay myDelay
			try
				if windowPosition is not null then
					set position of window "Graphics Test" to windowPosition
				end if
			end try
			
			-- delay the script until the graphics test is finished
			delay myDelay
			repeat
				set namesList to name of windows
				if namesList does not contain "Graphics Test" then
					exit repeat
				else
					try
						set windowPosition to position of window "Graphics Test"
					end try
				end if
				delay 1
			end repeat
		end repeat
		
		-- close all of the results windows
		if shouldCloseStatusWindows then
			delay myDelay
			set namesList to name of windows
			repeat with aName in namesList
				if aName contains "Untitled" then
					click button 1 of window aName
					delay 0.2
					click button "Don't Save" of sheet 1 of window aName
					delay 0.2
				end if
			end repeat
		end if
	end tell
end tell

on enable_GUI_scripting()
	if (system attribute "sysv") < 4138 then display dialog "This script requires the installation of Mac OS X 10.3 or higher." buttons {"Cancel"} default button 1 with icon 2
	tell application "System Events" to if not UI elements enabled then
		tell me to display dialog "This script requires the built-in Graphic User Interface Scripting architecture of Mac OS X, which is currently disabled." & return & return & "Enable GUI Scripting now? (You may be asked to enter your password.)" buttons {"Cancel", "Enable"} default button 2 with icon 2
		set UI elements enabled to true
		if not UI elements enabled then error number -128
	end if
end enable_GUI_scripting


[ Reply to This | # ]