Welcome Guest.   Make a donation to an author on the site July 25, 2014, 06:18:27 AM  *

Please login or register.
Or did you miss your validation email?


Login with username and password (forgot your password?)
Why not become a lifetime supporting member of the site with a one-time donation of any amount? Your donation entitles you to a ton of additional benefits, including access to exclusive discounts and downloads, the ability to enter monthly free software drawings, and a single non-expiring license key for all of our programs.


You must sign up here before you can post and access some areas of the site. Registration is totally free and confidential.
 
Your Support Funds this Site: View the Supporter Yearbook.
   
   Forum Home   Thread Marks Chat! Downloads Search Login Register  
Pages: [1]   Go Down
  Reply  |  New Topic  |  Print  
Author Topic: Transparent windows with AHK what am I doing wrong?  (Read 5699 times)
nite_monkey
Member
**
Posts: 679


see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« on: August 30, 2008, 03:01:36 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.

Quote
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.
Logged

[Insert really cool signature here]
jgpaiva
Global Moderator
*****
Posts: 4,710



Artificial Idiocy

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #1 on: August 30, 2008, 07:59:42 PM »

I think your problem is caused by this behaviour:
Quote from: ahk help file (winget section)
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;
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:
[copy or print]
if (tp = "")
  tp =255
That should solve your problem Wink (I hope! tongue)
Logged

nite_monkey
Member
**
Posts: 679


see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #2 on: August 30, 2008, 08:59:38 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
« Last Edit: August 30, 2008, 11:32:23 PM by nite_monkey » Logged

[Insert really cool signature here]
jgpaiva
Global Moderator
*****
Posts: 4,710



Artificial Idiocy

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #3 on: August 31, 2008, 05:15:24 AM »

Glad to know that! cheesy
Logged

Pages: [1]   Go Up
  Reply  |  New Topic  |  Print  
 
Jump to:  
   Forum Home   Thread Marks Chat! Downloads Search Login Register  

DonationCoder.com | About Us
DonationCoder.com Forum | Powered by SMF
[ Page time: 0.03s | Server load: 0.09 ]