Jump to content
Macro Express Forums

Timed Macro Madness Or Other Suggestions?


Recommended Posts



I have some pesky PVR software that locks up if I record with TimeShift mode longer than 6 hours.

(it's a bug with the software)


Timeshift lets you start playing back video from the PVR software while still recording the end of the show.


Anyway.. my PVR software uses 'Alt+r' to start timeshift recording and 'Alt+s' to stop timeshift recording.


I want a macro that when timeshift recording starts, that it won't allow for a recording longer than 6 hours.. BUT I want to be able to abort out of that macro if nesessary.


Is their a way to have a timed macro, but abort out of when another macro is run, and while this is all going on.. have any other macro's also still work.


I understand this would involve use of Logic comands?

Unfortunately the format 'logic' and my brain are not good companions. (grin)


I wonder if someone could advise total newbie how best to achieve the above?.


I found the 'Timed' commands, and both timed delay and timed lapse work, but I don't know how to break out of the macro in progress, and all my other macros stop working while the time delay/lapse is running.


I realise this is by design, but wonder what the correct way of doing this is?


eg. For what I wish to do with the PVR timeshift record limit.. the following script works, but obviously hangs MacroExpress until the timed period is over.


Text Type: <alt>r

Wait Time Lapse: 360 Minutes 0 Seconds

Text Type: <alt>s



Is it possible to add the ability to the above script to end the macro if another macro is run containing 'Text Type: <alt>s' ?




Link to comment
Share on other sites



i'm new too!

? try;


1. macro1 to start recorder and write time file to finish at.. "recordtime.txt"

2. macro2 to check the file every 10 mins/ 10secs etc depending how critical (see the answer tomy question about starting program on another computer last week)

3. macro3 to change the txt file to abort early, or just "alt-s" or whatever

4 other macros can still run in between times.


Best, randall -What do you think?

Link to comment
Share on other sites

Thanks for the reply!.


Never actually thought of doing it that way.


Am still a bit lost tho....


ie. I can create a text file, and put in a variable for the current time into the text file, BUT how does one then automatically add 6 hours to that time, which will be where I want the recording to stop?.



Link to comment
Share on other sites

I can create a text file, and put in a variable for the current time into the text file,  BUT how does one then automatically add 6 hours to that time, which will be where I want the recording to stop?.


I wanted to see this too; would others comment on my macro?- ANy better ways?


I assume you have already saved your initial file, and compare current hour with hour of creation/ modification;

(using Macro2 as above running every so often as a check;)




[LATER - please see better answers re date time differences etc in;]

DATE formats, differences discussion


** Be WARNED; I am a novice; change the filename too if you are going to try it!, and save file first; make a functional "Timer" macro as macro3 too?


    // Set %N1% hour, %N2% min, %N3% sec from previously saved file
   Variable Set From File Date/Time
   // Set %N21% hour, %N22% min, %N3% sec from current time
   Variable Set Integer %N21% from Current Hour
   Variable Set Integer %N22% from Current Minute
   Variable Set Integer %N23% from Current Second
   // Add 24 hours if current hour less than hour at which saved (assumes no
   If Variable %N21% < variable %N1%
    Variable Modify Integer: %N21% = %N21% + 24
   End If
   // Differences
   Variable Modify Integer: %N31% = %N21% - %N1%
   Variable Modify Integer: %N32% = %N22% - %N2%
   Variable Modify Integer: %N33% = %N23% - %N3%
   // Check hours
   If Variable %N31% < 6
    Macro Return
   End If
   // Check mins
   If Variable %N32% < 0
    Macro Return
   End If
   // Checksecs
   If Variable %N33% < 0
    Macro Return
   End If
   Text Box Display: Difference
   Macro Run: Timer

<REM2:Set %N1% hour, %N2% min, %N3% sec from previously saved file><VFFILE:0:1:F:1:F:1:F:1:T:1:T:2:T:3:C:\Program Files\Macro Express3\SavedVars.txt><REM2:Set %N21% hour, %N22% min, %N3% sec from current time><IVAR2:21:20:><IVAR2:22:21:><IVAR2:23:22:><REM2:Add 24 hours if current hour less than hour at which saved (assumes no interruption!)><IFVAR2:5:21:3:N1><NMVAR:01:21:1:0000021:2:0000024><ENDIF><REM2:Differences><NMVAR:02:31:1:0000021:1:0000001><NMVAR:02:32:1:0000022:1:0000002><NMVAR:02:33:1:0000023:1:0000003><REM2:Check hours><IFVAR2:2:31:3:6><MRETURN><ENDIF><REM2:Check mins><IFVAR2:2:32:3:0><MRETURN><ENDIF><REM2:Checksecs><IFVAR2:2:33:3:0><MRETURN><ENDIF><TBOX4:T:1:CenterCenter000278000200:000:Differencehours=%N31%;;mins=%N32%;;secs=%N33%

Edited by randallc
Link to comment
Share on other sites

Wow.... your losing me.


What I have done is found a command that types the current system time into a variable T1


I then do the same command, but choose a 'Future' time for the hour component of the time, and save that as a variable T2


I then used a variable modify command to save the T2 variable into a text file called c:\end record time.txt


The above results in a text file on c drive with the above name, and contains one line, which the end record time. (the origin time plus the 6 hours I want)


So.. I assume this accomplishes one part of your suggestion?.



Now, I believe I have to process the text file, and somehow use it as a trigger file to activate the PVR software's stop button when that future time in the text file is reached.



ie.. To summarise.


I create a variable T1 which is current system time. eg. 12:00 pm

I create a second variable T2 that adds 6 hours to variable T1, and saves the result

in a text file, which would end up being 6:00 pm


I do the above in about 3 lines of script.


So, I now need to figure out what next?


I thought perhaps there is some way to compare current system time against the desired end record time in the text file, and then have a macro that simply stops the PVR software. ie. <alt>s



(grin)... wow... your script looks way cooler than my crappy attempt.




Link to comment
Share on other sites

Hi again,


Yes, I found i was going to have trouble comparing date and time in the text file, so used the hour of creation/ modification (command under variables list). (Minute and seconds can be used as well for accuracy as I showed)


If we had an excel type date/time stamp that returned an integer for system time, I would not have done this. Perhaps someone knows how/..


best, Randall


(PS, you are right, that i have not gone into the other details of the trigger file being deleted of course, just the conundrum you mentioned of comparing times.)


(PS2 Do you see if you copy the "direct" code into your direct editor, say in "try1macro" to start a new one, you can then swap to script editor and see the commands I have written (whether accurate or not!)

Link to comment
Share on other sites

Date and Time stamp 'math' is available in the PGM Functions Library written by Joe Weinpert and Paul Thornett of Professional Grade Macros. Through a marketing agreement you can purchase the PGM Functions Library from Insight Software Solutions (the makers of Macro Express).


The PGM Functions Library is available for a 30-day trial so you can see if it will do what you need. For a small cost you can access over 100 functions in your macros. It is well worth the money in time savings alone. For more information visit: www.macros.com/products.htm or www.pgmacros.com/pgm_functions.htm.


Note that Professional Grade Macros is the host of this Discussion Forum.

Link to comment
Share on other sites

Hello Randall!


The macros within the PGM Functions Library depend on each other to run. One macro calls another, and so forth.


The best thing to do is to create a separate category in your library (.mex) file to hold the PGM macros and import all of them from our library to yours and into this new category.


If you are interested only in a subset of the macros, then review the Function Dependency chapter in the manual to determine which macros to import.


Thanks for your interest!

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.

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.

  • Create New...