Text File Directory

Hi Everyone i have a simple script that generates a text file.

---------------------Text file--------------------------------

Dir1 = gp_mainPath
out_name = (fileName.text + ".txt")
out_file = createfile out_name
format "%-" ("D")to:out_file
format "%-" (print polyList.count/257)to:out_file
format "%" (Stonecount.text = RStyle2.text)to:out_file

---------------------Text file--------------------------------

i figured out how to generate the text name but cant set the directory to gp_mainPath

any help will be appreciated.

thanks

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Mrjacks2o's picture

1

1

miauu's picture

.

Something like this:

(
 
gp_mainPath = "D:\\test_folder\\"
out_name =	gp_mainPath + (fileName.text + ".txt")
out_file = createfile out_name
format "%-" ("D")to:out_file
format "%-" (print polyList.count/257)to:out_file
format "%" (Stonecount.text = RStyle2.text)to:out_file
 
---------------------Text file--------------------------------
)
Mrjacks2o's picture

thanks

thanks for the quick reply the problem with that script is it adds the last folder name to the file name.

so lets say "C:\\Users\Workstation\\Documents\\3dsMax" is my directory and i put the name test it generates "3dsMaxtest.txt" as the name and places it in a  folder "C:\\Users\Workstation\\Documents\\

thats why i am trying to remove the direcotry from the out_name

any idea how to fix it? 

miauu's picture

.

If I understand you correctly you want to save the file one llevel up, not in the last fgolder, but in the folder that contains the last folder.

pathConfig.removePathLeaf "c:\\temp\\test"
-- the result is
"c:\temp"
Mrjacks2o's picture

Great thanks

1 last question how can i add a new line in the text file for this code. format "%-" ("SP")to:out_file

like this
D-20-40
SP

Not like this
D-20-40 SP

pixamoon's picture

`

just "\n" character

format "%-\n" ("SP")to:out_file

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.