Jump to content

Vista type transparency


James
 Share

Recommended Posts

After having Vista for a while I got obsessed with the windows media player transparency. Then my computer broke and XP came back.

http://www.autoitscript.com/fileman/users/gafrosts_wife/Emoticons/wave.gif

Its also the first full script I have released without needing help from anyone. Celebrate!

Version 1.2 was made with help:

Thanks to: Helge and ThatsGreat2345 for helping adding quick keys and functions.

So I decided to make this:

;------------------------------------------
;
; Name: Windows Media Player Transparency
; Author: Secure_ICT
; Version: 1.2
; Credit given to: Helge and ThatsGreat2345
;
;------------------------------------------

#include <GUIConstants.au3>

; Start GUI Setting
GUICreate("Set Transparency",220,100, 100,200)       ; Set title
$slider = GUICtrlCreateSlider (10,10,200,20)         ; Set slider
GUICtrlSetLimit(-1,255,0)                            ; Set limit on slider
$set = GUICtrlCreateButton ("Set State",75,50,70,20) ; Set the Set button
$reset = GUICtrlCreateButton ("Reset",75,70,70,20)   ; Set Reset button
GUISetState()                                        ; Set the state of GUI Window
GUICtrlSetData($slider,127.5)                        ; Set slider half way on startup
; End GUI Setting

; Set HotKeys
Global $Keys
For $hotkeysetkey = 0 to 9
    HotKeySet($hotkeysetkey, "urgeerbestingenprotest")
next

; End HotKeys
;THIS FUNCTION WAS MADE BY HELGE AND THEREFORE IS COPYRIGHTED TO HIM AND MUST RECIEVE HIS CONSENT TO MODIFY IT 
Func urgeerbestingenprotest()
    Local $aTrans[10] = [0, 10, 50, 90, 100, 110, 150, 190, 210, 255]
   
    $Keys = NOT $Keys
    While $Keys
        Sleep(100)
        GUICtrlSetData($slider, $aTrans[@HotKeyPressed])
        ExitLoop
    WEnd
EndFunc

; Start Main Script
$start=TimerInit()
Do
  $n = GUIGetMsg ()
     
   If $n = $set Then ; Set the state
       WinSetTrans("Windows Media Player", "", GUICtrlRead($slider)) ; Set transparency of window by reading slider
   $start=TimerInit()
   EndIf
   
   If $n = $reset Then ; Reset the state
       WinSetTrans("Windows Media Player", "", 255) ; Reset the transparency of WMPlayer
       GUICtrlSetData($slider,255) ; Reset slider whilst your at it
   EndIf
   
Until $n = $GUI_EVENT_CLOSE
           WinSetTrans("Windows Media Player", "", 255) ; When GUI is closed reset state
; End Main Script

Tell me what you think please.

Edit: Fixed default to show cursor at 255 instead of middle.

Secure

Edited by Secure_ICT
Link to comment
Share on other sites

Update Version 1.1

  • Added Default values set as (0,1,2,3,4,5,6,7,8,9)
  • Changed some comments (messed up)
  • Hotkeys change defaults
;------------------------------------------
;
; Name: Windows Media Player Transparency
; Author: Secure_ICT
; Version: 1.1
;
;------------------------------------------

#include <GUIConstants.au3>

; Presets 
$0 = 0
$10 = 10
$50 = 50
$90 = 90
$100 = 100
$110 = 110
$150 = 150
$190 = 190
$200 = 200
$210 = 210
$255 = 255
; End Presets

; Start GUI Setting
GUICreate("Set Transparency",220,100, 100,200)       ; Set title
$slider = GUICtrlCreateSlider (10,10,200,20)         ; Set slider
GUICtrlSetLimit(-1,255,0)                            ; Set limit on slider 
$set = GUICtrlCreateButton ("Set State",75,50,70,20) ; Set the Set button
$reset = GUICtrlCreateButton ("Reset",75,70,70,20)   ; Set Reset button
GUISetState()                                        ; Set the state of GUI Window
GUICtrlSetData($slider,127.5)                        ; Set slider half way on startup
; End GUI Setting

; Set HotKeys
Global $Keys
HotKeySet("0", "none")
HotKeySet("1", "ten")
HotKeySet("2", "fifty")
HotKeySet("3", "ninty")
HotKeySet("4", "oneh")
HotKeySet("5", "onet")
HotKeySet("6", "onef")
HotKeySet("7", "onen")
HotKeySet("8", "twot")
HotKeySet("9", "twoff")
; End HotKeys

; Start Functions
Func none()
    $Keys = NOT $Keys
    While $Keys
        Sleep(100)
        GUICtrlSetData($slider, $0)
        ExitLoop
    WEnd
EndFunc

Func ten()
    $Keys = NOT $Keys
    While $Keys
        Sleep(100)
        GUICtrlSetData($slider, $10)
        ExitLoop
    WEnd
EndFunc

Func fifty()
    $Keys = NOT $Keys
    While $Keys
        Sleep(100)
        GUICtrlSetData($slider, $50)
        ExitLoop
    WEnd
EndFunc

Func ninty()
    $Keys = NOT $Keys
    While $Keys
        Sleep(100)
        GUICtrlSetData($slider, $90)
        ExitLoop
    WEnd
EndFunc

Func oneh()
    $Keys = NOT $Keys
    While $Keys
        Sleep(100)
        GUICtrlSetData($slider, $100)
        ExitLoop
    WEnd
EndFunc

Func onet()
    $Keys = NOT $Keys
    While $Keys
        Sleep(100)
        GUICtrlSetData($slider, $110)
        ExitLoop
    WEnd
EndFunc

Func onef()
    $Keys = NOT $Keys
    While $Keys
        Sleep(100)
        GUICtrlSetData($slider, $150)
        ExitLoop
    WEnd
EndFunc

Func onen()
    $Keys = NOT $Keys
    While $Keys
        Sleep(100)
        GUICtrlSetData($slider, $190)
        ExitLoop
    WEnd
EndFunc

Func twot()
    $Keys = NOT $Keys
    While $Keys
        Sleep(100)
        GUICtrlSetData($slider, $210)
        ExitLoop
    WEnd
EndFunc

Func twoff()
    $Keys = NOT $Keys
    While $Keys
        Sleep(100)
        GUICtrlSetData($slider, $255)
        ExitLoop
    WEnd
EndFunc
; End Functions

; Start Main Script
$start=TimerInit()
Do
  $n = GUIGetMsg ()
     
   If $n = $set Then ; Set the state
       WinSetTrans("Windows Media Player", "", GUICtrlRead($slider)) ; Set transparency of window by reading slider
   $start=TimerInit()
   EndIf
   
   If $n = $reset Then ; Reset the state
       WinSetTrans("Windows Media Player", "", 255) ; Reset the transparency of WMPlayer
       GUICtrlSetData($slider,255) ; Reset slider whilst your at it
   EndIf
   
Until $n = $GUI_EVENT_CLOSE 
           WinSetTrans("Windows Media Player", "", 255) ; When GUI is closed reset state
; End Main Script

Please comment.

Edited by Secure_ICT
Link to comment
Share on other sites

Instead of having 10 different functions that are almost identical, you can just make the hotkeys point to the

same function and then with the help of the @HotKeyPressed macro you can shorten the code drastically.

UNTESTED:

Func urgeerbestingenprotest()
    Local $aTrans[10] = [0, 10, 50, 90, 100, 110, 150, 190, 210, 255]
    
    $Keys = NOT $Keys
    While $Keys
        Sleep(100)
        GUICtrlSetData($slider, $aTrans[@HotKeyPressed])
        ExitLoop
    WEnd
EndFunc
Edited by Helge
Link to comment
Share on other sites

His function uses an array, the numbers are set in the array corresponded with the hotkeys pressed, example press 0, that coressponds with 0 trans, press 1 it corresponds with 10 , it does it by using the @hotkeypressed macro which when 0 is pressed will return 0, thus grabbing the 0 slot in the array which is 0. When 1 is pressed itll return 1, thus grabbing the 1 slot in the array which is 10

not tested just dropped it in

;------------------------------------------
;
; Name: Windows Media Player Transparency
; Author: Secure_ICT
; Version: 1.1
;
;------------------------------------------

#include <GUIConstants.au3>

; Start GUI Setting
GUICreate("Set Transparency",220,100, 100,200)       ; Set title
$slider = GUICtrlCreateSlider (10,10,200,20)         ; Set slider
GUICtrlSetLimit(-1,255,0)                            ; Set limit on slider
$set = GUICtrlCreateButton ("Set State",75,50,70,20) ; Set the Set button
$reset = GUICtrlCreateButton ("Reset",75,70,70,20)   ; Set Reset button
GUISetState()                                        ; Set the state of GUI Window
GUICtrlSetData($slider,127.5)                        ; Set slider half way on startup
; End GUI Setting

; Set HotKeys
Global $Keys
HotKeySet("0", "tran")
HotKeySet("1", "tran")
HotKeySet("2", "tran")
HotKeySet("3", "tran")
HotKeySet("4", "tran")
HotKeySet("5", "tran")
HotKeySet("6", "tran")
HotKeySet("7", "tran")
HotKeySet("8", "tran")
HotKeySet("9", "tran")

Func tran()
    Local $aTrans[10] = [0, 10, 50, 90, 100, 110, 150, 190, 210, 255]
    $Keys = NOT $Keys
    While $Keys
        Sleep(100)
        GUICtrlSetData($slider, $aTrans[@HotKeyPressed])
        ExitLoop
    WEnd
EndFunc

; Start Main Script
$start=TimerInit()
Do
  $n = GUIGetMsg ()
     
   If $n = $set Then ; Set the state
       WinSetTrans("Windows Media Player", "", GUICtrlRead($slider)) ; Set transparency of window by reading slider
   $start=TimerInit()
   EndIf
   
   If $n = $reset Then ; Reset the state
       WinSetTrans("Windows Media Player", "", 255) ; Reset the transparency of WMPlayer
       GUICtrlSetData($slider,255) ; Reset slider whilst your at it
   EndIf
   
Until $n = $GUI_EVENT_CLOSE
           WinSetTrans("Windows Media Player", "", 255) ; When GUI is closed reset state
; End Main Script
Link to comment
Share on other sites

? I dont have a clue what to do with this. I've tried a couple of things, but its not working.

...you can just make the hotkeys point to the same function... I gave you the function to point them to..

I thought that was pretty obvious.

Son of a bitch, thatsgreat ! You're rude enough to modify the code when you removed the space in it, but you

renamed the function as well !! You even received the entire credits for it ! Oh my !!!11oneone Gule tresko !! :P

Link to comment
Share on other sites

...you can just make the hotkeys point to the same function... I gave you the function to point them to..

I thought that was pretty obvious.

Son of a bitch, thatsgreat ! You're rude enough to modify the code when you removed the space in it, but you

renamed the function as well !! You even received the entire credits for it ! Oh my !!!11oneone Gule tresko !! :)

:D what did i do im sorry , i couldnt understand the function name so i changed it , removed the space in it? im so confused xD im sorry

BETTER ? :P

;------------------------------------------
;
; Name: Windows Media Player Transparency
; Author: Secure_ICT
; Version: 1.1
;
;------------------------------------------

#include <GUIConstants.au3>

; Start GUI Setting
GUICreate("Set Transparency",220,100, 100,200)       ; Set title
$slider = GUICtrlCreateSlider (10,10,200,20)         ; Set slider
GUICtrlSetLimit(-1,255,0)                            ; Set limit on slider
$set = GUICtrlCreateButton ("Set State",75,50,70,20) ; Set the Set button
$reset = GUICtrlCreateButton ("Reset",75,70,70,20)   ; Set Reset button
GUISetState()                                        ; Set the state of GUI Window
GUICtrlSetData($slider,127.5)                        ; Set slider half way on startup
; End GUI Setting

; Set HotKeys
Global $Keys
HotKeySet("0", "urgeerbestingenprotest")
HotKeySet("1", "urgeerbestingenprotest")
HotKeySet("2", "urgeerbestingenprotest")
HotKeySet("3", "urgeerbestingenprotest")
HotKeySet("4", "urgeerbestingenprotest")
HotKeySet("5", "urgeerbestingenprotest")
HotKeySet("6", "urgeerbestingenprotest")
HotKeySet("7", "urgeerbestingenprotest")
HotKeySet("8", "urgeerbestingenprotest")
HotKeySet("9", "urgeerbestingenprotest")
; End HotKeys
;THIS FUNCTION WAS MADE BY HELGE AND THEREFORE IS COPYRIGHTED TO HIM AND MUST RECIEVE HIS CONSENT TO MODIFY IT :)
Func urgeerbestingenprotest()
    Local $aTrans[10] = [0, 10, 50, 90, 100, 110, 150, 190, 210, 255]
   
    $Keys = NOT $Keys
    While $Keys
        Sleep(100)
        GUICtrlSetData($slider, $aTrans[@HotKeyPressed])
        ExitLoop
    WEnd
EndFunc

; Start Main Script
$start=TimerInit()
Do
  $n = GUIGetMsg ()
     
   If $n = $set Then ; Set the state
       WinSetTrans("Windows Media Player", "", GUICtrlRead($slider)) ; Set transparency of window by reading slider
   $start=TimerInit()
   EndIf
   
   If $n = $reset Then ; Reset the state
       WinSetTrans("Windows Media Player", "", 255) ; Reset the transparency of WMPlayer
       GUICtrlSetData($slider,255) ; Reset slider whilst your at it
   EndIf
   
Until $n = $GUI_EVENT_CLOSE
           WinSetTrans("Windows Media Player", "", 255) ; When GUI is closed reset state
; End Main Script
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...