pomj Posted February 23, 2007 Share Posted February 23, 2007 Hi, I'm a newbie to autoit programming so I aplogize if I have missed something obvious. I'm trying to implement some window managing functions I've come to appreciate while using larswm in linux and I wonder how I get the "real" desktop workarea. I tried @DesktopWidth and @DesktopHeight but these macros seems to ignore the taskbar. cheers /michael Link to comment Share on other sites More sharing options...
James Posted February 23, 2007 Share Posted February 23, 2007 @DesktopHeight/Width include the whole desktop. I think I see what you want to do, like in Linux, programs cant run over the "taskbar" so you want to make it the same in Windows? Well, you can use @DesktopHeight - 2 or whatever, so you can resize the area in which it selects or whatever. Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
Shevilie Posted February 23, 2007 Share Posted February 23, 2007 Well to use that you would have to know the heigt of the taskbar (since the user can change that), and you would have to check the taskbars place AND if the user have custom lines.. So I guess theres no good way to get it A simple but ugly way would be making a gui maximize it and then read its height and width - ugly but it should work.. I dont know if you can do this with @SW_HIDE Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit Link to comment Share on other sites More sharing options...
James Posted February 23, 2007 Share Posted February 23, 2007 I think there is somewhere a script which will determine where the taskbar is. Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
Shevilie Posted February 23, 2007 Share Posted February 23, 2007 Hmm can get it to work Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit Link to comment Share on other sites More sharing options...
James Posted February 23, 2007 Share Posted February 23, 2007 ? Ok, that made absolutely no sense? Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
Shevilie Posted February 23, 2007 Share Posted February 23, 2007 My script... the thing I was suggesting Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit Link to comment Share on other sites More sharing options...
James Posted February 23, 2007 Share Posted February 23, 2007 Oh right It could work though. But I don't know how you would find out where on the screen the taskbar is.. Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
Shevilie Posted February 23, 2007 Share Posted February 23, 2007 Well if i maximize the window correctly - it would give me the height and the widtt of the workarea And you cant really use the taskbar, since people have sometimes more than one.. (people like me) and the other taskbar is also on top Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit Link to comment Share on other sites More sharing options...
James Posted February 23, 2007 Share Posted February 23, 2007 So.. If people have more than one taskbar, it would still only get the height/width of the window, which is still the work area. Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
Danny35d Posted February 23, 2007 Share Posted February 23, 2007 Like Shevilie said before "you would have to know the heigt and width of the taskbar (since the user can changed)" #include <GUIConstants.au3> Opt("WinTitleMatchMode", 4) $Pos = WinGetPos("classname=Shell_TrayWnd") $Pos[3] = @DesktopHeight - ($Pos[3] + 32) $Form1 = GUICreate("AForm1", $Pos[2], $Pos[3], -1, -1) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line Link to comment Share on other sites More sharing options...
James Posted February 23, 2007 Share Posted February 23, 2007 Yeah. And now you have done it Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
therks Posted February 23, 2007 Share Posted February 23, 2007 Of course, you should really do some more checking as the taskbar can be placed on any of the four sides of the screen. I wonder if there is some API call that gets the "working area" (for lack of a better term) of the screen. I mean, when a Window receives the maximize notification it has to get the size info from somewhere... right? My AutoIt Stuff | My Github Link to comment Share on other sites More sharing options...
Shevilie Posted February 23, 2007 Share Posted February 23, 2007 But I wonder - Why would you like to have it As you can maximize the thing you are working with Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit Link to comment Share on other sites More sharing options...
therks Posted February 23, 2007 Share Posted February 23, 2007 (edited) Well I once wanted this information for a program I was writing to simulate the "toast" style popups of MSN messenger. You know when a user logs on and a small window slides onto the screen from the bottom right? I ended up writing a bunch of code to detect where the taskbar was, what position it was in, etc, etc. So that when I slid the window onto the screen it would end up in the right place (I allowed for custom position of where the window would slide from/to ie: top-right slide from top, bottom-right slide from right, etc). I lost the script which was unfortunate at the time, but not so bad now as it probably wouldn't even work with AutoIt now (lots of changes to the GUI stuff). So now with DllCall being available to us, I just wonder if there was not some easier way for me to get the available area of the screen. Also, I like your maximized window idea... I'll have to try that. *Edit: Hmm.. some confusiing results. First, I don't think you can maximize a window while it's hidden, and using the $WS_MAXIMIZE style creates a fullscreen window (ie: maximized over the taskbar), so that doesn't help. Second: Maximizing after it's visible and then doing WinGetPos yields (on my resolution of 1280x800) a window width/height of 1286x756. So the width ends up larger than the actual screen. Edited February 23, 2007 by Saunders My AutoIt Stuff | My Github Link to comment Share on other sites More sharing options...
James Posted February 23, 2007 Share Posted February 23, 2007 I remember seeing someone has done that already. Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
Danny35d Posted February 23, 2007 Share Posted February 23, 2007 Of course, you should really do some more checking as the taskbar can be placed on any of the four sides of the screen. I wonder if there is some API call that gets the "working area" (for lack of a better term) of the screen. I mean, when a Window receives the maximize notification it has to get the size info from somewhere... right?Until somebody comes with an API call this does the trick. #include <GUIConstants.au3> Opt("WinTitleMatchMode", 4) $Pos = WinGetPos("classname=Shell_TrayWnd") If $Pos[2] <> @DesktopWidth Then $Pos[2] = @DesktopWidth - $Pos[2] If $Pos[3] <> @DesktopHeight Then $Pos[3] = @DesktopHeight - ($Pos[3] + 32) Else $Pos[3] -= 32 EndIf $Form1 = GUICreate("AForm1", $Pos[2], $Pos[3], -1, -1) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted February 23, 2007 Moderators Share Posted February 23, 2007 I remember seeing someone has done that already.You really should just not post. You never have anything valid to say... 2 or 3 times in this thread alone, you've said... "Someone has done it"... no shit... why don't you find it. 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 comment Share on other sites More sharing options...
Moderators SmOke_N Posted February 23, 2007 Moderators Share Posted February 23, 2007 Until somebody comes with an API call this does the trick. #include <GUIConstants.au3> Opt("WinTitleMatchMode", 4) $Pos = WinGetPos("classname=Shell_TrayWnd") If $Pos[2] <> @DesktopWidth Then $Pos[2] = @DesktopWidth - $Pos[2] If $Pos[3] <> @DesktopHeight Then $Pos[3] = @DesktopHeight - ($Pos[3] + 32) Else $Pos[3] -= 32 EndIf $Form1 = GUICreate("AForm1", $Pos[2], $Pos[3], -1, -1) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd@Danny35... I've done this type of stuff before, believe I've posted it even (maybe that's what Secure_IT is talking out his ass about)... anyway... If I can offer a suggestion. My taskbar height is larger than standard... to make sure I don't error on the height and width, I use ControlGetPos(). 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 comment Share on other sites More sharing options...
therks Posted February 24, 2007 Share Posted February 24, 2007 (edited) Heh, when I run that code, it tries to create a window with width/height of -4 x 716. Here, I just wrote this function and tested it quickly. It returns a string of Top, Right, Bottom, or Left depending on what side of the screen the taskbar is on. Just a little concept function. Gives an idea of how something more complex can be accomplished. Func _GetTaskbarSide() Local $h_Wnd, $a_Pos Local $i_WTMM = Opt('WinTitleMatchMode', 4) Local $v_Return = 0 Do $h_Wnd = WinGetHandle('classname=Shell_TrayWnd') If @error Then SetError(1) ExitLoop EndIf $a_Pos = WinGetPos($h_Wnd) If $a_Pos[0] < 0 AND $a_Pos[1] < 0 Then If $a_Pos[2] > @DesktopWidth Then $v_Return = 'Top' Else $v_Return = 'Left' EndIf ElseIf $a_Pos[1] < 0 Then $v_Return = 'Right' Else $v_Return = 'Bottom' EndIf Until True Opt('WinTitleMatchMode', $i_WTMM) Return $v_Return EndFunc *Edit: Maybe later after I get some sleep (just got home from work, it's like 0530hrs) I'll finally get off my butt and rewrite the code to actually figure out the usable desktop area. Edited February 24, 2007 by Saunders My AutoIt Stuff | My Github 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