Window moves when it's in the mood???

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
rjw524
Pro Scripter
Posts: 104
Joined: Wed May 09, 2012 9:45 pm
Location: Michigan

Window moves when it's in the mood???

Post by rjw524 » Mon Jan 18, 2016 4:43 pm

Hi,

I'm trying to move a window (it's the Volume Mixer actually) that I use a "run" command to bring up.

The window pops up in literally THE worst spot for the rest of the macro, so I worked for about an hour trying to figure out how to get it to move. Various combination of Handles/Window types, etc.

Finally, what worked best was the code I posted below which opens it, leave it open for a second or so, unsuccessfully tries to move it, closes it, THEN re-opens it and moves it. (that struck me as "wrong")...But even this is only working about 2 out of 3 times.

Is this a resource thing where for some reason the CPU is too busy and the move gets missed? Or is there a better way to code this?

Thanks,

rj

Code: Select all

Run>sndvol.exe
WaitReady>0
Let>WIN_USEHANDLE=0
Let>WF_TYPE=2
MoveWindow>Volume Mixer,1109,511
wait 1.0
CloseWindow>Volume Mixer
wait 0.2
Run>sndvol.exe
wait 0.5
Let>WIN_USEHANDLE=0
Let>WF_TYPE=2
MoveWindow>Volume Mixer,1109,511
wait 1.0

User avatar
JRL
Automation Wizard
Posts: 3501
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Re: Window moves when it's in the mood???

Post by JRL » Tue Jan 19, 2016 4:56 am

Try this: Note the asterisk at the end of "Volume Mixer". On my computer the window name is "Volume Mixer - Speakers (High Definition Audio Device)". The asterisk is a wildcard character that covers the rest of the name after "Volume Mixer".

Code: Select all

Run>sndvol.exe
WaitWindowOpen>Volume Mixer*
MoveWindow>Volume Mixer*,1109,511

User avatar
Marcus Tettmar
Site Admin
Posts: 7380
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Re: Window moves when it's in the mood???

Post by Marcus Tettmar » Wed Jan 20, 2016 1:45 pm

The asterisk is a wildcard character that covers the rest of the name after "Volume Mixer".
That's not actually true. In the case of the windowing functions in Macro Scheduler the asterisk just means that a substring search should be performed. So in this example the first window whose titles CONTAINS "Volume Mixer" ANYWHERE within the title will be matched. I.e. it does NOT mean that the window title must START with Volume Mixer.

That, and more, IS possible if you want via Regular Expressions but * actually means "search for a window whose title CONTAINS the preceeding text".
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

rjw524
Pro Scripter
Posts: 104
Joined: Wed May 09, 2012 9:45 pm
Location: Michigan

Re: Window moves when it's in the mood???

Post by rjw524 » Thu Jan 21, 2016 7:02 pm

Hi guys,

I added a bit more time to the wait and that seemed to solve the problem. Come to think of it that speaks to both of your points, I believe.

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