I really appreciate the replies that I got on my last post. I was wondering if there was any way to create a message box on how long a macro that is currently running takes from start to finish. Also I thought that I had read something about a Delay function or code in the forum that refers to not having to continually write wait commands. Such as wait>1 ... wait>1, etc. I also believe that this other command was supposed to assist helping in preventing the macro from crashing or not working properly due to having the wait time being too short to allow certain parts of the macro to run. I hope I'm making sense. I can't remember where in the forum I saw it. I'd appreciate any help.
Thanks
creating a message box that times a macro being run
Moderators: Dorian (MJT support), JRL
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
My preference is to use VBScript's Timer function which gives you seconds elapsed since midnight. Therefore the following can be used to tell you how many seconds the macro has taken from start to finish:
Alternatively just enable Logging, or use the TimeStamp command and then read the log file into Excel or similar to analyse.
Code: Select all
VBSTART
VBEND
VBEval>Timer,timerStarted
.. do something
Wait>5
VBEval>Timer-%timerStarted%,timeElapsed
MessageModal>Seconds Elapsed: %timeElapsed%
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
Macro timer
If you're interested I wrote a progress log/timer for my macro. Here is the code:
This subroutine opens a message window which stays in view. It is good for macros which take a long time. You can see progress and timing of all the steps in the macro. You can position the message window anywhere on the screen by changing the co-ordinates in the code.
Code: Select all
Let>MSG_XPOS=25
Let>MSG_YPOS=100
Let>MSG_HEIGHT=240
Let>MSG_WIDTH=240
Let>MSG_STAYONTOP=1
Let>ProgressLog=
Message>ProgressLog
SRT>ShowProgress
Sec>Seconds
Min>Minutes
Hour>Hour
ConCat>ProgressLog,%Hour%:%Minutes%:%Seconds% %ShowProgress_Var_1%%CRLF%
SetControlText>Macro Scheduler Message*,TMemo,1,%ProgressLog%
END>ShowProgress
// Call this sub-routine in your code to
// post progress to the message window:
GoSub>ShowProgress,Macro started
...
GoSub>ShowProgress,Macro finished