AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

get alwaysontop state

 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
philz



Joined: 05 Jun 2007
Posts: 89
Location: USA

PostPosted: Tue Aug 19, 2008 3:01 am    Post subject: get alwaysontop state Reply with quote

it is easy to toggle alwaysontop status
Code:
winset, alwaysontop, toggle, %wintitle%

but i can't figure out how to get that value
it would seem like a good thing for winget

Any dll calls for this one???
Back to top
View user's profile Send private message Send e-mail
Krogdor



Joined: 18 Apr 2008
Posts: 1390
Location: The Interwebs

PostPosted: Tue Aug 19, 2008 5:39 am    Post subject: Reply with quote

The WinGet help wrote:
The next example determines whether a window has the WS_EX_TOPMOST style (always-on-top):

WinGet, ExStyle, ExStyle, My Window Title
if (ExStyle & 0x8) ; 0x8 is WS_EX_TOPMOST.
... the window is always-on-top, so perform appropriate action.
Back to top
View user's profile Send private message AIM Address
philz



Joined: 05 Jun 2007
Posts: 89
Location: USA

PostPosted: Tue Aug 19, 2008 2:11 pm    Post subject: Reply with quote

well that's strange. my first script sets a window to be always on top and my second script which creates a tooltip displaying windows styles doesn't show the appropriate exstyle. here's the code to set a window always on top. (it was also designed to fade all windows but the active window. it's fully functional.

Code:
#persistent

settimer, transman, 100
onexit, exiter
transstart()
return

^!a::
   mousegetpos,,,win
   wingettitle, title, ahk_id %win%
   winset, AlwaysOnTop,TOGGLE, ahk_id %Win%
   if instr(title, " - Always on top")
      winsettitle, ahk_id %win%,,% substr(title, 1, instr(title, " - Always on top"))
   else winsettitle, ahk_id %win%,,%title% - Always on top
return

transman: ;***
   makemtrans()
return ;*

exiter: ;***
winget, allwindows, list
Loop, %allwindows% {
   win := allwindows%A_index%
   wingettitle, tit, ahk_id %win%
   wingetclass, cls, ahk_id %win%
   if a_index = 1
   wingettitle, activetit, A
   if isitlegal(cls) and !(tit = activetit) {
      winset, Transparent, OFF, ahk_id %win%
   }
}
exitapp
return ;*

;fix always on top mover
;fix for active windows that shouldn't change transparency eg (find dialogues)

transstart() {
   loop, 200
   {
      thistime := a_index
      winget, allwindows, list
      Loop, %allwindows% {
         win := allwindows%A_index%
         wingettitle, tit, ahk_id %win%
         wingetclass, cls, ahk_id %win%
         if a_index = 1
            wingettitle, activetit, A
         if isitlegal(cls) and !(tit = activetit)
            winset, Transparent,% 255 - thistime, ahk_id %win%
      }
   }
   oldwin := newwin
}

makemtrans() {
   static oldwin
   winget, newwin,, A
   if !(newwin = oldwin) {
      loop, 200
      {
         if a_index = 1
            wingetclass, cls, ahk_id %oldwin%
         if isitlegal(cls)
            winset, Transparent,% 255 - a_index, ahk_id %oldwin%
         if a_index = 1
            wingetclass, cls2, ahk_id %newwin%
         if isitlegal(cls2)
            winset, Transparent,% 55 + a_index, ahk_id %newwin%
      }
   }
   oldwin := newwin
}

isitlegal(cls) {
   wingettitle, activetit, A
   return !(cls = "Button") and
      !(cls = "Progman") and
      !(cls = "SynTrackCursorWindowClass") and
      !(cls = "Shell_TrayWnd")
}
         




and here is the code I used to test exstyles
Code:

#persistent
settimer, thing, on
return

thing:
mousegetpos, x, y, win
WinGet, ExStyle, ExStyle, ahk_id %win%
tooltip, %exstyle%, % x + 5, % y + 5
return


go ahead and make a window always on top by activating it and pressing control + alt + a, then run the exstyle checking script and you may see that the styles don't match. I tested by making windows media player 11 always on top (it is transparent) though that doesn't affect the exstyle.

any ideas?
Back to top
View user's profile Send private message Send e-mail
Krogdor



Joined: 18 Apr 2008
Posts: 1390
Location: The Interwebs

PostPosted: Tue Aug 19, 2008 6:09 pm    Post subject: Reply with quote

Perhaps you should try actually following the example:

Code:
#persistent
settimer, thing, on
return

thing:
mousegetpos, x, y, win
WinGet, ExStyle, ExStyle, ahk_id %win%
If (ExStyle & 0x8)
  ExStyle = AlwaysOnTop
Else
  ExStyle = Not AlwaysOnTop
tooltip, %exstyle%, % x + 5, % y + 5
return


Tested, and it works for me.
Back to top
View user's profile Send private message AIM Address
tinku99



Joined: 03 Aug 2007
Posts: 513
Location: Houston, TX

PostPosted: Thu Oct 09, 2008 3:42 pm    Post subject: winget alwaysontop Reply with quote

Thanks.
I had blown by that example in the winget also, and had wanted to do the same thing for a while.

Part of it is the asymmetry in the way winget and winset commands are implemented...

I am glad its in there though.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group