• Home
  • News
  • Software
  • Knowledge
  • MMO
  • Tips
  • Security
  • Network
  • Office
AnonyViet - English Version
  • Home
  • News
  • Software
  • Knowledge
  • MMO
  • Tips
  • Security
  • Network
  • Office
No Result
View All Result
  • Home
  • News
  • Software
  • Knowledge
  • MMO
  • Tips
  • Security
  • Network
  • Office
No Result
View All Result
AnonyViet - English Version
No Result
View All Result

How to measure the running time of 1 command in AutoIT

AnonyViet by AnonyViet
February 17, 2023
in Tips
0

For programmers, it is very important to use a certain command and ask it to run according to the time given by the programmer, for example: a coder writes an auto game program and then when the code operations are complete and when he runs the test, it does not work as he wants (runs in a messy way and the timeout, the execution time is not in the right order) and forces the coder to do repeat the steps and estimate the time. So how do we accurately measure each time (milliseconds) that a command runs? Specifically Autoit

Join the channel Telegram belong to AnonyViet 👉 Link 👈

AutoIT is not a powerful programming language, but it has proven itself to be a useful language right on the command line itself. Therefore, we need to measure and know how much time an instruction in a programming language takes and give a reasonable timeout.

I will guide in detail the code steps for you to understand easily:

The structure of the time measurement code is as follows:

Local $time = TimerInit() ; Lấy thời gian của hệ thống, tính bằng mili giây

; Các lệnh cần đo được chèn ở đây

Local $timedo = TimerDiff($time)
MsgBox(0, "Thời gian đo được", "Thời gian đo được là :" & @CRLF & $timedo)

Example 1: Measure the duration of the Sleep(5000) instruction

Code :

Local $time = TimerInit()
Sleep(5000)
Local $timedo = TimerDiff($time)
MsgBox(0, "Thời gian đo được", "Thời gian đo được là :" & @CRLF & $timedo)

Measured results:

How to measure the running time of 1 instruction in AutoIT 4

Example 2: Measure the time to do the math

Code :

Local $time = TimerInit()
$x = 10
$y = 5
$z = $x + $y
Local $timedo = TimerDiff($time)
MsgBox(0, "Thời gian đo được", "Thời gian đo được là :" & @CRLF & $timedo)
MsgBox(0,0,$z)

Measured results:

How to measure the running time of 1 command in AutoIT 5

Note: If you want to output the results after calculating, you must put Msgbox after the sample frame code to measure the time, if it is in the sample frame, it will also measure the time you click OK. In case you want to export the results before exporting the measured time, you must set Msgbox to output the results before Msgbox reports the measured time.

After successfully measuring an instruction, we can estimate the waiting time for the program most accurately. For example: You want to let the user wait for a certain command, but do not know how long it takes to wait, we can apply this code to measure first and use Sleep() in the most reasonable way 🙂

In addition to the above 2 code examples, you can completely measure other commands such as: measure the time to read a .txt file, measure the time to get the source code of a website, measure the time to create or delete a necessary file, …

Like Fanpage or in home page regularly to update good articles in the near future.

AnonyViet wishes you success !!

N1412

The article achieved: 5/5 – (100 votes)

Previous Post

Share Javascript programming course from basic to advanced

Next Post

Share C# programming course with Winform worth 600K

AnonyViet

AnonyViet

Related Posts

Download Vietnamese Autoit self -study curriculum for the beginning
Tips

Download Vietnamese Autoit self -study curriculum for the beginning

August 29, 2025
Share professional Microsoft Office course
Tips

Share professional Microsoft Office course

August 28, 2025
Instructions 2 ways to install Windows 11 25H2
Tips

Instructions 2 ways to install Windows 11 25H2

August 28, 2025
How to use extension to find other people’s facebook phone numbers
Tips

How to use extension to find other people’s facebook phone numbers

August 27, 2025
Tips

Download Kylerholland conversion effect on Premiere Pro

August 26, 2025
Share Code Detect Anonymous (Incognito) on Chrome
Tips

Share Code Detect Anonymous (Incognito) on Chrome

August 25, 2025
Next Post
Share C# programming course with Winform worth 600K

Share C# programming course with Winform worth 600K

0 0 votes
Article Rating
Subscribe
Login
Notify of
guest

guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments

Recent News

Instructions on how to use Live Activities on MacOS 26

Instructions on how to use Live Activities on MacOS 26

August 30, 2025
Download Vietnamese Autoit self -study curriculum for the beginning

Download Vietnamese Autoit self -study curriculum for the beginning

August 29, 2025
How to view more time zones on Mac with multitimeinmenubar

How to view more time zones on Mac with multitimeinmenubar

August 29, 2025
How to link bank accounts to VnEID to receive social benefits

How to link bank accounts to VnEID to receive social benefits

August 28, 2025
Instructions on how to use Live Activities on MacOS 26

Instructions on how to use Live Activities on MacOS 26

August 30, 2025
Download Vietnamese Autoit self -study curriculum for the beginning

Download Vietnamese Autoit self -study curriculum for the beginning

August 29, 2025
How to view more time zones on Mac with multitimeinmenubar

How to view more time zones on Mac with multitimeinmenubar

August 29, 2025
AnonyViet - English Version

AnonyViet

AnonyViet is a website share knowledge that you have never learned in school!

We are ready to welcome your comments, as well as your articles sent to AnonyViet.

Follow Us

Contact:

Email: anonyviet.com[@]gmail.com

Main Website: https://anonyviet.com

Recent News

Instructions on how to use Live Activities on MacOS 26

Instructions on how to use Live Activities on MacOS 26

August 30, 2025
Download Vietnamese Autoit self -study curriculum for the beginning

Download Vietnamese Autoit self -study curriculum for the beginning

August 29, 2025
  • Home
  • Home 2
  • Home 3
  • Home 4
  • Home 5
  • Home 6
  • Next Dest Page
  • Sample Page

©2024 AnonyVietFor Knowledge kqxs hôm nay xem phim miễn phí mm88 8XBET mm88 trang chủ new88

No Result
View All Result
  • Home
  • News
  • Software
  • Knowledge
  • MMO
  • Tips
  • Security
  • Network
  • Office

©2024 AnonyVietFor Knowledge kqxs hôm nay xem phim miễn phí mm88 8XBET mm88 trang chủ new88

wpDiscuz
0
0
Would love your thoughts, please comment.x
()
x
| Reply