AutoHotkey Community

It is currently May 26th, 2012, 10:47 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: get alwaysontop state
PostPosted: August 19th, 2008, 4:01 am 
Offline

Joined: June 5th, 2007, 10:57 pm
Posts: 89
Location: USA
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???


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 19th, 2008, 6:39 am 
Offline

Joined: April 18th, 2008, 7:57 am
Posts: 1390
Location: The Interwebs
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 19th, 2008, 3:11 pm 
Offline

Joined: June 5th, 2007, 10:57 pm
Posts: 89
Location: USA
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?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 19th, 2008, 7:09 pm 
Offline

Joined: April 18th, 2008, 7:57 am
Posts: 1390
Location: The Interwebs
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject: winget alwaysontop
PostPosted: October 9th, 2008, 4:42 pm 
Offline

Joined: August 3rd, 2007, 8:01 am
Posts: 555
Location: Houston, TX
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.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: [VxE], iBob35555VR, Tilter_of_Windmills, Yahoo [Bot] and 62 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group