Plugin checker

Hi, I'm looking at writing a plugin in checker so everyone in the studio is on the latest version. So far I have this but I can't seem to get the doesfilexist in an array to work?

nPp = @"C:\Program Files\Autodesk\3ds Max 2014\plugins\" --Path for plugins
nPc = #()
append nPc  #(nPp + "Quad Chamfer.dlm")
append nPc  #(nPp + "MultiTexture_max2014_64.dlt")
append nPc  #(nPp + "bulgeomatic.dlm")
append nPc  #(nPp + "BerconMaps_2013_64.dlt")
print nPc[2]
doesFileExist (nPc[1])


Comment viewing options

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


*** EXAMPLE ***

First we need to define some array with plugins that you need to check, let say "plugs" array or you cen use some extension instead in this form #(".dlm", ".dlo")
Below is a list of the extensions and the plug-in types :

BMI - Bitmap Manager IO DLLs.
BMF - Bitmap Manager Filter plug-ins.
BMS - Bitmap Manager Storage DLLs.
DLB - Shader plug-ins.
DLC - Controllers.
DLE - Scene Export plug-ins.
DLF - Font Loaders.
DLH - Sampler plug-ins
DLI - Scene Import plug-ins.
DLK - Filter Kernels (Anti-aliasing filters)
DLM - Modifiers.
DLO - Procedural Objects.
DLR - Renderers.
DLS - Object Snap plug-ins.
DLT - Materials and Textures.
DLU - Utility plug-ins.
DLV - Rendering Effects
DLX - MAXScript extension plug-ins.
FLT - Image Filter plug-ins.
GUP - Global Utility plug-ins.
MS - Maxscript
MSE - Encrypted maxscript

Aruguments of "checkPlugsVersion" fn
" dir: "
- here you can add any directory ei. plugins folder path
- if this argument is not supplied with some path MAXROOT folder
- will be checked
" plugsFilenames: "
- here you need to add "plugs" array that I mentioned earlier
- example
plugs = #("Quad Chamfer.dlm","MultiTexture_max2014_64.dlt","bulgeomatic.dlm")
- if this case you not need to supply " ext: " because function will use only
- extensions from "plugs" array
" ext: "
- supply this argument only if you want to check print installed
plugins by extensions
- to print installed all plugins then not supply "plugsFilenames"
and "ext" argument. Simply run below code:

--#1 example: check plugs in max plugins folder

plugs = #("Quad Chamfer.dlm","MultiTexture_max2014_64.dlt","bulgeomatic.dlm","BerconMaps_2013_64.dlt")
folder = (getDir #maxroot) +"plugins"
checkPlugsVersion dir:folder  plugsFilenames:plugs

--#2 example: check plugs in max root folder

plugs = #("Quad Chamfer.dlm","MultiTexture_max2014_64.dlt","bulgeomatic.dlm","BerconMaps_2013_64.dlt")
checkPlugsVersion plugsFilenames:plugs

--#3 example: check modifier and material plugs in max plugin folder

extensions = #(".dlm",".dlt")
folder = (getDir #maxroot) +"plugins"
checkPlugsVersion dir:folder ext:extensions 

I hope this is helpful



fajar's picture

Plugins Checker

fn checkThisPlugins=
	plg2Check= #("Quad Chamfer.dlm","MultiTexture_max2014_64.dlt","bulgeomatic.dlm","BerconMaps_2013_64.dlt")
	thePath = ((getDir #maxroot) +"plugins"+"\\")
	for i in plg2Check do
		if doesFileExist (thePath+i) then 
				format "% installed !\n" i
				format "--> % not installed !\n" i
barigazy's picture



fn checkPlugsVersion dir: plugsFilenames: ext: = 
	local sioDir = dotNetClass "System.IO.Directory"
	local sioFile = dotNetClass "System.IO.File"
	local sioPath = dotNetClass "System.IO.Path"
	local sioSearchOptAll = (dotNetClass "System.IO.SearchOption").AllDirectories
	if dir == unsupplied or not sioDir.exists dir do dir = getDir #maxroot
        if allFiles.count == 0 do return (messageBox "This directory not contains any file")
	local allFiles = sioDir.GetFiles dir "*.*" sioSearchOptAll
	if plugsFilenames != unsupplied then
		local plugNames = #()
		ext = for p in plugsFilenames collect 
			append plugNames (tolower (sioPath.GetFileNameWithoutExtension p))
			sioPath.getExtension p
		allFiles = for f in allFiles where findItem ext (tolower (sioPath.getExtension f)) > 0 collect
			(tolower (sioPath.GetFileNameWithoutExtension f))
		for n = 1 to plugNames.count do
			if findItem allFiles plugNames[n] == 0 then format "Plugin % is not installed!\n" plugsFilenames[n]
			else format "Plugin % is already installed!\n" plugsFilenames[n]
	else -- with this statement you can print all installed plugins by given extensions
		if ext == unsupplied do
			ext = #(".bmi", ".bmf", ".bms", ".dlb", ".dlc", ".dle", ".dlf", ".dlh", ".dli", ".dlk", ".dlm", \
				".dlo", ".dlr", ".dls", ".dlt", ".dlu", ".dlv", ".dlx", ".flt", ".gup", ".ms", ".mse")
		for f in allFiles where findItem ext (tolower (getfilenametype f)) > 0 do print f
	free allFiles


miauu's picture


DoesFileExist not works in your code, because nPc[1] is an array. To works use this

doesFileExist (nPc[1][1])

Comment viewing options

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