Scheduling macros at EXACT repeating times

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
Miaowara
Newbie
Posts: 4
Joined: Sat Dec 16, 2006 2:26 am

Scheduling macros at EXACT repeating times

Post by Miaowara » Sat Dec 16, 2006 3:02 am

Hello,

I have so far been unsuccessful at getting the following to work correctly:

I would like to run a certain command (play a chime, actually) on every full and half hour of the day.
How can I schedule the command to execute only on the exact full or half hour even if the start time was missed and Macro Scheduler wasn't started on the exact full or half hour)?

I hope I have clearly explained myself. Thanks for any help in advance!

mk

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

Post by Marcus Tettmar » Sat Dec 16, 2006 7:56 am

Set the start time for the next time on the hour, e.g. if it's now 9.40 make the start time 10.00. Now set a repeat interval of 30 minutes. The macro will now run at 10.00, 10.30, 11.00, 11.30 etc. If a start time is missed, it will run at the next correct start interval. So if the PC is powered off at 10.15 and not restarted until 10.45 (the 10.30 was missed) the macro will now run at 11.00. Then 11.30 ... etc.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

Miaowara
Newbie
Posts: 4
Joined: Sat Dec 16, 2006 2:26 am

Post by Miaowara » Sat Dec 16, 2006 4:11 pm

Thanks for the quick reply! So far though, I haven't found what you explained to work.

I have found that when a scheduled time is missed due to the computer being off and the computer is turned back on as you mentioned, the chimes don't continue at the half hour intervals as I'd like but waits for the scheduled initial time to roll around again the next day.

Do I have an option wrong perhaps?

In the "Run When" tab I have all day's checked, I have the chime starting at 9:00 (which was, at the time of the macro's enabling, 3 or 4 minutes in the future) and repeating every 30 minutes. In the "Advanced Options" menu I the macro repeating continuously and running at scheduled start time. It seems when I use either of the other two recovery options, the chime runs immediately whenever Macro Scheduler turns on (as the option specifies ).

Again, thanks again & I greatly appreciate your help!

A new question I have is can Macro scheduler be used to initiate a middle-mouse drag scroll (like in IE or Firefox) in programs others than those with this behavior specified? I've found a visual basic script that allows this in individual vbscripts (at least that's what I think its for).
http://www.vbaccelerator.com/home/vb/Co ... rticle.asp
However, I am unsure if this script can be used with Macro Scheduler. Power Pro, another program, is able to accomplish this but I find it at times quite buggy and was curious if Macro Scheduler could perhaps provide a most stable alternative!

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

Post by Marcus Tettmar » Mon Dec 18, 2006 8:55 am

You must leave Advanced scheduling settings to "Repeat Continuously" and "Run at scheduled start time". Then what happens is if an interval was missed, the start time cycles to the next available start time based on the interval, as I explained above. Which version of Macro Scheduler do you have? Some earlier versions did have some bugs in this regard, but the latest version works fine.

To initiate a middle mouse drag, surely all you need is:

GetCursorPos>x,y
Let>new_x=x+100
Let>new_y=y+100
MDown
MouseMove>new_x,new_y
MUp

That would click the middle mouse button and then move the mouse 100 pixels down and right. Adjust coordinates according to your requirements.

Is that what you are after?
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

Miaowara
Newbie
Posts: 4
Joined: Sat Dec 16, 2006 2:26 am

Post by Miaowara » Tue Dec 19, 2006 9:23 pm

Thank you Marcus for your help thus far.

You were right, the chime is repeating as scheduled except when I'm using a program that uses sound. In that case, the chime doesn't play though the schedule moves forward as it should.This was perhaps where my confusion was coming from before. Is there a way to have the chime play even if other programs are using sound? Right now I'm using the playwav command to play the sound.

As for the middle mouse drag, that sound like what I'm looking for but how do you make the macro always monitoring for middle mouse clicks?

thanks again

User avatar
jpuziano
Automation Wizard
Posts: 1085
Joined: Sat Oct 30, 2004 12:00 am

Post by jpuziano » Thu Dec 21, 2006 2:37 am

Miaowara wrote:the chime is repeating as scheduled except when I'm using a program that uses sound. In that case, the chime doesn't play though the schedule moves forward as it should.This was perhaps where my confusion was coming from before. Is there a way to have the chime play even if other programs are using sound? Right now I'm using the playwav command to play the sound.
Hi Miaowara,

You might try the following code lifted straight from the Macro Scheduler Help File (search for the topic LibFunc):

Code: Select all

//Use the system API Beep function to play sounds:

Let>k=200
Repeat>k
LibFunc>kernel32,Beep,r,k,50
Let>k=k+10
Until>k,1000
It makes sound using a different method so this may work even though other programs are using sound. I haven't tested that so please let us all know if it works for you.

Thanks go out to Rain who pointed out this method of making sound in the following post: computer beep? (which is why I remembered it) and of course Marcus who put that into the Help file in the first place.
jpuziano

Note: If anyone else on the planet would find the following useful...
[Open] PlayWav command that plays from embedded script data
...then please add your thoughts/support at the above post - :-)

Miaowara
Newbie
Posts: 4
Joined: Sat Dec 16, 2006 2:26 am

Post by Miaowara » Fri Dec 22, 2006 4:36 pm

Hi jpuziano,

Actually I have been playing around with the kernal beep. Haven't tested whether it plays when other audio is running though.

I've written this so far. It plays the clock tower melody and then "chimes" the number of the hour if its on the hour (minutes=0):

Code: Select all

//tone length
let>S=600
let>L=900
//rest length
let>w=0.2

//Hourly chime
Hour>h
If>h>12
Let>H=h-12
Else
H=h
Endif

LibFunc>kernel32,Beep,40,160,S
Wait>w
LibFunc>kernel32,Beep,40,130,S
Wait>w
LibFunc>kernel32,Beep,40,145,S
Wait>w
LibFunc>kernel32,Beep,40,95,L
Wait>.5
LibFunc>kernel32,Beep,40,95,S
Wait>w
LibFunc>kernel32,Beep,40,145,S
Wait>w
LibFunc>kernel32,Beep,40,160,S
Wait>w
LibFunc>kernel32,Beep,40,130,L
Wait>1

Minute=m
If>m=0
Goto>hourlyBeep
Else
Goto>end
Endif

Label>hourlyBeep
Let>k=1
Repeat>k
LibFunc>kernel32,Beep,100,130,L
Wait>.7
Let>k=k+1
Until>k=%H%+1

Label>end

lnelson
Newbie
Posts: 1
Joined: Fri May 04, 2007 9:06 pm

Post by lnelson » Fri May 04, 2007 9:20 pm

mtettmar wrote: Some earlier versions did have some bugs in this regard, but the latest version works fine.
I'm using version 6.2.2 and am having unreliable recovery of missed events. Is the latest version the answer? What is the upgrade policy for us older-than-dirt version customers? The upgrade page starts at v7.

Thanks.

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