window area focus

I know that ‘Preview’ isn’t scriptable (i’m on OS 10.6). But sometimes you can get pretty nice results coding some workarounds.
So, my questions is if i can get any infos on which window area application ‘Preview’ is currently focused:

main window area
column area (cmd+shift+d)

my first approach is :

tell application "System Events" to tell process "Preview"
		set nrw to number of windows
		if nrw > 0 then
			tell window 1
				--properties
			end tell
		end if
end tell

but then i need to work with raw code, where i’m not practical. Some hints?

Something like this for size – column width is not available among the properties

tell application "System Events" to tell process "Preview"
	activate
	set nrw to number of windows
	if nrw > 0 then
		tell window 1
			set SZ to size
		end tell
	end if
end tell

Hi Adam,
thanks nevertheless. Not that i get fancy to code for non-scriptable apps, but have you an idea where i can study a bit of raw-coding ? i remember you wrote a very useful tutorial about mdfind using raw-code in another situation. I think, in my case is unlikely that i’ll find something useful to solve my problem. This time its really too nested stuff.

Get the focussed element of the application and get it’s parent until you get the main window area or the column area.

tell application "System Events"
	tell application process "Preview"
		if number of windows < 1 then
			return "Application"
		end if
		tell splitter group 1 of window 1
			if number of scroll areas = 1 then
				-- the column area isn't visible
				return "Main window area"
			end if
			set mainWindowArea to scroll area 1
			set columnArea to scroll area 2
		end tell
		set anElement to value of attribute "AXFocusedUIElement"
		repeat
			if anElement = mainWindowArea then
				return "Main window area"
			else if anElement = columnArea then
				return "Column area"
			else if anElement = it then
				return "Application"
			end if
			set anElement to value of attribute "AXParent" of anElement
		end repeat
	end tell
end tell