Window sizing from Macro Scheduler

Example scripts and tips (replaces Old Scripts & Tips archive)

Moderators: Dorian (MJT support), JRL, Phil Pendlebury

Post Reply
JoshSquires
Newbie
Posts: 3
Joined: Mon Jan 31, 2022 1:50 pm

Window sizing from Macro Scheduler

Post by JoshSquires » Mon Jan 31, 2022 1:57 pm

Hello all,

I keep running into an issue when scheduling script to run before I arrive in the morning. It seems that the positioning of the window(s) is altered so when the script runs, it errors out. Is there a way to have the script resize/move the window(s) to the same spot every time?

Thanks in advance for any help.

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1347
Joined: Sun Nov 03, 2002 3:19 am
Contact:

Re: Window sizing from Macro Scheduler

Post by Dorian (MJT support) » Mon Jan 31, 2022 2:13 pm

Yes :

ResizeWindow
MoveWindow

Or just maximise it with WindowAction
Yes, we have a Custom Scripting Service. Message me or go here

JoshSquires
Newbie
Posts: 3
Joined: Mon Jan 31, 2022 1:50 pm

Re: Window sizing from Macro Scheduler

Post by JoshSquires » Mon Jan 31, 2022 6:23 pm

Ok, this makes sense. How do I handle a changing title for the window I'm trying to move or maximize?

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1347
Joined: Sun Nov 03, 2002 3:19 am
Contact:

Re: Window sizing from Macro Scheduler

Post by Dorian (MJT support) » Mon Jan 31, 2022 8:22 pm

That really depends on the nature of the change.

The question to ask is "How does the title change?"

Sometimes a simple wildcard will suffice. You'll see examples of the in the help files I linked to.

Let's say you have an Excel file open, all of the commands below would identify and move the "ThisFile.xlsx - Excel" window.

Code: Select all

MoveWindow>ThisFile.xlsx - Excel,100,100
wait>1
MoveWindow>ThisFile*,200,200
wait>1
MoveWindow>- Excel*,300,300
wait>1
Wildcards are a good place to start.
Yes, we have a Custom Scripting Service. Message me or go here

JoshSquires
Newbie
Posts: 3
Joined: Mon Jan 31, 2022 1:50 pm

Re: Window sizing from Macro Scheduler

Post by JoshSquires » Tue Feb 01, 2022 9:36 pm

Thank you for the quick responses! The file name changes based on date. With the use of the suggested wildcards, I was able to make it work. Thanks again!!

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1347
Joined: Sun Nov 03, 2002 3:19 am
Contact:

Re: Window sizing from Macro Scheduler

Post by Dorian (MJT support) » Tue Feb 01, 2022 10:14 pm

Excellent! Happy to help!
Yes, we have a Custom Scripting Service. Message me or go here

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts