ScriptSpot home

Forum topic · General Scripting

Edit name

By Mrjacks2o · 2012-01-02

Description

Hi Guys i am having problems with removing parts of the name in maxscript.

For instance i have 2 different edittext,
in 1 text its test.png
in the other its box.png

i want to press a button and it removes the .png from both texts.

thanks in advance

Comments (4)
Jos Balcaen

getFilenameFile

you can use :


getFilenameFile "box.png" 

(this returns "box")

Reply to Jos Balcaen
Mrjacks2o

Thanks for the reply it worked great for a text i entered in maxscript.
but what if i input a random text lets say box101.png while the script is running how can i use the script to remove the .png? thanks :)

fileName.text = getFilenameFile ".jpg" tried that but it removed all of the text

Reply to Mrjacks2o
Jos Balcaen

varText = edtText.text -- get input from user
fileName.text = getFilenameFile varText -- remove extention from input

getFilenameFile ".jpg" will return an emty string because getFilenameFile will remove the extention and ".jpg" is only an extention.
check maxscript help for more info. search for getFilenameFile.