ScriptSpot

Forum topic · General Scripting

Open file

By johncrawshaw · 2013-01-10

Description

I'm having trouble with something I thought would be easy. I'm trying to open a directory with the right path. I loads fine but just wont actually open the file when I click the open button.


	on btnOpenSce pressed do (
		--local lightmapTex = getOpenFileName caption: "Select the Lightmap" filename: maxFilepath types: "Images (*.dds, *.jpg, *.png, *.tga)|*.dds;*.jpg;*.png;*.tga"
			saveloc = ((PROJECTS[ProjectList.selection][2]+cats[objList.selection][2]+dirdd.selected)+"\\02_3D\\"+"")
			save01 = getOpenFileName filename:saveloc ()

)
Comments (4)

Max File

johncrawshaw · 2013-01-11

I'm just trying to create a shortcut to a folder. Then open any of the max files in that directory. Do you have to specify a file for it to load?

this is a different story then :)

Anubis · 2013-01-11

The getSavePath displays a folder selection dialog where to select your folder. For example:

maxFiles = #()
dir = getSavePath caption:"My Cation" initialDir:(getDir #scene)
if dir != undefined do -- if the user not Cancel
maxFiles = GetDirectories (dir + "/*.max")
print maxFiles

And use loadMaxFile function to load the .max file.

fajar · 2013-01-11

display bitmap ?....or display save01...

open bitmap?

Anubis · 2013-01-10

getOpenFileName() is just a file selector that not load anything, it just return a String (the selected file name). openBitMap() and selectBitMap() will load a bitmap.