Little array problem
theFiles=getFiles ("H:\\Try"+"\\"+"*") theImgType=#(".bmp", ".jpg",".jpe",".jpeg",".cin",".gif",".hdr",".pic",".exr",".fxr",".png",".psd",".rgb",".sgi",".rla",".rpf",".tga",".vda",".icb",".vst",".tif",".yuv",".dds") myProxyType=#(".vrmesh", ".mib",".fpx") myVideoType=#(".avi", ".mpg",".mpeg",".mov") fn generateUnknowFile theArr= ( myFile=#() fileTypeArr=theImgType+myProxyType+myVideoType theIcon=AddIconPath+"\\"+"Unknown.png" for i in theArr do ( for u in fileTypeArr do ( theFile=i myType=toLower (getFilenameType (filenameFromPath theFile)) otherType=u if myType!=otherType do append myFile theFile ) ) myFile --print myFile ) generateUnknowFile theFiles
The problem is, How to get other extension other than in theImgType,myProxyType,myVideoType like ["H:\\Try\apple.dll"].
I try using my function above, but seem it fail, it constantly generate the file that contain extension in the theImgType,myProxyType,&myVideoType
Thank you very much
Comments
ok got it.thanks a bunch
ok got it.i'll use match pattern.
thanks a bunch miauu.
Your method fails because of
Your method fails because of the nested for loop. Let say that your first extension is dll. You compared it with all extensions(in the fileTypeArr ) and the script add it to the myFile array. The second extension is png. When you compare PNG with the fileTypeArr , when the script compare the png and bmp the result of myType!=otherType is true(png is different than bmp) and the script add the png to myFile array.
The code below works. If it add some files more than once use while statement in the for i in theArr.
Edit: Maxscript help file says that matchPattern is much faster than findItem, so you can try to use matchPattern.
Tools and Scripts for Autodesk 3dsMax