Use one AppleScript to toggle on and off (1 or 0) I'm wondering if there's a simple way to use one AppleScript program to turn something on and off. Basically I want it to do this.

Check current pmset sms
if sms = 0 
then 
   do shell script sudo pmset -a sms 1
if sms = 1
then 
   do shell script sudo pmset -a sms 0


How would I tell it to check the current value?
To get the state I would use something like:

set sms to (do shell script"pmset -g |grep \"sms\" | awk '{print $2}'")


Then:

if sms is "0" then
  do shell script"pmset -a sms 1" with administrator privileges
else
  do shell script"pmset -a sms 0" with administrator privileges
end if


Note the "administrator privileges"  this is used  because you will not be able to use 'sudo' because there will be no interface for you to type your password.

The "administrator privileges" will display a Normal OS Authentication dialogue for you to enter the user name and password.