Chris wrote:
I tried it too; it's great. I think a tiny improvement is possible. For your mouse button hotkeys, you could define them this way instead (to avoid the need for GetKeyState):
^+MButton::
^+WheelDown::
^+WheelUp::
Thanks, Chris ! I always specify modifiers this way when combined with keys, but for some reason I didn't think of it when working with mouse buttons...
Regarding application lockups, I think they occur on executing "WinSet Transparent", but I was unable to reproduce them.
I have tested the script with TS Client and Citrix in XP and it worked fine with both, but maybe things are different in Win2k ? Does anyone encounter a problem similar to Wingfat's ?
Also, I noted that cmd.exe ignores transparency ; it seems this is by design.
Here is an updated version with some simplifications in the fading code :
Code:
#SingleInstance Force
#MaxThreadsPerHotkey 10
SetBatchLines, -1
AutoTrim, Off
AlphaIncrement = 8.5
^+MButton::
Gosub, WinGetTransparency
Gosub, WinSetTransparency
Gosub, ShowTransparencyToolTip
Return
^+WheelDown::
Gosub, WinGetTransparency
Trans0 -= 10
Gosub, WinSetTransparency
Gosub, ShowTransparencyToolTip
Return
^+WheelUp::
Gosub, WinGetTransparency
Trans0 += 10
Gosub, WinSetTransparency
Gosub, ShowTransparencyToolTip
Return
WinGetTransparency:
MouseGetPos, , , WindowID
If Trans_%WindowID% =
{
Trans_%WindowID% = 100
}
StringTrimRight, Trans, Trans_%WindowID%, 0
Trans0 = %Trans%
Return
WinSetTransparency:
WinGetClass, WindowClass, ahk_id %WindowID%
If WindowClass = Progman
{
Trans0 = 100
}
Else If Trans0 < 10
{
Trans0 = 10
}
Else If Trans0 > 100
{
Trans0 = 100
}
a = %Trans%
b = %Trans0%
Trans = %Trans0%
Trans_%WindowID% = %Trans%
If WindowClass = Progman
{
Return
}
a *= 2.55
Alpha0 = %a% ; Init. Alpha
b *= 2.55
Alpha = %b%
Transform, Alpha, Round, %Alpha% ; Final Alpha
c = %Alpha%
c -= %Alpha0%
d = %AlphaIncrement%
If c < 0
{
d *= -1
} ; Signed increment
Transform, c, Abs, %c% ; Abs. iteration range
Loop
{
Transform, Alpha0, Round, %Alpha0%
WinSet, Trans, %Alpha0%, ahk_id %WindowID%
If Alpha0 = %Alpha%
{
Break
}
Else If c >= %AlphaIncrement%
{
Alpha0 += %d%
c -= %AlphaIncrement%
}
Else
{
Alpha0 = %Alpha%
}
}
Return
ShowTransparencyToolTip:
e = %Trans%
e /= 4
f = 25
f -= %e%
ToolTipText = Opacity :%A_Space%
Loop, %e%
{
ToolTipText = %ToolTipText%|
}
If e > 0
{
ToolTipText = %ToolTipText%%A_Space%
}
ToolTipText = %ToolTipText%%Trans%`%
If f > 0
{
ToolTipText = %ToolTipText%%A_Space%
}
Loop, %f%
{
ToolTipText = %ToolTipText%|
}
ToolTip, %ToolTipText%
MouseGetPos, MouseX0, MouseY0
SetTimer, RemoveToolTip
Return
RemoveToolTip:
If A_TimeIdle < 1000
{
MouseGetPos, MouseX, MouseY
If MouseX = %MouseX0%
{
If MouseY = %MouseY0%
{
Return
}
}
}
SetTimer, RemoveToolTip, Off
ToolTip
Return
Chris wrote:
If you would like me to post this in the
script showcase I'll make a note to do so.
Sure, I'd be honored
