• 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

How to quickly compare the content of 2 Excel files
Tips

How to quickly compare the content of 2 Excel files

June 24, 2026
How to create funny selfies with pets for your pets
Tips

How to create funny selfies with pets for your pets

June 19, 2026
Chrome extension not working error and the fastest way to fix it
Tips

Chrome extension not working error and the fastest way to fix it

June 19, 2026
Instructions to receive Claude Fable 5 for free for 30 days
Tips

Instructions to receive Claude Fable 5 for free for 30 days

June 15, 2026
Delete all Event Logs on Windows to remove traces of activity
Tips

Delete all Event Logs on Windows to remove traces of activity

June 15, 2026
Instructions for creating Minecraft-style food photos
Tips

Instructions for creating Minecraft-style food photos

June 9, 2026
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

How to create luxurious portrait photos using the Dola app

How to create luxurious portrait photos using the Dola app

June 24, 2026
How to quickly compare the content of 2 Excel files

How to quickly compare the content of 2 Excel files

June 24, 2026
How to get a free domain for 1 year from Gravatar

How to get a free domain for 1 year from Gravatar

June 23, 2026
Instructions on how to use Gemini Omni to create realistic videos

Instructions on how to use Gemini Omni to create realistic videos

June 23, 2026
How to create luxurious portrait photos using the Dola app

How to create luxurious portrait photos using the Dola app

June 24, 2026
How to quickly compare the content of 2 Excel files

How to quickly compare the content of 2 Excel files

June 24, 2026
How to get a free domain for 1 year from Gravatar

How to get a free domain for 1 year from Gravatar

June 23, 2026
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

How to create luxurious portrait photos using the Dola app

How to create luxurious portrait photos using the Dola app

June 24, 2026
How to quickly compare the content of 2 Excel files

How to quickly compare the content of 2 Excel files

June 24, 2026
  • Home
  • Home 2
  • Home 3
  • Home 4
  • Home 5
  • Home 6
  • Next Dest Page
  • Sample Page

6789 kv999

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

6789 kv999

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