I can use mouse clicks and keystrokes automation but I need the automation of changing timezone to be as fast as possible. Is apple script an answer? If yes, I can't write apple script.
What I am looking for?
The automation would be triggerd manually.
The automation would change my Mac's timezone to the specified timezone.
Great if I don't need to put in my password each time I have to change the timezone.
You can list them with -listtimezones and get with -gettimezone.
The command must be run with administrator privs, but you could add the command to your sudoers file, which I think would be relatively safe if you fully supply the command.
Your code gave error. I put your code in chatgpt. And it corrected it. I tested and it works. [When you are typing the password, which is the password with which you have locked your laptop, do not put your password inside single inverted comma]
Indirectly, yes, I suggested putting it in the sudoers file which allows specific commands to be run with admin permissions without requiring a password.
Any software running on your Mac could potentially access it (well, in theory, sandboxed software could not but in practice, who knows). Passwords should be at the least stored in the Keychain which you could do using the Set Keychain Password to Text and Set Variable to Keychain Password actions and the technique @noisneil suggested.
But I prefer using sudoers because it removes having to store your password anywhere, and it's not much of a security risk to allow anything to change your timezone.