read value from an INI file

hi all,
I have a problem with my script. I can't solve a bug about reading value from an ini file. I am not a scriptwriter, just trying to write a little script but I need to save my script setting to an INI file. In my case, I have to save a folder path for batch process. Saving works fine I would say, but loading that value crashes the script.
Script has been attached.

Thank you buddies for any help!

AttachmentSize
library_helper_bug.ms1.52 KB

Comments

Comment viewing options

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

yep, why stringStream? :)

I answer to Tomas on his dups topic:
http://www.scriptspot.com/forums/3ds-max/general-scripting/read-value-fr...

my recent MAXScripts RSS (archive here)

miauu's picture

-- macroScript

-- macroScript Library_Helper_Bug category:"TomTNT Script"
	( 	
		rollout Library_Helper_Script_Bug "Library Helper Bug" width:408 height:384
		(
			local libraryhelperbugIniFile = getFilenamePath (getSourceFileName()) + "/libraryhelperbug.ini"
			edittext text_infold "" pos:[16,24] width:312 height:16 text:"select directory to batch"
			button btn_infold "Browse" pos:[336,24] width:56 height:16
 
			on Library_Helper_Script_Bug open do
			(
				if doesFileExist libraryhelperbugIniFile then
				(
					--	if the ini file exist it will load the value from it
					max_dir = ((getIniSetting libraryhelperbugIniFile "Presets" "max_dir") as string)
					text_infold.text = (max_dir as string)
 
					)
					else
					(--	if the ini file does not exist the script will create new ini file
					max_dir = text_infold.text as string
					setIniSetting libraryhelperbugIniFile "Presets" "max_dir"  (max_dir as string)
					)
				)
 
 
				on btn_infold pressed do
				(
					max_dir = getSavePath()
					text_infold.text = (max_dir as string)
				    setIniSetting libraryhelperbugIniFile "Presets" "max_dir" (max_dir as string)
				)	
 
		--------------------------------------------------------------------------------------------------------------
 
 
			on libraryhelperIniFile close do
			(
				setIniSetting libraryhelperbugIniFile "Presets" "max_dir" (text_infold.text as string)
 
			)
 
		)createDialog Library_Helper_Script_Bug 408 64
	)	

Why you want to use stringStream?

Comment viewing options

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