# Copyright 2009 Autodesk, Inc.  All rights reserved.
# Use of this software is subject to the terms of the Autodesk license agreement 
# provided at the time of installation or download, or which otherwise accompanies
# this software in either electronic or hard copy form.
#
# Script description:
# Opens Motionbuilder preference file and edit it.
#
# Topic: FBConfigFile
#

from pyfbsdk import FBApplication, FBSystem, FBConfigFile

lApplication = FBApplication()
lSystem = FBSystem()
lconfig = FBConfigFile("@Application.txt")

# Updating the Undo value to 50, 
lconfig.Set("Undo", "UndoLevel", "50", "Default is 10")

# Getting the Keyboard mapping choice
lvalue = lconfig.Get("Keyboard", "Default")
print lvalue
if not (lvalue == "MotionBuilder"):
        print "Value is being updated"
        lconfig.Set("Keyboard", "Default", "MotionBuilder")

# This is how you clear the file, not recommended unless you have a back up of the original
#lconfig.ClearFile()

del (FBApplication, FBSystem, FBConfigFile, lApplication, lSystem, lconfig, lvalue)