Home | Blog | Software | Reviews and Features | Forum | Help | Donate | About us
topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • December 17, 2017, 06:08 AM
  • Proudly celebrating 10 years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: Transparent windows with AHK what am I doing wrong?  (Read 6765 times)

nite_monkey

  • Member
  • Joined in 2006
  • **
  • Posts: 736
    • View Profile
    • Just Plain Super
    • Read more about this member.
    • Donate to Member
Transparent windows with AHK what am I doing wrong?
« on: August 30, 2008, 03:01 PM »
I'm trying to make an AHK script that will let me change how transparent a window is.
This script works, but it randomly decides to mess up.

CapsLock & WheelDown::
{
WinGetActiveTitle, cwindow
WinGet, tp, Transparent, %cwindow%
tp := tp-10
WinSet, Transparent, %tp%, %cwindow%
Return
}

CapsLock & WheelUp::
{
WinGetActiveTitle, cwindow
WinGet, tp, Transparent, %cwindow%
tp := tp+10
WinSet, Transparent, %tp%, %cwindow%
Return
}

Rwin & LWin::
{
WinGetActiveTitle, cwindow
WinSet, Transparent, Off, %cwindow%
Return
}

That is my script.
The problem is sometimes when ever I change active windows and then push the capslock and scroll down, it makes the active window completely transparent.
I just want it to drop the transparency by 10.
Is there a different way I can do this to make it work better?

What I am wanting to achieve is:
When I hold down the capslock and scroll down, decrease the transparency of the active window by 10.
When I hold down the capslock and scroll up, increase the transparency of the active window by 10.
[Insert really cool signature here]

jgpaiva

  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 4,727
    • View Profile
    • Donate to Member
Re: Transparent windows with AHK what am I doing wrong?
« Reply #1 on: August 30, 2008, 07:59 PM »
I think your problem is caused by this behaviour:
outputvar is made blank if: 1) the OS is older than Windows XP; 2) there are no matching windows; 3) the window has no transparency level;
-ahk help file (winget section)
In windows with no transparency, the output variable is set to blank, and when you take 10 out of that, you get blank again, which then works as a 0 on the WinSet, setting the window to invisible.
Just add the following to the line after the WinGet:
if (tp = "")
  tp =255
That should solve your problem ;) (I hope! :P)

nite_monkey

  • Member
  • Joined in 2006
  • **
  • Posts: 736
    • View Profile
    • Just Plain Super
    • Read more about this member.
    • Donate to Member
Re: Transparent windows with AHK what am I doing wrong?
« Reply #2 on: August 30, 2008, 08:59 PM »
You know, that might be the problem. I will have to do that. Your explanation would make sense as to why it is doing that.

Edit: I do believe that fixed the problem. I can't get it to mess up on me anymore. Thanks  :Thmbsup:
[Insert really cool signature here]
« Last Edit: August 30, 2008, 11:32 PM by nite_monkey »

jgpaiva

  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 4,727
    • View Profile
    • Donate to Member
Re: Transparent windows with AHK what am I doing wrong?
« Reply #3 on: August 31, 2008, 05:15 AM »
Glad to know that! :D