Jump to content

Transparant Window by mousemovements


Pakku
 Share

Recommended Posts

Hi all,

Don't know why, but been away for a while from the forum, but thought I'll come back, see how things are going at AutoIt forum.

To pay for the last few monthes, here a script I wrote yesterday just for fun.

Hit Ctrl + Alt + a to activate and deactivate, after activating, moving your mouse form the spot to the left will make your current active window transparant, moving far more away will make it more transparant. moving to the right will make it more sollid, and even more right than where you start will make it as solid as possible.

HotKeySet("^!a","trans")
$until = 0

While 1
    Sleep(10)
WEnd

Func trans()
    HotKeySet("^!a","reset")
    $pos0 = MouseGetPos(0)
    $ruimte = 20
    $oldtrans = 255
    $titel = WinGetTitle("")
    Do
        $pos1 = MouseGetPos(0)
        if $pos1 > $pos0 Then
            $trans = 255
        Elseif $pos1 < $ruimte Then
            $trans = 0
        Else
            $trans = Int(255 - ((($pos0 - $pos1) / ($pos0 - 20)) * 255))
        EndIf
        if $oldtrans <> $trans Then
            WinSetTrans($titel,"",$trans)
            $oldtrans = $trans
        EndIf
        Sleep(100)
    Until $until = 1
    $until =  0
EndFunc

Func reset()
    $until = 1
    HotKeySet("^!a","Trans")
EndFunc

Life can't be made easier, but fun can be added :)

Edited by Pakku
Link to comment
Share on other sites

  • 2 months later...

Hi all,

Don't know why, but been away for a while from the forum, but thought I'll come back, see how things are going at AutoIt forum.

To pay for the last few monthes, here a script I wrote yesterday just for fun.

Hit Ctrl + Alt + a to activate and deactivate, after activating, moving your mouse form the spot to the left will make your current active window transparant, moving far more away will make it more transparant. moving to the right will make it more sollid, and even more right than where you start will make it as solid as possible.

HotKeySet("^!a","trans")
$until = 0

While 1
    Sleep(10)
WEnd

Func trans()
    HotKeySet("^!a","reset")
    $pos0 = MouseGetPos(0)
    $ruimte = 20
    $oldtrans = 255
    $titel = WinGetTitle("")
    Do
        $pos1 = MouseGetPos(0)
        if $pos1 > $pos0 Then
            $trans = 255
        Elseif $pos1 < $ruimte Then
            $trans = 0
        Else
            $trans = Int(255 - ((($pos0 - $pos1) / ($pos0 - 20)) * 255))
        EndIf
        if $oldtrans <> $trans Then
            WinSetTrans($titel,"",$trans)
            $oldtrans = $trans
        EndIf
        Sleep(100)
    Until $until = 1
    $until =  0
EndFunc

Func reset()
    $until = 1
    HotKeySet("^!a","Trans")
EndFunc

Life can't be made easier, but fun can be added :)

Arjan

vengat , cool of all

Link to comment
Share on other sites

It's a bit buggy on my dual monitor system but still an interesting idea.

Maybe if you could cycle through all inactive windows and set the transparency to 75% and the active window is always set to 100%. :P

Heh :)

(Remember to press x on your keyboard to reset all windows transparency)

Global $Transparency = 255 * 0.75

Global $LastActiveWindow = 1

HotKeySet("x","reset")

$List = WinList()
For $x = 1 To $List[0][0]
    If BitAnd( WinGetState($List[$x][1]), 2 ) Then WinSetTrans($List[$x][1],"",$Transparency)
Next

While 1
    CheckInactive()
    Sleep(10)
WEnd

Func CheckInactive()
    If WinActive($LastActiveWindow) Then
        Return
    Else
        WinSetTrans($LastActiveWindow,"",$Transparency)
        $List = WinList()
        For $x = 1 To $List[0][0]
            If BitAnd( WinGetState($List[$x][1]), 8 ) Then
                $LastActiveWindow = $List[$x][1]
                WinSetTrans($LastActiveWindow,"",254.9)
            EndIf
        Next
    EndIf
EndFunc

Func reset()
    $List = WinList()
    For $x = 1 To $List[0][0]
        If BitAnd( WinGetState($List[$x][1]), 2 ) Then WinSetTrans($List[$x][1],"",255)
    Next
    Exit
EndFunc
Link to comment
Share on other sites

@Mr. Zero

:) Very Nice! On a dual monitor system it works very well. Amazing all the crap I have running. :P

Well the problem is that WinSetTrans makes the transparent windows slow and flickers when going from non-transparent to transparent.

For example:

For $x = 1 To $List[0][0]
            If BitAnd( WinGetState($List[$x][1]), 8 ) Then
                $LastActiveWindow = $List[$x][1]
                WinSetTrans($LastActiveWindow,"",254.9)
            EndIf
        Next

This code finds the active window and apply transparency. Notice that I have written 254.9 to make it almost not transparent. The reason to this is because if you set it to become non transparent it will flicker black for millisec but enough to see it. Which is kind of annoying.

On the other hand having the active window not full non transparent makes it slow for some reason. So it is a question about efficiency vs. lookout. Personal I prefer 255 for faster process.

Global $Transparency = 255 * 0.75
Global $FullTransparency = 254.9

Global $LastActiveWindow = 1

HotKeySet("x","reset")

$List = WinList()
For $x = 1 To $List[0][0]
    If BitAnd( WinGetState($List[$x][1]), 2 ) Then WinSetTrans($List[$x][1],"",$Transparency)
Next

While 1
    If WinActive($LastActiveWindow) Then
        Sleep(10)
    Else
        WinSetTrans($LastActiveWindow,"",$Transparency)
        $List = WinList()
        For $x = 1 To $List[0][0]
            If BitAnd( WinGetState($List[$x][1]), 8 ) Then
                $LastActiveWindow = $List[$x][1]
                WinSetTrans($LastActiveWindow,"",$FullTransparency)
            EndIf
        Next
    EndIf
WEnd

Func reset()
    $List = WinList()
    For $x = 1 To $List[0][0]
        If BitAnd( WinGetState($List[$x][1]), 2 ) Then WinSetTrans($List[$x][1],"",255)
    Next
    Exit
EndFunc

Sorry arjan. Didn't mean to hijack the topic :P.

Link to comment
Share on other sites

Hi all,

Don't know why, but been away for a while from the forum, but thought I'll come back, see how things are going at AutoIt forum.

To pay for the last few monthes, here a script I wrote yesterday just for fun.

Hit Ctrl + Alt + a to activate and deactivate, after activating, moving your mouse form the spot to the left will make your current active window transparant, moving far more away will make it more transparant. moving to the right will make it more sollid, and even more right than where you start will make it as solid as possible.

HotKeySet("^!a","trans")
$until = 0

While 1
    Sleep(10)
WEnd

Func trans()

    HotKeySet("^!a","reset")
    $pos0 = MouseGetPos(0)
    $ruimte = 20
    $oldtrans = 255
    $titel = WinGetTitle("")
    Do
        $pos1 = MouseGetPos(0)
        if $pos1 > $pos0 Then
            $trans = 255
        Elseif $pos1 < $ruimte Then
            $trans = 0
        Else
            $trans = Int(255 - ((($pos0 - $pos1) / ($pos0 - 20)) * 255))
        EndIf
        if $oldtrans <> $trans Then
            WinSetTrans($titel,"",$trans)
            $oldtrans = $trans
        EndIf
        Sleep(100)
    Until $until = 1
    $until =  0
EndFunc

Func reset()
    $until = 1
    HotKeySet("^!a","Trans")
EndFunc

Life can't be made easier, but fun can be added :)

Arjan

Hi Arjan

Very nice and clever works on my Desktop. If you like a challenge you might like to consider the following and that is how to make the mouse pointer transparent or invisible when the pointer is moved. In Vista Control Panel/Mouse/Pointer Options/Visibility there is an option to hide the mouse pointer when inputing text. So is it possible to manipulate this Windows feature to hide the mouse when the mouse pointer is moved? [i like to learn something new every day please contribute] Ant.. :P

Link to comment
Share on other sites

I realise people failed to listen, and press x on exit. The following is much easier:

Global $Transparency = 255 * 0.75
Global $FullTransparency = 254.9

Global $LastActiveWindow = 1

HotKeySet("x","reset")
Opt ("OnExitFunc", "reset")

$List = WinList()
For $x = 1 To $List[0][0]
    If BitAnd( WinGetState($List[$x][1]), 2 ) Then WinSetTrans($List[$x][1],"",$Transparency)
Next

While 1
    If WinActive($LastActiveWindow) Then
        Sleep(10)
    Else
        WinSetTrans($LastActiveWindow,"",$Transparency)
        $List = WinList()
        For $x = 1 To $List[0][0]
            If BitAnd( WinGetState($List[$x][1]), 8 ) Then
                $LastActiveWindow = $List[$x][1]
                WinSetTrans($LastActiveWindow,"",$FullTransparency)
            EndIf
        Next
    EndIf
WEnd

Func reset()
    $List = WinList()
    For $x = 1 To $List[0][0]
        If BitAnd( WinGetState($List[$x][1]), 2 ) Then WinSetTrans($List[$x][1],"",255)
    Next
    Exit
EndFunc
Link to comment
Share on other sites

  • 10 months later...

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