What's the difference between a Timer and using a while loop?

Advanced Macro Recorder/Editor.

Moderator: Pulover

Perois2
Posts: 4
Joined: 14 Jan 2021, 16:30

What's the difference between a Timer and using a while loop?

05 Nov 2021, 21:13

And what scenarios would I want to use each?
Lepes
Posts: 141
Joined: 06 May 2021, 07:32
Location: Spain

Re: What's the difference between a Timer and using a while loop?

07 Nov 2021, 05:46

Basically a while loop is a CPU time consuming task, it means your code is always running inside the loop.

A Timer uses internal chronos of your PC, if you program a timer for 1 second, CPU is free to do other tasks and when reach 1 second, your app receives a message that makes your code to be executed.

While loop says to the computer: "while this condition is true, do those instructions"
A Timer says to the computer: "Whenever a fixed time pass, call me"

Personally, If I can use a Timer, I won't use a while loop.

Return to “Pulovers Macro Creator”

Who is online

Users browsing this forum: No registered users and 4 guests