isolate number from format string with quote ""
Hi all :)
They are the last details of my script (Environment Lighting HDR Studio (MR) ) but now I've a problem that I can not solve...
I want to enter parameters in rollut taking them from a txt file, but the info in file txt are written as Reflections (Subactive Color): (color 255 255 255) or Glossines: 8.0 ecc.. Now I know this form to isolate number from string array:
test = "Max Distance FallOff: 2.0" strArr = filterString test " " valuespinner = strArr[4] as float print valuespinner
but I can not transfer ONLY values in rollout, because I always error of various kinds (!)
If I try with "openFile" and "readValue", (for read the file txt) I've always the result, for example, "scale()", but never specific value. I had no trouble writing values to and from .txt, but now I can not do this..
The question is very simple: How isolate a number from a string with quote "" and restore the values of spinner etc. the rollout reading a file .txt?
Any help is very important to me :D
Thanks
Michele71

Comments
`
why not go with loop and case (of course after filtering)
so if you have strArr array:
just an idea.
value is always next after name
and "Glossines:" u have probably as a rollout elements .text
It doesn't work for color but than you can do
(color (strArr[i+2] as float) (strArr[i+3] as float) (strArr[i+4] as float))ah but u need to have written in file "Glossy_Sample" instead of "Glossy Sample"
or remove spaces before writing so you get "GlossySample"
Thanks pixamoon :) Before
Thanks pixamoon :)
Before posting my question, I have tried a simil loop, but without success. Now I perform also your advice and see what appears!
Thanks for your patience and response :)
sure
thats the 1st way (loop every line to get values):
and this is 2nd (append all single words to one array and than loop it and search for values)
Of course you need single words, like "Glossines:", "GlossySample" etc
What you think ?
Yea, I'm doing the tests, but
Yea, I'm doing the tests, but I think the concept is right ;) I try to do the tests then I'll know!
thanks again!!!!
reading form txt
I think dotnet methods will help
Maybe this will help. Take a look on http://www.scriptspot.com/3ds-max/scripts/read-data-from-csv-txt
the quote there is "|" but you can easily change to other quote I think.
Best,
Yes pixamoon, I have already
Yes pixamoon, I have already read that discussion, but I was not help ... I thank you anyway for your attention and response :)
`
I'm bit not sure how and which values you want to get from txt file.
I dont understand where you get "scale()" etc. instead of value...
Can you post or send me part of this txt file ? [email protected]
Sure! I attach here the file
Sure! I attach here the file exemple file .txt
What is on in rollout is printed in the .txt file, so not everything is written (plese see Environment Lighting HDR Studio (MR) to understand the working). The value to get from .txt is number and true or false (to send in spinner rollout ecc).