BasicOperations/FBConfigFile.py

BasicOperations/FBConfigFile.py
1 # Copyright 2009 Autodesk, Inc. All rights reserved.
2 # Use of this software is subject to the terms of the Autodesk license agreement
3 # provided at the time of installation or download, or which otherwise accompanies
4 # this software in either electronic or hard copy form.
5 #
6 # Script description:
7 # Opens Motionbuilder preference file and edit it.
8 #
9 # Topic: FBConfigFile
10 #
11 
12 from pyfbsdk import FBApplication, FBSystem, FBConfigFile
13 
14 lApplication = FBApplication()
15 lSystem = FBSystem()
16 lconfig = FBConfigFile("@Application.txt")
17 
18 # Updating the Undo value to 50,
19 lconfig.Set("Undo", "UndoLevel", "50", "Default is 10")
20 
21 # Getting the Keyboard mapping choice
22 lvalue = lconfig.Get("Keyboard", "Default")
23 print lvalue
24 if not (lvalue == "MotionBuilder"):
25  print "Value is being updated"
26  lconfig.Set("Keyboard", "Default", "MotionBuilder")
27 
28 # This is how you clear the file, not recommended unless you have a back up of the original
29 #lconfig.ClearFile()
30 
31 del (FBApplication, FBSystem, FBConfigFile, lApplication, lSystem, lconfig, lvalue)