PDA

View Full Version : optionVar?


Technofreak
04-16-2004, 08:30 AM
hello again, I created a simple window:

rollout nn_FTR "Fix Time Range"
(
local g_thePath;

editText txtFld "" text:"Dir?" pos:[1,16] width:276;
button getDBtn "<" toolTip:"Get Directory" pos:[285,14] width:30;
button curDBtn "Cur Dir" toolTip:"Current Directory" pos:[4,40] width:96;
button subDBtn "Sub Dir" toolTip:"Sub Directory" pos:[111,40] width:96;
button closeBtn "Close" toolTip:"Close Window" pos:[218,40] width:96;
label txt1 "Current Directory:" pos:[6,2] width:133 height:14;


fn getMaxFiles root pattern =
(
my_files = getFiles (root + "\\" + pattern);
)

fn getFilesRecursive root pattern =
(
dir_array = GetDirectories (root+"\*");

for d in dir_array do
join dir_array (GetDirectories (d+"/*"));
my_files = #();

for f in dir_array do
join my_files (getFiles (f + pattern));
my_files;
)

-- getDbtn
on getDBtn pressed do
( try
(
g_thePath = getSavePath();
txtFld.text = g_thePath;
)
catch
(
messageBox "Please select a directory";
)
)

-- curDBtn
on curDBtn pressed do
(
try
(
maxFiles = #();
maxFiles = getMaxFiles g_thePath "*.max";
print maxFiles;
-- command here
)
catch
(
messageBox "Directory doesn't exists";
)
)

-- subDBtn
on subDBtn pressed do
(
try
(
maxFiles = #();
maxFiles = getFilesRecursive g_thePath "*.max";
print maxFiles;
-- command here
)
catch
(
messageBox "Please select a valid directory.";
)
)

-- closeBtn
on closeBtn pressed do
(
closerolloutfloater nn_FTRFloater
)
)


-- create the rollout window and add the rollout
if nn_FTRFloater != undefined do
(
closerolloutfloater nn_FTRFloater;
)

nn_FTRFloater = newRolloutFloater "nn_FTR" 330 96;
addRollout nn_FTR nn_FTRFloater;



so now my question is is there a way to tell Max to save the "txtFld.text" value when I call that script again cause it's annoying looking for the same dir over and over again, basically what I want is to tell Max to load the old value of "txtFld.text" so I dont need to browse for that same folder.:shrug:

Thanks All

magicm
04-16-2004, 10:40 AM
Check out the online reference for "SetIniSetting" and "GetIniSetting". Something in the lines of:

SetIniSetting "$plugcfg\\myinifile.ini" "Settings" "Path" "C:\\blahblah\\blahblah"
myPath = GetIniSetting "$plugcfg\\myinifile.ini" "Settings" "Path"

- Martijn

Technofreak
04-16-2004, 07:29 PM
thanks for the 411 :thumbsup:

CGTalk Moderation
01-18-2006, 02:00 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.