send variable between 2 scripts
Hi
I am trying to send a variable from one script to another.
When I click on script "test02", I activate "test03". I want "test03" to send the variables to "test02" to display BatchNumberLoading, BatchNumberTotal and Progressbar. It is to follow the export.
I reduced my code to focus on my problem
I know that the code below is not well placed,I do not know where to place it
BatchNumberTotal.text= theFilesNumber as string BatchNumberLoading.text= theFilesCurrent as string
But the mark value received is "undefined"
Do you have an idea? Thx
Test02.ms
( -- BatchNumberTotal.text = theFiles as string -- BatchNumberLoading.text = f as string PathBatchMAX = "C:\Users\PC_new\Documents\Perso\Script\Test03.ms" rollout test02 "test02" ( group ".max" ( button btn_SaveMaxBatch "Batch copy" align:#right toolTip:"Current version useless and 3 previous versions!" ) label BatchNumberLoading "No Value" align:#right across:3 label BatchNumberSeparate "/" align:#center width:10 label BatchNumberTotal "No Value" align:#left Progressbar loading color: [169,38,158] height:20 align:#right on btn_SaveMaxBatch pressed do ( fileIn PathBatchMAX BatchNumberTotal.text= theFilesNumber as string BatchNumberLoading.text= theFilesCurrent as string ) ) -- end rollout createDialog test02 220 120 )
Test03.ms
Clearlistener() ( thePath = getSavePath()--get a path dialog to specify the path if thePath != undefined do--if the user did not cancel ( theFiles = getFiles (thePath+"\\*.max") --collect all max files in the dir. theFilesNumber=theFiles.count theFilesCurrent=theFilesNumber-theFilesNumber print (theFilesCurrent as string + "/" + theFilesNumber as string) for f in theFiles do-- go through all of them ( loadMaxFile f--load the next file ----------------------------------------------------------- -- MAKE SOME SCRIPTED CHANGES TO THE SCENE HERE... ----------------------------------------------------------- ----------------------------------------- -- SAVE MAX START ----------------------------------------- -- temp_node = box() -- temp_node.name = substituteString maxfilename ".max" "" -- fileName = temp_node.name -- delete temp_node -- saveMaxFile (MaxFilePath+fileName+"_new.max") useNewFile:false -- print (fileName) ----------------------------------------- -- SAVE MAX END ----------------------------------------- ----------------------------------------- -- COUNT StART ----------------------------------------- theFilesCurrent=theFilesCurrent +1 fileNameCurrent=substituteString f thePath "" ----------------------------------------- -- COUNT END ----------------------------------------- print (theFilesCurrent as string + "/" + theFilesNumber as string) print (fileNameCurrent as string + " SAVE") )--end f loop resetMaxFile #noPrompt --at the end, you can reset -- BatchNumberTotal=theFiles )--end if )
Comments
Thank you for your answer.
Thank you for your answer. It's good!
I added Progressbar and scene name loading.
Thx again ;)
.
Test this:
Or make the theFilesNumber and theFilesCurrent global so both script to have access to them.
Tools and Scripts for Autodesk 3dsMax