Jump to content
Sign in to follow this  
tengwer

win app viewable area question

Recommended Posts

tengwer

I wrote a script that allows you to indirectly change the color of the viewing area background in apps such as internet explorer, Word, notepad etc. It works by making the app semitransparent and then putting a colored gui screen behind it that is the size of the area that is viewed (area where you type or view web page). I determined the viewing area size by starting with the client area size and then adjusting it to account for the scroll bar and toolbar area at top. two questions:

1) Is there a way to determine more directly the size and position of the viewable area?

2) Even better is there a way to directly change the color of the background of various apps without having to resort to the method above?

The script I have is as follows:

#include <Misc.au3>

#include <WindowsConstants.au3>

#include <GUIConstantsEx.au3>

Opt("WinTitleMatchMode", 2)

HotKeySet("^+b", "Refresh")

HotKeySet("{Esc}", "Close")

Global $Color

GUIDelete()

Run('"C:\Utilitys\AutoIt3\AutoIt3.exe" "C:\Reference\Logos4\Color Picker On Top.au3"')

$Color = _ChooseColor(2, $Color, 2)

;Exit

Send("!{Tab}")

Sleep(1000)

Global $WinTitle = WinGetTitle("[Active]")

Sleep(1000)

WinSetTrans($WinTitle, "", 220)

WinSetOnTop($WinTitle, "", 1)

;MsgBox(0,"",""&$WinTitle&"")

$ScrollBarWidth = 19

$ToolBarHeight = 113

$Pos = WinGetPos($WinTitle)

$GUI = GUICreate("", $Pos[2] - $ScrollBarWidth, $Pos[3] - $ToolBarHeight , $Pos[0], $Pos[1] + $ToolBarHeight, $WS_POPUP, $WS_EX_TOOLWINDOW + $WS_EX_TOPMOST + $WS_EX_TRANSPARENT)

GUISetBkColor($Color)

GUISetState()

WinActivate($WinTitle)

Func Refresh()

GUIDelete()

Run(""&@AutoItExe&" """&@ScriptDir&"\Color Picker On Top.au3""")

$Color = _ChooseColor(2, $Color, 2)

Global $WinTitle = WinGetTitle("[Active]")

Sleep(1000)

WinSetTrans($WinTitle, "", 220)

;MsgBox(0,"",""&$WinTitle&"")

$ScrollBarWidth = 19

$ToolBarHeight = 113

$Pos = WinGetPos($WinTitle)

$GUI = GUICreate("", $Pos[2] - $ScrollBarWidth, $Pos[3] - $ToolBarHeight , $Pos[0], $Pos[1] + $ToolBarHeight, $WS_POPUP, $WS_EX_TOOLWINDOW + $WS_EX_TOPMOST + $WS_EX_TRANSPARENT)

GUISetBkColor($Color)

GUISetState()

WinActivate($WinTitle)

EndFunc ;==>Refresh

Func Close()

GUIDelete()

WinActivate($WinTitle)

WinWaitActive($WinTitle)

WinSetTrans($WinTitle, "", 255)

WinSetOnTop($WinTitle, "", 0)

Exit

EndFunc ;==>Close

While 1

$State = WinGetState("Windows Internet Explorer")

If BitAND($State, 16) Then GUISetState(@SW_HIDE)

If Not BitAND($State, 16) Then

GUISetState(@SW_SHOW)

WinActivate($WinTitle)

EndIf

Sleep(1000)

WEnd

Share this post


Link to post
Share on other sites
whim

Maybe WinGetClientSize ?

whim

Share this post


Link to post
Share on other sites
tengwer

Maybe WinGetClientSize ?

whim

As I mentioned I already do that but I don't want the client size as this includes the toolbar area. I need to get just the viewing area such as where you type in Word or view a web page.

Share this post


Link to post
Share on other sites
GEOSoft

That area will generally be a control and if you can identify the control then take a look at ControlGetPos() elements 2 and 3.


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites
tengwer

That area will generally be a control and if you can identify the control then take a look at ControlGetPos() elements 2 and 3.

Thanks for the reply. I read the warning but don't know what it means (Please wait at least 24 hours before bumping your thread -- Consider yourself warned.) Could you explain please?

Tim

Share this post


Link to post
Share on other sites
GEOSoft

Thanks for the reply. I read the warning but don't know what it means (Please wait at least 24 hours before bumping your thread -- Consider yourself warned.) Could you explain please?

Tim

Thats just a warning for people who are too impatient to wait for a reply and keep bumping up the post to keep it near the top of the forum. It will invariably lead to one or more of the following.

  • Poster being "flamed" for "bumping" the post
  • Thread being locked
  • Poster being banned (depending on how they react to the first two)

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites
tengwer

Thats just a warning for people who are too impatient to wait for a reply and keep bumping up the post to keep it near the top of the forum. It will invariably lead to one or more of the following.

  • Poster being "flamed" for "bumping" the post
  • Thread being locked
  • Poster being banned (depending on how they react to the first two)
I'll keep that in mind for the future.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×