|
Hi, guys
I’m mixed up with this problem.
I wrote rename script and I wonder if it create memo log.txt at same time
maybe it gonna be much more usefull to use.
This is limited but if I named file like ‘test_v001_05.fbx’
when I use this script, it create ‘test_v002_01’ and ‘log.txt’.
The probrem is… this script ran first time but not second time…
Are there someway to fix this probrem?
this is my script↓
-------------------------------------------------------------------------------------------------
from pyfbsdk import*
import os
lApp = FBApplication()
lFileFullName = lApp.FBXFileName
lFilePath = os.path.dirname(lFileFullName)
lFileName = os.path.basename(lFileFullName)
lFileVerNumber = lFileName[-10:-7]
lFileNumber = lFileName[-6:-4]
lNumbers = ‘v’ + lFileVerNumber + ‘_’ + lFileNumber + ‘.fbx’
lName = lFileName.replace(lNumbers, ‘’)
lFileNewName = lName + ‘v’ + ‘d’%(1 + int(lFileVerNumber))+ ‘_01.fbx’
lMemo = FBMessageBoxGetUserValue( ‘memo’, ‘in English:’, ‘’, FBPopupInputType.kFBPopupString, ‘OK’, ‘Cancel’ )
lLog = ‘\n\n’ + lFileNewName + ‘\n’ + lMemo[1]
lLogPath = lFilePath + ‘\log.txt’
lLogOpen = open(lLogPath,’a’)
if str(lMemo[0]) == ‘1’:
if len(lMemo[1]) != 0:
lLogOpen.write(lLog)
lLogOpen.close()
lApp.FileSave(lFileNewName)
else:
FBMessageBox(’error’, ‘blank’, ‘OK’,None,None)
lLogOpen.close()
else:
FBMessageBox(’error’, ‘Cancel’, ‘OK’,None,None)
Del (lApp,lFileFullName, lFilePath, lFileName, lFileVerNumber, lFileNumber, lNumbers, lName, lFileNewName, lMemo, lLog, lLogPath)
-------------------------------------------------------------------------------------------------
motionbuilder 7.5ex2b
Python 2.5
named like this ‘test_v001_05.fbx’ and
Please drop this twice.
Thank you!
HATTORI00
p.s.
if there much easy way to write this script please
show me.. I have only self-taught knowledge.
|