Sign in to follow this  
Followers 0
Breezydog99

Making windows transparent

8 posts in this topic

I've been trying to make MS Word transparent so I can put images or a movie behind it while I type(I hate stareing at a white screen).

This is what I've come up with but it doesnt work... anyone know why or what I'm doing wrong?

#include <GuiConstants.au3>

GuiCreate("MyGUI", 392, 152,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$WinName = GUICtrlCreateInput("Window Name", 10, 10, 370, 20)
$Slider_2 = GuiCtrlCreateSlider(10, 50, 370, 25)
;$Label_3 = GuiCtrlCreateLabel("Current transperency", 10, 80, 370, 20)
$Button_4 = GuiCtrlCreateButton("Set", 10, 120, 370, 20)

GuiCtrlSetLimit($Slider_2, 255, 0)

GuiSetState()
While 1
    $slide = GuiCtrlRead($Slider_2)
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $Button_4
        WinSetTrans($WinName,"",$slide)
    Case Else
        ;;;
EndSelect
WEnd
Exit

Share this post


Link to post
Share on other sites



I've been trying to make MS Word transparent so I can put images or a movie behind it while I type(I hate stareing at a white screen).

This is what I've come up with but it doesnt work... anyone know why or what I'm doing wrong?

WinSetTrans?

Share this post


Link to post
Share on other sites

#include <GuiConstants.au3>
Opt("WinTitleMatchMode", 2) ; Match substring

GuiCreate("MyGUI", 392, 152,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$WinName = GUICtrlCreateInput("Window Name", 10, 10, 370, 20)
$Slider_2 = GuiCtrlCreateSlider(10, 50, 370, 25)
;$Label_3 = GuiCtrlCreateLabel("Current transperency", 10, 80, 370, 20)
$Button_4 = GuiCtrlCreateButton("Set", 10, 120, 370, 20)

GuiCtrlSetLimit($Slider_2, 255, 0)

GuiSetState()
While 1      
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
     Case $msg = $Button_4
        $slide = Number(GuiCtrlRead($Slider_2))
        $AppName = GUICtrlRead($WinName)
        $ret = WinSetTrans($AppName, "", $slide)        
    Case Else
        ;;;
EndSelect
WEnd
Exit
This should work better for you, also keep in mind that you have to match any substring of the title.

Ex:

Windows title = AutoIt Forms -> Replying in Making windows transparent - M$ Internet Explorer

if you type replying won't work because in the windows title start with upper case.

if you type Replying work because is an exact match of a substring in the windows title.

Sorry if I confuse you but English is my second language...


AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line

Share this post


Link to post
Share on other sites

Window titles are checked using case specific checks. You must have the title capitalized properly for it to work.

Share this post


Link to post
Share on other sites

Yeah!! easy for you to said.... :P

Thanks you for explain it.


AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line

Share this post


Link to post
Share on other sites

OMG so simple, yet so usefull! lol


What goes around comes around... Payback's a bitch.

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

This is sweet, thank you!

sadly transperency doesnt work in front of Windows Media Player(at least for AVI) :P

Edited by Breezydog99

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

#include <GUIConstants.au3>
#Include <GuiCombo.au3>

; == GUI generated with Koda ==
$Form1 = GUICreate("Making Windows Transparent", 550, 24, 0, 0, BitOr($WS_CAPTION, $WS_SYSMENU))
$Combo1 = GUICtrlCreateCombo("", 0, 0, 281, 21, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL, $WS_VSCROLL, $CBS_DROPDOWNLIST))
$Slider1 = GUICtrlCreateSlider(280, 0, 270, 21)
GuiCtrlSetLimit(-1, 255, 0)
GUISetState(@SW_SHOW)

AdlibEnable('RebuildComboBox')
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
     Case $msg = $Slider1
        If GUICtrlRead($Combo1) == '' Then ContinueLoop
        WinSetTrans(GUICtrlRead($Combo1), '', Number(GuiCtrlRead($Slider1)))    
    Case Else
        ;;;;;;;
    EndSelect
WEnd
Exit

Func RebuildComboBox()
   Local $listItems
   Dim $var = WinList()

   For $i = 1 to $var[0][0]
      ; Only display visble windows that have a title
      If $var[$i][0] <> "" AND IsVisible($var[$i][1]) And $var[$i][0] <> "Program Manager" And $var[$i][1] <> $Form1 Then
         If _GUICtrlComboFindString($Combo1, $var[$i][0]) == $CB_ERR Then
            _GUICtrlComboAddString($Combo1, $var[$i][0])
         EndIf
      EndIf
   Next

   $listItems = StringSplit(_GUICtrlComboGetList($Combo1, '|'), '|')
   For $x = 1 To $listItems[0]
      If Not WinExists($listItems[$x]) Then
         _GUICtrlComboDeleteString($Combo1, _GUICtrlComboFindString($Combo1, $listItems[$x]))
      EndIf
   Next
EndFunc

Func IsVisible($handle)
  If BitAnd( WinGetState($handle), 2 ) Then 
    Return 1
  Else
    Return 0
  EndIf
EndFunc
I just add another twist into the script. No need for typing, the script is always checking for active windows and adding the title into the combobox. If any of the active windows close the script will remove the title from the combobox.

Edited by Danny35d

AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line

Share this post


Link to post
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
Sign in to follow this  
Followers 0