Richard Robertson Posted October 12, 2007 Share Posted October 12, 2007 In response to a feature request, I have just written this. When the mouse is over the info window, it's fully visible, otherwise it's semitransparent. The script runs the tool and when the tool closes, the script exits. expandcollapse popup#cs Richard Robertson This script turns the info window semitransparent when the mouse is not over it. #ce Dim $pid = Run("au3info.exe") WinWait("AutoIt v3 Active Window Info") Dim $hwnd = WinGetHandle("AutoIt v3 Active Window Info") Dim $timer, $wpos, $mpos, $istrans $istrans = False Dim $trans = 128 ; set this to whatever you want, this is the semitransparent value While ProcessExists($pid) ; exits when you close the info window $timer = TimerInit() $wpos = WinGetPos($hwnd) While TimerDiff($timer) < 5000 And Processex($pid) ; only check the position of the window every 5 seconds $mpos = MouseGetPos() If ($mpos[0] >= $wpos[0]) And ($mpos[0] <= ($wpos[0] + $wpos[2])) And ($mpos[1] >= $wpos[1]) And ($mpos[1] <= ($wpos[1] + $wpos[3])) Then ; on window If $istrans Then WinSetTrans($hwnd, "", 255) $istrans = False EndIf Else If Not $istrans Then WinSetTrans($hwnd, "", $trans) $istrans = True EndIf EndIf Sleep(10) WEnd WEnd Let me know what you think. Link to comment Share on other sites More sharing options...
gseller Posted October 12, 2007 Share Posted October 12, 2007 This is a very good idea, it does not work on my winxp box. It pulls up the info tool but never does the transparency or the exit on ProcessExists after 5 seconds.. Is it meant for vista only maybe? Link to comment Share on other sites More sharing options...
Nahuel Posted October 13, 2007 Share Posted October 13, 2007 (edited) Doesn't work here either... but yeah, good idea.. -edit- Check now gesller: expandcollapse popup#cs Richard Robertson This script turns the info window semitransparent when the mouse is not over it. #ce $pid=Run("au3info.exe") WinWait("AutoIt v3 Window Info") $hwnd = WinGetHandle("AutoIt v3 Window Info") Dim $timer, $wpos, $mpos, $istrans $istrans = True Dim $trans = 128 ; set this to whatever you want, this is the semitransparent value While WinExists($hwnd) ; exits when you close the info window $timer = TimerInit() $wpos = WinGetPos($hwnd) While TimerDiff($timer) < 5000 And ProcessExists($pid) ; only check the position of the window every 5 seconds $mpos = MouseGetPos() If ($mpos[0] >= $wpos[0]) And ($mpos[0] <= ($wpos[0] + $wpos[2])) And ($mpos[1] >= $wpos[1]) And ($mpos[1] <= ($wpos[1] + $wpos[3])) Then ; on window If $istrans Then WinSetTrans($hwnd, "", 255) $istrans = False EndIf Else If Not $istrans Then WinSetTrans($hwnd, "", $trans) $istrans = True EndIf EndIf Sleep(10) WEnd WEnd Edited October 13, 2007 by Nahuel Link to comment Share on other sites More sharing options...
Achilles Posted October 13, 2007 Share Posted October 13, 2007 (edited) It works good with the changes Nahuel made. I don't understand something here though. You say it checks every five seconds but that does not seem to be the case. Since you are initiating the timer at the beginning of every loop the timer will always be less then 5000 and the process should always exist while the window exists. Consequently isn't the timer pointless? Basically I'm saying that in this statement: TimerDiff($timer) < 5000 And ProcessExists($pid) Both conditions will always evaluate to true which makes it pointless. Please let me know if I'm not understanding something here... EDIT: I have a suggestion that should be simple. Make an option so that it will fade through to the transparency you want instead of just setting it at the new transparency. Edited October 13, 2007 by Piano_Man My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list] Link to comment Share on other sites More sharing options...
Richard Robertson Posted October 13, 2007 Author Share Posted October 13, 2007 (edited) The timer does make sense if you look closely. The outer loop starts the timer and gets the window position. The inner loop will run for up to 5 seconds (5000 milliseconds) or terminate if the process closes. When the inner loop ends, the outer loop gets the window position and resets the timer. I didn't write this for Vista, because Vista sucks still and I won't use it. I don't understand what isn't working about it though. I tested it on XP SP2 and it worked. If anyone can provide me with any info as to why it's not working, I'd love to understand what's wrong. I got it working just fine. Edited October 13, 2007 by Richard Robertson Link to comment Share on other sites More sharing options...
gseller Posted October 13, 2007 Share Posted October 13, 2007 Cool Beans! Works now... Not sure I would ever use it but way cool just the same.. Link to comment Share on other sites More sharing options...
Achilles Posted October 13, 2007 Share Posted October 13, 2007 (edited) The timer does make sense if you look closely. The outer loop starts the timer and gets the window position. The inner loop will run for up to 5 seconds (5000 milliseconds) or terminate if the process closes. When the inner loop ends, the outer loop gets the window position and resets the timer.I didn't write this for Vista, because Vista sucks still and I won't use it. I don't understand what isn't working about it though. I tested it on XP SP2 and it worked.If anyone can provide me with any info as to why it's not working, I'd love to understand what's wrong. I got it working just fine.The parts that didn't work for me was the name change. My AutoIt window name is "AutoIt v3 Window Info" and I don't have a function called "Processex".EDIT: About the loop, I now understand why you have it now. However, doesn't that just make your code more likely to mess up? For example, I ran it with the loop and if I moved the window at the right time it would be solid (255 trans) even though the mouse was off of it and then it would update in a few seconds. However, without the loop it doesn't malfunction like that... Though it probably uses more CPU... Edited October 13, 2007 by Piano_Man My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list] Link to comment Share on other sites More sharing options...
DW1 Posted October 13, 2007 Share Posted October 13, 2007 Now it will not go transparent while you are draging the window. Also will not go transparent if you are highlighting text behind it or moving a windows behind it:expandcollapse popup#cs Richard Robertson This script turns the info window semitransparent when the mouse is not over it. #ce #include<misc.au3> $pid = Run("au3info.exe") WinWait("AutoIt v3 Window Info") $hwnd = WinGetHandle("AutoIt v3 Window Info") Dim $timer, $wpos, $mpos, $istrans $istrans = False Dim $trans = 128 ; set this to whatever you want, this is the semitransparent value While WinExists($hwnd) ; exits when you close the info window $timer = TimerInit() $wpos = WinGetPos($hwnd) While TimerDiff($timer) < 1000 And ProcessExists($pid) ; check the position of the window every second $mpos = MouseGetPos() If ($mpos[0] >= $wpos[0]) And ($mpos[0] <= ($wpos[0] + $wpos[2])) And ($mpos[1] >= $wpos[1]) And ($mpos[1] <= ($wpos[1] + $wpos[3])) Then ; on window If $istrans Then While _IsPressed(01) Sleep(10) WEnd WinSetTrans($hwnd, "", 255) $istrans = False EndIf Else If Not $istrans Then If Not _IsPressed(01) Then WinSetTrans($hwnd, "", $trans) $istrans = True EndIf EndIf EndIf Sleep(10) WEnd WEnd AutoIt3 Online Help Link to comment Share on other sites More sharing options...
Nahuel Posted October 13, 2007 Share Posted October 13, 2007 ^It ramains solid when using the finder tool too. Link to comment Share on other sites More sharing options...
Richard Robertson Posted October 13, 2007 Author Share Posted October 13, 2007 As I said in the first post, I designed this to provide a solution to a feature request. Also, the inner loop is simply to relieve the processor. You can always remove it and check the window location every loop, but I figured it made more sense not to. @danwilli: Nice improvement, I didn't think of that. Link to comment Share on other sites More sharing options...
Rick-O-Shea Posted October 16, 2007 Share Posted October 16, 2007 Great work guys - This is exactly what I was thinking of!!Thanx Rich & danwilli!Still think it should become part of the standard AutoIt Info-tool (see: http://www.autoitscript.com/forum/index.php?showtopic=55020) like the "Always on top".Grtz,Rick Link to comment Share on other sites More sharing options...
Richard Robertson Posted October 17, 2007 Author Share Posted October 17, 2007 Well, I only created it to help you. I don't really worry about the info window myself. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now