How to calculate time to execute macro image pro plus
Hi YuriG
How to calculate time to execute macro image pro plus
Thank You
How to calculate time to execute macro image pro plus
Thank You
0
Answers
-
You can use GetTickCount, which should be declared as:' Declare the Windows call to retrieve the time in millisecondsDeclare Function GetTickCount Lib "kernel32" Alias "GetTickCount" () As Longthen you call this function before and after the macro and calculate the difference, which will give you the macro execution time in milliseconds.
Example:' Declare the Windows call to retrieve the time in milliseconds Declare Function GetTickCount Lib "kernel32" Alias "GetTickCount" () As Long Sub Test Dim t1 As Long, t2 As Long t1=GetTickCount 'Call MyMacro t2=GetTickCount Debug.Print "Time = " & (t2-t1) End Sub
Yuri
0 -
Another method using functions already in the code is as follows:
Sub TimeTest()
Dim startTime As Date
Dim endTime As Date
Dim diffTime As Date
' Wait some duration
startTime = Time ' Record starting time
Wait(5) ' Your processing here...
endTime = Time ' Record end time
' Find the difference between the two
diffTime = endTime - startTime
' In "Date" variables the whole value gives the date, while the fraction
' is the time of day. Here the difference is scaled by 24 hours,
' 60 minutes, and 60 seconds to obtain the difference in seconds.
Debug.Print CDbl(diffTime) * 24*60*60; " seconds."
End Sub
The output from this on my machine is:5.0939999999974 seconds.0 -
Thank you very much, your answers are quick and useful.you are very friendly.Best regards ...
Carlos0
Categories
- All Categories
- 961 Image-Pro v9 and higher
- 9 Image-Pro FAQs
- 18 Image-Pro Download & Install
- 448 Image-Pro General Discussions
- 486 Image-Pro Automation (Macros, Apps, Reports)
- 20 AutoQuant Deconvolution
- 2 AutoQuant Download & Install
- 18 AutoQuant General Discussions
- 195 Image-Pro Plus v7 and lower
- 3 Image-Pro Plus Download & Install
- 106 Image-Pro Plus General Discussions
- 86 Image-Pro Plus Automation with Macros
- 19 Legacy Products
- 16 Image-Pro Premier 3D General Discussions
- 26 Image-Pro Insight General Discussions