Setting a KM variable with Applescript

See if this helps: