Technical support and scripting issues
Moderators: JRL, Dorian (MJT support)
-
JRL
- Automation Wizard
- Posts: 3529
- Joined: Mon Jan 10, 2005 6:22 pm
- Location: Iowa
Post
by JRL » Wed Feb 27, 2008 11:06 pm
Code: Select all
______________________________
| Title Bar |
|_____________________________|
| |
| |
| ____________ |
| | Ok | |
| |___________| |
|_____________________________|
______________________________
| Title Bar |
| |
|_____________________________|
| |
| |
| ____________ |
| | Ok | |
|________|___________|________|
There is no good way that I've found to acquire information about the size of the working area of a dialog. The specified dialog size includes the borders and more importantly the title bar. The title bar height is contingent on multiple user specifiable parameters. A large title bar cuts into the working area (See diagram above). There is a GetWindowInfo API call that could provide this info. Unfortunately it requires a "Pointer to a structure". Marcus has stated
this is not currently possible in Macro Scheduler.
Does anyone have any thoughts on this? Has an answer been posted and I missed it?
Thank you
Dick
-
pgriffin
- Automation Wizard
- Posts: 460
- Joined: Wed Apr 06, 2005 5:56 pm
- Location: US and Europe
Post
by pgriffin » Thu Feb 28, 2008 12:33 am
Just curious...Why do you need the "working" area of a dialog and are these dialogs that you write or from other apps?
-
jpuziano
- Automation Wizard
- Posts: 1085
- Joined: Sat Oct 30, 2004 12:00 am
Post
by jpuziano » Thu Feb 28, 2008 12:46 am
Hi
JRL,
I'm curious as well... is this for code that writes code? Something that can auto-adjust the positioning of controls on a dialog perhaps?
JRL wrote:There is a GetWindowInfo API call that could provide this info. Unfortunately it requires a "Pointer to a structure". Marcus has stated
this is not currently possible in Macro Scheduler.
Maaaaaaybe it will be possible in the future??

?? Seems like it would open up a lot more Win32 API calls if LibFunc could handle more than integers and strings but only Marcus knows if this is feasible.
Marcus, is this a "no way, forget it"... or could this one day be possible with Macro Scheduler?
-
Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
-
Contact:
Post
by Marcus Tettmar » Thu Feb 28, 2008 7:58 am
LibFunc cannot handle data structures and types that MacroScript itself doesn't know anything about. MacroScript is not a typed language. By default it even hides the difference between strings, integers and reals from you. Beginners need not care about specifying type. So to add memory pointers and complex types to the language? That's a pretty big paradigm shift. I never rule anything out, but that needs careful thought!
-
Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
-
Contact:
Post
by Marcus Tettmar » Thu Feb 28, 2008 9:13 am
JRL wrote:Code: Select all
______________________________
| Title Bar |
|_____________________________|
| |
| |
| ____________ |
| | Ok | |
| |___________| |
|_____________________________|
______________________________
| Title Bar |
| |
|_____________________________|
| |
| |
| ____________ |
| | Ok | |
|________|___________|________|
There is no good way that I've found to acquire information about the size of the working area of a dialog. The specified dialog size includes the borders and more importantly the title bar. The title bar height is contingent on multiple user specifiable parameters. A large title bar cuts into the working area (See diagram above). There is a GetWindowInfo API call that could provide this info. Unfortunately it requires a "Pointer to a structure". Marcus has stated
this is not currently possible in Macro Scheduler.
Does anyone have any thoughts on this? Has an answer been posted and I missed it?
Thank you
Dick
I've made you a small DLL which wraps the GetWindowInfo function to get the info you need:
http://www.mjtnet.com/software/getwinclient.zip
The zip contains the DLL and an example script which should be self explanatory.
-
JRL
- Automation Wizard
- Posts: 3529
- Joined: Mon Jan 10, 2005 6:22 pm
- Location: Iowa
Post
by JRL » Thu Feb 28, 2008 2:25 pm
Thank you Marcus. I've yet to try the DLL but it appears that this is exactly what I need. Actually anyone distributing scripts will probably want this. I'll try to work up a generic example and a more detailed explanation when I have the time.
Again... Thank you Marcus for a great product and remarkable support.
Thanks for listening,
Dick
-
JRL
- Automation Wizard
- Posts: 3529
- Joined: Mon Jan 10, 2005 6:22 pm
- Location: Iowa
Post
by JRL » Wed Mar 11, 2009 7:00 pm
jpuziano pointed out that I had promised a sample of how to use getclient.dll. There is actually a Marcus provided usage sample that comes in the downloadable zip file. However, I also submitted a sample script a while back located
HERE. The DLL is put to use on line 73 (as posted)
Hope this is helpful
-
jpuziano
- Automation Wizard
- Posts: 1085
- Joined: Sat Oct 30, 2004 12:00 am
Post
by jpuziano » Wed Mar 11, 2009 7:05 pm
Thanks JRL
-
Grovkillen
- Automation Wizard
- Posts: 1132
- Joined: Fri Aug 10, 2012 2:38 pm
- Location: Bräcke, Sweden
-
Contact:
Post
by Grovkillen » Wed May 24, 2023 9:10 am
I got this working (to get maximized vs. NOT maximized). Just like how Microsoft didn't use the nomenclature isMinimized but isIconic we didn't get the isMaximized but isZoomed... but here's the proof of concept.
Code: Select all
Let>WIN_USEHANDLE=1
Run>Notepad.exe
Wait>1
GetActiveWindow>WINDOW_HANDLE,,,,
LibFunc>User32,IsZoomed,IS_THE_WINDOW_MAXIMIZED,WINDOW_HANDLE
MDL>IS_THE_WINDOW_MAXIMIZED
WindowAction>1,WINDOW_HANDLE
Wait>0.5
LibFunc>User32,IsZoomed,IS_THE_WINDOW_MAXIMIZED,WINDOW_HANDLE
MDL>IS_THE_WINDOW_MAXIMIZED
WindowAction>0,WINDOW_HANDLE
Wait>0.5
LibFunc>User32,IsZoomed,IS_THE_WINDOW_MAXIMIZED,WINDOW_HANDLE
MDL>IS_THE_WINDOW_MAXIMIZED
Keywords: How to determine if window is maximized. Window state maximized
-
JRL
- Automation Wizard
- Posts: 3529
- Joined: Mon Jan 10, 2005 6:22 pm
- Location: Iowa
Post
by JRL » Wed May 24, 2023 4:12 pm
Marcus posted this back in 2006. Slightly different than what you have come up with.
viewtopic.php?f=3&t=3124
Also, though I appeciated Marcus' excellent getclient.dll and used it for a couple of years, I eventually started using a short old style dialog to acquire the titlebar and border size information. The dialog does not require passing the dll along with executable scripts.
Code: Select all
Dialog>TitleBarSizeCalculation
Button=1,0,0,0,0,0
EndDialog>TitleBarSizeCalculation
Let>WIN_USEHANDLE=1
MoveWindow>TitleBarSizeCalculation.handle,0,0
GetWindowPos>TitleBarSizeCalculation.msButton1.handle,OffSetX,OffSetY
Let>WIN_USEHANDLE=0
The height of the titlebar is OffsetY and the border width is OffsetX
-
Grovkillen
- Automation Wizard
- Posts: 1132
- Joined: Fri Aug 10, 2012 2:38 pm
- Location: Bräcke, Sweden
-
Contact:
Post
by Grovkillen » Wed May 24, 2023 4:52 pm
Thanks for that JRL. I did try to find information about getting maximized status but the search came up empty. I guess my searching skills didn't do me good this time.
-
JRL
- Automation Wizard
- Posts: 3529
- Joined: Mon Jan 10, 2005 6:22 pm
- Location: Iowa
Post
by JRL » Thu May 25, 2023 2:32 am
I'm rarely as likely to remember information handed to me as information I had to work for. I enjoy the adventure.
As for searching. I had the advantage of having a script that contained the code in Marcus' post so I searched for "IsZoomed" then skipping over your entry left only four matches.