Sign in to follow this  
Followers 0
nlgma

Need Help With Winggettrans("!","?")

6 posts in this topic

There is software that records random screen shot of my active decktop, I noticed with WinSetTrans the active windows become invisable. So I made a script that set the transparency state of any active window. My question is there a way to check a window for it's current transparency. Exp: WinGetTrans("!","?")

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

There is software that records random screen shot of my active decktop, I noticed with WinSetTrans the active windows become invisable. So I made a script that set the transparency state of any active window. My question is there a way to check a window for it's current transparency. Exp: WinGetTrans("!","?")

I would imagine if you set the values to variables or arrays, you could find the transparency from there.

Edit:

This could be one way to do it I guess, keeping track of what you do and how you do it:

Dim $WinTrans[2][3][2]
$WinTrans[1][0][0] = "AutoIt Help"
$WinTrans[1][1][0] = 255; Original
$WinTrans[1][2][0] = 100; Set To
$WinTrans[1][1][1] = WinSetTrans($WinTrans[1][0][0], '', $WinTrans[1][2][0])

Sleep(5000)

If $WinTrans[1][1][1] = 1 Then
    If MsgBox(68, 'Reset?', "$WinTrans[1][1][1] was set to " & $WinTrans[1][2][0] & ' for ' & $WinTrans[1][0][0] & @CR & _
        'Would you like to reset it back to the original now?') = 6 Then
        $WinTrans[1][1][1] = 0
        WinSetTrans($WinTrans[1][0][0], '', $WinTrans[1][1][0])
    EndIf
EndIf
Make sure you have the AutoIt Help file open, and bring it up after you start before the 5 seconds of sleep is up to see. Edited by SmOke_N

[center]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.[/center]

Share this post


Link to post
Share on other sites

I do thank you for the reply, but I think I might have missworded the issue that I'm having.

I'm trying to find a way to poll an window and return to trans value. ( 1 -255 )

#include <GuiConstants.au3>
#include <GuiListView.au3>
#Include <Constants.au3>
#include <GuiList.au3>
Opt("GUIOnEventMode", 1) 
Opt("WinTitleMatchMode", 2)
$Main = GuiCreate(".' '.",117, 200,-1,-1,$WS_EX_TOOLWINDOW)
$listbox = GUICtrlCreateList("", 0, 0, 115, 160)
$Exit_btn = GuiCtrlCreateButton("X", 95, 170, 20, 20)
GUICtrlSetTip($Exit_btn,"Close")
$label = GUICtrlCreateLabel("Ready", 0, 155, 90, 20,$SS_CENTER)
WinSetTrans(".' '.","",222)
;=====================================================================
GUICtrlSetOnEvent($listbox,"Get_Trans")
GUICtrlSetOnEvent($Exit_btn,"Exit_Main")
;=====================================================================
Func List()
    $Winz = WinList()
    For $i = 1 to $Winz[0][0]
        If $Winz[$i][0] <> "" AND Visible($Winz[$i][1]) Then
            GUICtrlSetData($label,"Adding "&$Winz[$i][0])
            GUICtrlSetData($listbox,$Winz[$i][0])
        EndIf
    Next
  GUICtrlSetData($label,"Ready...")
EndFunc
;=====================================================================
Func Visible($Visible)
      If BitAnd( WinGetState($Visible), 2 ) Then 
        Return 1
      Else
        Return 0
      EndIf
EndFunc
;=====================================================================
;Here is where I need help. Select a window from the list and WinGetTrans for the curent trans value ( 1 - 255)
;=====================================================================
Func Get_Trans()
    $ret = _GUICtrlListGetText ($listbox, _GUICtrlListSelectedIndex ($listbox))
    If ($ret == $LB_ERR) Then
        MsgBox(16, "Error", "Unknown error from _GUICtrlListGetText")
    Else
        GUICtrlSetData($label, "Current Trans: " & WinGetState($ret,"")); <====== Poll for trans value====<
    EndIf
EndFunc
;=====================================================================
Func Exit_Main()
    Exit
EndFunc
;=====================================================================
TraySetState()
GUISetState()
List()
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
    EndSelect
WEnd
Exit

Share this post


Link to post
Share on other sites

I still can't figure it out. I've tried array after array I'm guessing autoit3 dose not have a ability to determined to current window Trans. For next beta WinGetTrans

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

I still can't figure it out. I've tried array after array I'm guessing autoit3 dose not have a ability to determined to current window Trans. For next beta WinGetTrans

Well, without a DLL call that I'm not aware of, you won't be able to reveal back the trans state as far as I know. But if you set the trans state yourself, then what I posted will work.

Edit:

I've searched a bit, and it seems that most that determine LayeredWindowAttributes are using pixel graphics to get what they want.

Edited by SmOke_N

[center]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.[/center]

Share this post


Link to post
Share on other sites

I still can't figure it out. I've tried array after array I'm guessing autoit3 dose not have a ability to determined to current window Trans. For next beta WinGetTrans

No. The function is only available on Windows XP where-as transparency is supported on at least Windows 2000. In addition, it's trivial to call the Windows API function GetLayeredWindowAttributes() with DllCall() with current AutoIt (On Windows XP).

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