Jump to content
Macro Express Forums

Scheduled idle time macro runs infrequently


Recommended Posts

I have a macro which, for testing purposes, I have scheduled "After the computer has been idle for 2 minutes [to] run every 1 minute." However, it runs much less frequently than this. During an 18:00 (min:sec) idle interval (no keyboard or mouse use), it ran only three times, at 2:51, 10:51, and 14:31. The running time of the macro is very short - perhaps 1 sec. The macro does not simulate either keyboard or mouse. Any ideas as to why it doesn't run every 1 min after the 3-min wait?

Link to comment
Share on other sites

I have a macro which, for testing purposes, I have scheduled "After the computer has been idle for 2 minutes [to] run every 1 minute." However, it runs much less frequently than this. During an 18:00 (min:sec) idle interval (no keyboard or mouse use), it ran only three times, at 2:51, 10:51, and 14:31. The running time of the macro is very short - perhaps 1 sec. The macro does not simulate either keyboard or mouse. Any ideas as to why it doesn't run every 1 min after the 3-min wait?

 

When I get time I'll try it myself, but meanwhile are you confident nothing else is running that could invalidate the 'idle' criteria? I've never really understood whether 'idle' is defined simply as 'no keyboard or mouse activity'. 'Idle' seems obvious enough until you run a utility like Filemon or Procmon and see thousands of entries in a few seconds!

 

BTW, I take it the macro can't run without your being aware of it?

 

In your closing sentence did you mean 2-min wait?

 

---------

A little later I wrote a similar macro myself. It's set to run after 1 min of idle time and then every 2 mins. But, after 10 mins or so of staring at the inactive screen, it hasn't run once yet!

 

FWIW, here's my macro:

 

Delay: 100 milliseconds

Text Box Display: Announcement

Macro Return

 

<DELAY Flags="\x02" Time="100"/>
<TEXT BOX DISPLAY Title="Announcement" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang2057{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs16 Macro started. Will terminate in a few seconds and then run again every 2 mins.\\f1 \r\n\\par }\r\n" Left="Center" Top="Center" Width="278" Height="200" Monitor="0" OnTop="TRUE" Keep_Focus="TRUE" Mode="\x01" Delay="5"/>
<MACRO RETURN/>

 

Incidentally, surely if your macro runs every 1-min there is a high likelihood that it breaks the 2-min idle period, so there will never be another run?

 

Does the setting under the Range tab have any bearing?

 

--

Terry, East Grinstead, UK

Link to comment
Share on other sites

I revised that macro to this:

 

Delay: 100 milliseconds

Text Box Display: Announcement

Window Activate: ScheduleTest2.txt

Wait for Window Title: ScheduleTest2.txt

Text Type (Simulate Keystrokes): Time macro started (approx) =

Delay: 100 milliseconds

Delay: 100 milliseconds

Date/Time: Type out the current date/time using "hh:mm:ss" as the format

Delay: 100 milliseconds

Text Type (Simulate Keystrokes): <ENTER>

Delay: 100 milliseconds

Macro Return

 

<DELAY Flags="\x02" Time="100"/>
<TEXT BOX DISPLAY Title="Announcement" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang2057{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs16 Macro started. It will write the time to the open Textpad document then terminate and run again as specified in Activations.\\f1 \r\n\\par }\r\n" Left="Center" Top="Center" Width="278" Height="200" Monitor="0" OnTop="TRUE" Keep_Focus="TRUE" Mode="\x01" Delay="5"/>
<WINDOW ACTIVATE Title="ScheduleTest2.txt" Exact_Match="FALSE" Wildcards="FALSE" _IGNORE="0x0006"/>
<WAIT FOR WINDOW TITLE Title="ScheduleTest2.txt" Partial="TRUE" Wildcards="FALSE" Indefinite="TRUE" Hours="0" Minutes="0" Seconds="0"/>
<TEXT TYPE Action="0" Text="Time macro started (approx) = "/>
<DELAY Flags="\x02" Time="100"/>
<DELAY Flags="\x02" Time="100"/>
<DATE/TIME Format="hh:mm:ss" Flags="\x30" Date="02/01/2009 11:53:06" Day_Offset="0" Month_Offset="0" Year_Offset="0" Hour_Offset="0" Minute_Offset="0" Second_Offset="0" Left="Center" Top="Center" Monitor="0" IsDateVar="FALSE"/>
<DELAY Flags="\x02" Time="100"/>
<TEXT TYPE Action="0" Text="<ENTER>"/>
<DELAY Flags="\x02" Time="100"/>
<MACRO RETURN/>

 

It gave these results (pasted from my text editor):

 

Time macro started (approx) = 12:37:34

Time macro started (approx) = 12:40:34

Time macro started (approx) = 12:43:54

Time macro started (approx) = 12:46:54

Time macro started (approx) = 12:49:54

Time macro started (approx) = 12:53:54

Time macro started (approx) = 12:56:54

Time macro started (approx) = 13:00:44

Time macro started (approx) = 13:03:54

Time macro started (approx) = 13:06:54

Time macro started (approx) = 13:09:54

Time macro started (approx) = 13:14:04

Time macro started (approx) = 13:17:04

Time macro started (approx) = 13:20:04

Time macro started (approx) = 13:23:54

Time macro started (approx) = 13:26:54

Time macro started (approx) = 13:29:54

 

Note how the intervals are mainly 3s but sometimes 4s.

 

--

Terry, East Grinstead, UK

Link to comment
Share on other sites

I originally had the schedule for my macro set to wait 10 min, run every 15 min, but I was having the same problem as terrypin that the macro never ran, so I shortened the time to 2 min / 1 min for testing. As I understand from the explanatory material, "After the computer has been idle for m minutes, run every n minutes" means that in the absence of keyboard/mouse activity the macro will run at (m+n) minutes, (m+2n) minutes, (m+3n) minutes, etc. Thus I did mean 3 minutes in my closing question. (Actually, it would seem to make more sense to have the scheduler run the macro at m, m+n, m+2n... minutes, but I suppose that's another issue.)

 

My computer was not absolutely idle during the wait period in the sense that there were various background programs running, but nothing, as far as I know, that simulated keystrokes or mouse actions. Since terrypin's 2nd macro does simulate keystrokes I would expect a 3-min repeat time for it, based on a 2 min / 1 min schedule. My macro calls a Visual Basic executable which writes to a file, but I didn't think writing to a file constituted keyboard activity.

Link to comment
Share on other sites

Idle time is tricky due to other possible applications running on your system. One troubleshooting method I often employ is to boot to safe mode with no networking and also check the processes to make sure nothing else is running. If it works then it's a prog on your system. Then you can use MS Config or an application like Startup Cop to selectively disable applications at startup until you find the culprit. And for the record I have never seen the cause of the problem be ME, it's always been something else.

Link to comment
Share on other sites

The problem with shutting down other running processes is that one may in fact want them to be running during idle time.

 

Out of curiosity, does Macro Express use a Windows utility to determine whether there's been keyboard/mouse activity? Since keyboard/mouse activity constitutes a rather low-level input process, I would think (perhaps naively) that it would be relatively easy to reliably determine whether such activity had occurred or not.

Link to comment
Share on other sites

I wasn't suggesting you permanently disable these tasks but rather as a troubleshooting technique to determine what application is causing the problem so that you can address it. Often adware will cause such a problem and in this case you do want it off. In any case if it's another application that's tripping the inactivity timer then it's not MEP's fault. I of course don't forget that macros can cause the problem.

 

I don't know for sure but I know Windows has an inactivity timer that it uses in it's scheduler for things like firing off tasks or turning on a screen saver or suspending. I believe MEP just uses this timer but you would need to ask one of the ISS guys to confirm.

Link to comment
Share on other sites

  • 2 weeks later...

Macro Express uses its own hook system to determine if the computer has been idle. If the mouse or keyboard hooks see any activity whatsoever (this can be caused by anything injecting keystrokes or mouse movements) then the idle time is reset.

 

A lot of times there are programs that will inject an unused key into keyboard buffer to determine some state (we do this with the "Wait for Text Playback" command). Because there is a keystroke going through our hook (we cannot determine where the key came from at the hook level, btw) the idle time is reset and the countdown starts again.

 

We chose to do this because there is no system command to determine "idle" time as Windows doesn't even have a definition for idle (is it no keyboard/mouse, no CPU cycles being used by third-parties, etc?).

 

We are looking into this, but I would also take Cory's advice and start shutting down applications, just in case there is an application that is injecting keystrokes into the keyboard buffer.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...