[SOLVED] Playing with 2 dialogs [one main and one for editing variables]

-- Messing with \ and \\ -- [SOLVED] But another question at the bottom

Hi there, this is my first post here, and i'm a beginner in maxscript, and scripting in general.

I'm currently improving my script so it can store configuration file, and use them as variables.

I have several problem which i can't solve on my own, and, as a French young man, my english is not good enough to understand the all Maxscript Help File.

I'm Asking for help :)

So i learn there is scope things to access variables in different loop, and it's a bit hazy for me. I think It's on problem i have in my script, but first, i have a problem when edit my .ini file:

>> I must store a Network Path into my Ini File, but i just notice that the function "SetINISetting" simply ignore multiple backslash:

in my functions.ms file:

setINISetting theoutput "folders" "dossier_portes_ini" "\\\\Averty\\v\\Oskab\\scenes\\_portes\\"
setINISetting theoutput "folders" "dossier_render_ini" "\\\\Averty\\v\\Oskab\\scenes\\__RENDER\\"

in my .ini file i get:

[folders]
dossier_portes_ini=\\Averty\v\Oskab\scenes\_portes\
dossier_render_ini=\\Averty\v\Oskab\scenes\__RENDER\

But when I re-use my editvar rollout and manually type the good path,I get the good one... This is a mystery for me...

I need this function to work, because it's the defaults settings, overriding the one missing, or use as default if no modification are made.

Thanks in advance for reading me, and a thousand thanks for trying to help.

-- EDIT --

I'll try to be clear explaining this one !

First, i had only one roullout "main", opening when starting the script with everything in It, it worked well, but i like challenge and for further use, i wanted it to be editable.

So, now i have 3 files; main.ms, functions.ms and editvar.ms

main call editvar.ms by pressing a button, and when editvar close, it store all information into a temp.ini so i can access to my variables easily into main.ms

My problem is that when main start, it create a dropdownlist by parsing a folder, which can be modified by the second rollout.

since the dropdownlist is created when the first roullout is called, when i close my edit var, i don't find a way to update it (i tried "on close" but when i call it in the main script, it's gone since a long time and it does nothing)

So, for now, i close everything and launch the script again... not very handy !
Main:
http://my.jetscreenshot.com/8140/20130907-p6qh-26kb.jpg
EditVar:
http://my.jetscreenshot.com/8140/20130907-qazg-78kb.jpg

Thanks Again for helping me :)

[EDIT 2013/09/04]
-------------------------------------------
Some Handy Functions I use In this script:

1) LISTNG FILES: Create a list of files To put in a DropdownList / ListBox / MultiListBox: Arguments: Directory (path to folder) / Extension (ex: "max") / Extensionlength: number of character in Extension (ex: 3) / directorylengtplus = 1 for network path (UNC) or 2 for classic path (C:\\...) [ I use one Checkbox for It] / the dropdownlist: name of the object UI.

fn listingfiles directory extension extensionlength directorylenghtplus thedropdownlist =
	(	
	listeporte = getfiles (directory + "\*." + extension)
		/*Creating 2 empty arrays 
		listetemp holds thefilename + extension
		liste holds filename without the extension.*/	
		liste = #()
		listetemp = #()
		for a = 1 to listeporte.count do
			(
			directorylenght = directory.count
			listetemp [a] = Substring listeporte[a] (directorylenght +directorylenghtplus) 100
			counttemp = listetemp [a].count
			liste [a] = Substring listetemp [a] 1 (counttemp - (extensionlength+1))
			)	
		for a = 1 to liste.count do
			(	  
			thedropdownlist.items = append thedropdownlist.items (liste[a] as string)
			)
 
	)

2) Bdigit nb: Return a number value into a String with 4 digits:

fn bdigit nb = 
		(
			tostring = nb as string
			countstring = tostring.count
			if countstring == 4 then result =  tostring 
			if countstring == 3 then result =  ("0" + tostring) 
			if countstring == 2 then result = ("00" + tostring)
			if countstring == 1 then result = ("000" + tostring) 
			return (result)
		)

Comments

Comment viewing options

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

...

How to use it?
Let say you want to collect all mxs files inside max root directory

mxs = collectFilesByExtensions directory:(getDir #maxroot) extArr:#("*.ms", "*.mse", "*.mcr") opt:#all_folders
print mxs -- print result in listiner

Now if you want also to collect file names then you can do next

-- define a empty array which will hold file names only
fileNamesArray = #()
-- add this array in last argument of function
mxs = collectFilesByExtensions directory:(getDir #maxroot) extArr:#("*.ms", "*.mse", "*.mcr") opt:#all_folders &fileNames:fileNamesArray
-- by runing this fn you will get two arrays: all full file paths and file names
-- to see result print in the listener next two lines
print mxs --full file paths
print fileNamesArray --file names

bga

barigazy's picture

...

And at the end just fill your dropdown list

thedropdownlist.items = fileNamesArray

I hope this will help

;)

bga

locke's picture

... I'm ashamed to not know

... I'm ashamed to not know that, thanks a lot, that solve one of my problems !

barigazy's picture

...

Then post 2nd problem :)

bga

barigazy's picture

...

Are you try using "@" sign before path string

setINISetting theoutput "folders" "dossier_portes_ini" @"\\\\Averty\\v\\Oskab\\scenes\\_portes\\"

bga

Comment viewing options

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