select folder - write variable - show in textfield - beginner needs help

Hi everybody.

i'm new to maxscript and i'm trying just a easy thing(not easy for me but for the professionals here yes) I want to create a rollout with a button "browse", where I can select a folder. for example c:\user\desktop\maps\. This path should be stored as a variable (and need it for an later action in the script) and should be shown in my edittext box and the user should be able to select and copy the path. for now it's half working with the attached script. But if I press a second time on the button "Browse" I can select another folder for example d:\materials the script changes the variable (for testing I used the print function) but did NOT show it in my edittext?Is there a kind of autoupdate function?

 

Is there anyone out there how can help me ??? thanks a lot in advanced and greetings chris

    rollout xx "Maps Path" width:800 height:496
(
   button btn_browse "Browse" pos: [124,10] width:60 height:16
    label choose "select maps path " pos:[8,10] width:112 height:16
 
   on btn_browse pressed do
   (
     dir = getSavePath caption:"Select Folder" initialDir:#images
    
       print dir
       
   )    
          edittext theedittextt "Path" text:dir

   )
    
   
rof=newrolloutfloater "Test"800 600
addRollout xx rof rolledUp:false

Comments

Comment viewing options

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

sorry double-post

sorry this was a double post.... my problem was solved in the previous post :) thanks to raymond

barigazy's picture

...

Here we go

rollout xx "Maps Path" width:800 height:496
(
	local currentDir
	button btn_browse "Browse" pos: [724,10] width:60 height:17 tooltip:"Select maps path"
	edittext theedittextt "Folder Path:" pos:[8,10] fieldwidth:650 height:17
 
	on btn_browse pressed do
	(
		currentDir = getSavePath caption:"Select Folder" initialDir:(getdir #image)
		if currentDir != undefined do theedittextt.text = currentDir
	)    
	on theedittextt entered txt do 
	(
		if pathConfig.isLegalPath txt do currentDir = txt
	)
)
rof=newrolloutfloater "Test" 800 600
addRollout xx rof rolledUp:off

Also look this http://www.scriptspot.com/forums/3ds-max/general-scripting/kredka-strike...

bga

dallchris's picture

..

thanks a lot it works, BUT if I want to print my variable (in my script called "dir") how can I do it? I need the path name as a variable, because I wan't to select a bitmap file for generating materials.... is it possibile to remind the script the last used path?
i hope you understand what I mean....
but for today it's enough with work.... :) hear you tommorrow...

Comment viewing options

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