Notifications
Clear all

[Closed] File maxscript cant close – undefined

hi I saw a few old Posts related to this problem topic but i couldnt really aplly it on my function.
I have a simple function which checks if an Txt on a Path exists and if not creates on. I really struggle to understand whats the Problem so any Help would be appreciated


struct globalV (
stringOne,
stringTwo,
f,
x,
myPath ,
fn existFile fname = (getfiles fname).count != 0,

fn startUp = (
–check for mirorRename.txt in Local if not there create empy one // for later save
–if there set text of textEdit
–the default saved in my .txt File
–myPath = (myDir as String) + “//mirrorRename.txt” –Component List

	myDir = getDir #userScripts
	myFileP = myDir as String  +@"/mirrorRename_X.txt"	
	
	if existFile myFileP != true then 
		(
		this.f = createFile myFileP 
		close this.f 
		print "created"
		)
		else
		(
		this.f = openFile myFileP
		) 
		
local count = 0

while not eof this.f and count < 2 do
(
if count == 0 then this.stringOne = readline this.f 
if count == 1 then this.stringTwo = readline this.f 
count = count +1
)

flush this.f 
close this.f 
),

endofstruct
)

Error Message shortend:

  • No ““eof”” function for undefined
    – MAXScript callstack:
    – thread data: threadID:9480

And is there a way to solve it in .net cause for me it seems like a mess
Greets Eli