[HELP] maxScript add IF Function?


Hi guys im struggling to write some simple max script.

basically I have this script:

actionMan.executeAction 0 “40072” – Snaps: Snaps Toggle
actionMan.executeAction 0 “59231” – Selection: Selection Lock Toggle

the script basically is trying to turn on both Snaps and Selection Lock at the same time.

however I have some problem when either one of the “snap” or “Lock” has been accidentally turned on. which then will result in not all of them turned On and Off at once but instead, One is On and the other One is Off.

may i know how to solve this? I thought of using “If” function in the script but im not sure how to do.

can somebody please help on this?

thank you