Jump to content

Recommended Posts

Whenever I call my function to set a transparency to a window, it will not do it. I've called this function over and over and nothing happens. I don't have the slightest clue what's wrong with it.

I even have it search for the process ID, window name, and first word of the window name. Still no luck making it transparent. Help please?

P.S. I know I use a GUI but it has nothing to do with my problem, so this doesn't go in GUI section.

#include<misc.au3>
#include<GUIConstants.au3>
#include<string.au3>

Global $Trans

$Trans = 0

AutoItSetOption("PixelCoordMode", 2)

$GUI1 = GUICreate("Chicken-Pix v1.4 -Lite-", 112, 40)
GUISetState(@SW_SHOW, $GUI1)

$Button1 = GUICtrlCreateButton("+", 90, 10, 12, 20)

$Input1 = GUICtrlCreateInput("Transparent D2", 10, 10, 80, 20, $ES_AUTOhSCROLL+$ES_READONLY)

While 1
    $Msg = GUIGetMsg()
    If $Msg = $Button1 Then
        _Transparent()
    EndIf

    If ProcessExists("Diablo II.exe") = 0 Then
        ExitLoop
    EndIf
    
    Sleep(1000)
WEnd

Func _Transparent()
    $PID1 = ProcessExists("Diablo II.exe")
    If $Trans = 0 Then
        WinSetTrans($PID1, "", 100)
        Sleep(1)
        WinSetTrans("Diablo II", "", 100)
        Sleep(1)
        WinSetTrans("Diablo", "", 100)
        $Trans = 1
    ElseIf $Trans = 1 Then
        WinSetTrans($PID1, "", 255)
        Sleep(1)
        WinSetTrans("Diablo II", "", 255)
        Sleep(1)
        WinSetTrans("Diablo", "", 255)
        $Trans = 0
    EndIf
    Sleep(1)
EndFunc
Link to post
Share on other sites

Maybe try the AutoItWindow tool?

Or make something (since your not getting the name right) use winlist to make tell you all the current windows and then one of those should be the one you want for the title.

You could try this to:

Opt("WinTitleMatchMode", 2)
That will make is so that the title matches to any substring in the window title. Edited by Piano_Man
My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]
Link to post
Share on other sites

does anyone have a solution? this is a vita issue with my program, lol seeing as how its one of the main features

Alright, this is what I meant.

Uncomment the commented code if you don't use Scite, that will it will right the windows to an .ini file which will be in the script directory.

HotKeySet('1', '_ConsoleWriteList')

While 1
    Sleep(1000)
WEnd

Func _ConsoleWriteList()
    Local $temp = WinList()
    
;~  If FileExists(@ScriptDir & '\Open Windows.ini') then 
;~      FileDelete(@ScriptDir & '\Open Windows.ini') 
;~  EndIf
    
    ConsoleWrite(@CRLF & '+> Writing current windows in order of appearence' & @CRLF)
    For $a = 1 To $temp[0][0]
        If $temp[$a][0] <> "" And _IsVisible($temp[$a][1]) Then
;~          IniWrite(@ScriptDir & '\Open windows.ini', '_Current Windows', $a, $temp[$a][0])
            ConsoleWrite('>Window name: ' & $temp[$a][0] & @CRLF)
        EndIf
    Next
    ConsoleWrite('+> Complete' & @CRLF)
EndFunc ;==>_GetTopMost

Func _IsVisible($handle)
    If BitAND(WinGetState($handle), 2) Then
        Return 1
    Else
        Return 0
    EndIf
EndFunc ;==>_IsVisible

This way is should give you the actual name of the window which you be able to use in the WinSetTrans()

Edited by Piano_Man
My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]
Link to post
Share on other sites

Sleep() in the main GUIGetMsg loop always is a very bad thing to do.

It's the reason why you don't see anything working - your GUI is unresponsive.

And in any case, if you expect that the whole game window will become transparent, I think you'll be disappointed. I'm pretty sure only titlebar will become see-through.

Edited by Siao

"be smart, drink your wine"

Link to post
Share on other sites

Sleep() in the main GUIGetMsg loop always is a very bad thing to do.

It's the reason why you don't see anything working - your GUI is unresponsive.

And in any case, if you expect that the whole game window will become transparent, I think you'll be disappointed. I'm pretty sure only titlebar will become see-through.

Sleep is used in every GUI ive ever created, it in absolutely no way makes GUI unresponsive. Ive been using it for as long as I've been using AutoIt

As far as making the whole game screen transparent, I've done it before with AutoIt but deleted the script, WinSetTrans does work for the game, but I don't remember how I did it.

~TK

Link to post
Share on other sites
  • Moderators

Sleep is used in every GUI ive ever created, it in absolutely no way makes GUI unresponsive. Ive been using it for as long as I've been using AutoIt

As far as making the whole game screen transparent, I've done it before with AutoIt but deleted the script, WinSetTrans does work for the game, but I don't remember how I did it.

~TK

Why in the world you use a sleep in a loop when you're already using GUIGetMsg() ?

GUICreate("")
GUISetState()
While 1
    Switch GUIGetMsg()
        Case -3
            Exit
    EndSwitch
WEnd
You're going to tell me you get the same response time?

Edit:

Holy mother of god, went to make the example include an Exit, and what a mess my edit ended up being.

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...