Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate

MouseWheel to set transparency


  • Please log in to reply
6 replies to this topic
slomz
  • Guests
  • Last active:
  • Joined: --
Ok so I used a volume change script and tried changing it so that I could use the wheelup and wheeldown functions to increase or decrease the transparency of the windows. dont laugh at me if this is completely wrong.

Note from moderator: the following post further below is probably the best solution as of Aug 14th 2006: http://www.autohotke... ... 1774#71774


;_________________________________________________ 
;_______User Settings_____________________________ 

; Make customisation only in this area or hotkey area only!! 

; The percentage by which to raise or lower the transparency each time:
Transparency_Step = 10

; How long to display the Transparency level bar graphs:
vol_DisplayTime = 2000

; Transparency Bar color (see the help file to use more
; precise shades):
Transparency_CBM = Red

; Background color
Transparency_CW = Silver

; Bar's screen position.  Use -1 to center the bar in that dimension:
Transparency_PosX = -1
Transparency_PosY = -1
Transparency_Width = 150  ; width of bar
Transparency_Thick = 12   ; thickness of bar

; try changing the below hotkeys to use them by specifying
HotKey, WheelUp, Transparency_Up      ; Win+UpArrow
HotKey, WheelDown, Transparency_Down

;___________________________________________ 
;_____Auto Execute Section__________________ 

; DON'T CHANGE ANYTHING HERE (unless you know what you're doing).

Transparency_BarOptions = 1:B ZH%Transparency_Thick% ZX0 ZY0 W%Transparency_Width% CB%Transparency_CBM% CW%Transparency_CW%


; If the X position has been specified, add it to the options.
; Otherwise, omit it to center the bar horizontally:
if Transparency_PosX >= 0
{
	Transparency_BarOptions = %Transparency_BarOptions% X%Transparency_PosX%
}

; If the Y position has been specified, add it to the options.
; Otherwise, omit it to have it calculated later:
if Transparency_PosY >= 0
{
	Transparency_BarOptions = %Transparency_BarOptions% Y%Transparency_PosY%
}

#SingleInstance
SetBatchLine, 10ms
Return


;___________________________________________ 

Transparency_Up:
WinSet, %Transparency_Up%,
Gosub, Transparency_ShowBars
return

Transparency_Down:
WinSet, -%Transparency_Down%,
Gosub, Transparency_ShowBars
return


Transparency_ShowBars:
; To prevent the "flashing" effect, only create the bar window if it
; doesn't already exist:
IfWinNotExist, Transparency
	Progress, %Transparency_BarOptions%, , , Transparency
IfWinNotExist, Transparency
{
	; Calculate position here in case screen resolution changes while
	; the script is running:
	if Transparency_PosY < 0
	{
		; Create the  bar :
		WinGetPos, , Transparency_Posy, , , Transparency
		Transparency_Posy -= %Transparency_Thick%
		Progress, %Transparency_BarOptions% Y%Transparency_Posy%, , , 
	}
	else
		Progress, %Transparency_BarOptionsTransparency%, , , 
}
WinGet, Transparency, 
Progress, :%Transparencyr%
SetTimer, Transparency_BarOff, %Transparency_DisplayTime%
return

Transparency_BarOff:
SetTimer, Transparency_BarOff, off
Progress, 1:Off
return


Chris
  • Administrators
  • 10727 posts
  • Last active:
  • Joined: 02 Mar 2004
I think there's at least one other script like this one somewhere on the forum. So if you need any new ideas or help with it, try searching.

slomz
  • Guests
  • Last active:
  • Joined: --
I have and both the ones I found aren't where you can set the transparency on the spot. And they froze the keyboard on my computer so I had to shut off and delete those.

Peter
  • Members
  • 448 posts
  • Last active: Jan 15 2010 05:41 AM
  • Joined: 30 Dec 2005
Well, this does something like that. I hope it's useful for you.
Hotkey, #WheelDown, MH_VisibleWindowDown

   Hotkey, #WheelUp, MH_VisibleWindowUp

Return

MH_VisibleWindowDown:

   WinGet, ActiveTransparency, transparent, A   ; only in >=XP

   If (ActiveTransparency= "")

         ActiveTransparency= 230

   else {

         ActiveTransparency-= 25

      If ActiveTransparency< 10

         ActiveTransparency= 10

   }

   WinSet, transparent, %ActiveTransparency%,A

Return

MH_VisibleWindowUp:

   WinGet, ActiveTransparency, transparent, A   ; only in >=XP

   If (ActiveTransparency= "")

         ActiveTransparency= 255

   else {

         ActiveTransparency+= 25

      If ActiveTransparency> 255

         ActiveTransparency= 255

   }

   WinSet, transparent, %ActiveTransparency%,A

Return


Laszlo
  • Moderators
  • 4713 posts
  • Last active: Mar 31 2012 03:17 AM
  • Joined: 14 Feb 2005
I tried to minimize the number of changes in slomz'es script… Basically, we need to get the current transparency level of the active window, change it, make sure it does not get out of range and set it as the new transparency level. The progress bar needs data in [0,100], so the transparency is divided by 2.55.
;_________________________________________________

;_______User Settings_____________________________



; Make customisation only in this area or hotkey area only!!



; The percentage by which to raise or lower the transparency each time:

Transparency_Step = 10



; How long to display the Transparency level bar graphs:

vol_DisplayTime = 2000



; Transparency Bar color (see the help file to use more

; precise shades):

Transparency_CBM = Red



; Background color

Transparency_CW = Silver



; Bar's screen position. Use -1 to center the bar in that dimension:

Transparency_PosX = -1

Transparency_PosY = -1

Transparency_Width = 150 ; width of bar

Transparency_Thick = 12 ; thickness of bar



; try changing the below hotkeys to use them by specifying

HotKey, WheelUp, Transparency_Up

HotKey, WheelDown, Transparency_Down



;___________________________________________

;_____Auto Execute Section__________________



; DON'T CHANGE ANYTHING HERE (unless you know what you're doing).



Transparency_BarOptions = 1:B ZH%Transparency_Thick% ZX0 ZY0 W%Transparency_Width% CB%Transparency_CBM% CW%Transparency_CW%





; If the X position has been specified, add it to the options.

; Otherwise, omit it to center the bar horizontally:

if Transparency_PosX >= 0

{

Transparency_BarOptions = %Transparency_BarOptions% X%Transparency_PosX%

}



; If the Y position has been specified, add it to the options.

; Otherwise, omit it to have it calculated later:

if Transparency_PosY >= 0

{

Transparency_BarOptions = %Transparency_BarOptions% Y%Transparency_PosY%

}



#SingleInstance

SetBatchLines, 10ms

Return





;___________________________________________



Transparency_Up:

WinGet, Transparency, Transparent, A

Transparency += Transparency_Step

IfGreater Transparency, 255, SetEnv Transparency,255

WinSet, Transparent, %Transparency%, A

Gosub, Transparency_ShowBars

return



Transparency_Down:

WinGet, Transparency, Transparent, A

Transparency -= Transparency_Step

IfLess Transparency, 1, SetEnv Transparency,1

WinSet, Transparent, %Transparency%, A

Gosub, Transparency_ShowBars

return





Transparency_ShowBars:

; To prevent the "flashing" effect, only create the bar window if it

; doesn't already exist:

IfWinNotExist, Transparency

Progress, %Transparency_BarOptions%, , , Transparency

IfWinNotExist, Transparency

{

; Calculate position here in case screen resolution changes while

; the script is running:

if Transparency_PosY < 0

{

; Create the bar :

WinGetPos, , Transparency_Posy, , , Transparency

Transparency_Posy -= %Transparency_Thick%

Progress, %Transparency_BarOptions% Y%Transparency_Posy%, , ,

}

else

Progress, %Transparency_BarOptionsTransparency%, , ,

}

Progress, % Transparency/2.55

SetTimer, Transparency_BarOff, %Transparency_DisplayTime%

return



Transparency_BarOff:

SetTimer, Transparency_BarOff, off

Progress, Off

return


slomz
  • Guests
  • Last active:
  • Joined: --
That works great except the links and tabs on windows seem to be disabled why it's running.

Laszlo
  • Moderators
  • 4713 posts
  • Last active: Mar 31 2012 03:17 AM
  • Joined: 14 Feb 2005
I don't have that problem, but in any case, it is better to leave the original wheel functionality alone, and add modifiers to the hotkeys, like ^+WeelUp, ^+WheelDown, so Ctrl and Shift has to be pressed together with turning the wheel for changing the transparency. Also, you could clean up the code a bit, which is a good learning exercise.