G’day
I’ve written a mad method of getting a screens resolution, but it returns a Y value 22 pixels more than the screens supposed resolution, on a 23" LCD monitor. Why, is what I’d like to know?
-- Screen Sizer
--- Not Bloody Copyright
-- 2006
-- 'Rough as Guts Software'
-- By Santa
global ReturnIconsToPosition
set ReturnIconsToPosition to {}
global thelist
global MaxX
global MaxY
set MaxX to 0
set MaxY to 0
my SavePositions()
my MovePositions()
my ReplacePositions()
display dialog "Your monitor has an addressable desktop of " & MaxX & " by " & MaxY buttons "That was easy."
on SavePositions()
tell application "Finder"
try
select every item of the desktop
set thelist to (selection as list)
if number of items of thelist = 0 then
display dialog "I need an icon to work." buttons {"Cancel"}
quit me
end if
set end of ReturnIconsToPosition to desktop position of item 1 of thelist
close window "Desktop"
end try
end tell
end SavePositions
on MovePositions()
tell application "Finder"
try
set x to 0
set distribute to item 1 of thelist
set temp to {780, 480}
set the desktop position of distribute to temp
set newMaxX to 781
set newMaxY to 481
set increment to 10
repeat while increment ≥ 1
repeat
if newMaxX > MaxX then
set MaxX to newMaxX
set item 1 of temp to (item 1 of temp) + increment
else
set item 1 of temp to (item 1 of temp) - increment
exit repeat
end if
set the desktop position of distribute to temp
set NewPosition to desktop position of distribute
set newMaxX to item 1 of NewPosition
end repeat
set increment to increment - 1
set MaxX to MaxX - increment
end repeat
set increment to 10
repeat while increment ≥ 1
repeat
if newMaxY > MaxY then
set MaxY to newMaxY
set item 2 of temp to (item 2 of temp) + increment
else
set item 2 of temp to (item 2 of temp) - increment
exit repeat
end if
set the desktop position of distribute to temp
set NewPosition to desktop position of distribute
set newMaxY to item 2 of NewPosition
end repeat
set increment to increment - 1
set MaxY to MaxY - increment
end repeat
end try
end tell
end MovePositions
on ReplacePositions()
tell application "Finder"
try
set desktop position of item 1 of thelist to item 1 of ReturnIconsToPosition
end try
end tell
end ReplacePositions
Model: G5 1.8 GHz
AppleScript: 2.1.1
Browser: Safari 419.3
Operating System: Mac OS X (10.4)