Find Script By String

17 votes
Date Updated: 
Author Name: 

Recursive search in selected directory for string inside .ms scripts and finally double click on item in list of matches result to load the script for editing.

Version Requirement: 
3ds Max 2009
Video URL: 
FindScriptByString.ms1.93 KB


Comment viewing options

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

Круто, спасибо. Но не

Круто, спасибо. Но не работало для вводимого пути напрямую. Немного подкорректировал.
Cool, thanks. But it did not work for the input path directly. A little tweaked.

-- Find Script By String v.1.0 [2009-06-27]
-- by Karabakalov (Anubis) [email protected]
if findScriptDlg != undefined then destroyDialog findScriptDlg
rollout findScriptDlg "Find Script By String" width:800 height:600
	local allMSfiles = #()
	local result = #()
	-- UI items
	edittext ed_currDir "" width:746 across:2
	button bt_srcDir "..." height:18 align:#right
	edittext ed_search "" width:773
	multiListBox mlb_files "" width:773 height:40
	label lb_result "Enter string to search..."
	-- Functions
	fn getFilesRecursive root pattern =
		dir_array = GetDirectories (root+"/*")
		for d in dir_array do
			join dir_array (GetDirectories (d+"/*"))
		join dir_array (GetDirectories root)
		my_files = #()
		for f in dir_array do
			join my_files (getFiles (f + pattern))
	fn searchFn = (
		result = #()
		for f in allMSfiles do
			s = openFile f
			while not eof s do
				find = readLine s
				if findString find ed_search.text != undefined then
				(append result f ; exit )
			close s
		lb_result.text = (result.count as string) + " files found"
		if result.count > 0 then
		(mlb_files.items = result ; lb_result.text += " -- Double Click to Edit...")
	-- Events
	on ed_search entered txt do
		if txt != "" then searchFn()
		else lb_result.text = "Enter string to search..."
	on ed_currDir entered txt do
	d = ed_currDir.text
	allMSfiles = getFilesRecursive ed_currDir.text "*.mcr"
	on bt_srcDir pressed do
		d = getSavePath caption:"Where to Search..." initialDir:"$scripts"
		if d != undefined then
			ed_currDir.text = d
			allMSfiles = getFilesRecursive ed_currDir.text "*.ms"
	on mlb_files doubleClicked itm do
		if mlb_files.selection != 0 then edit mlb_files.items[itm]
	on findScriptDlg open do
		ed_currDir.text = (getDir #scripts)
		allMSfiles = getFilesRecursive (getDir #scripts) "*.ms"
createDialog findScriptDlg style:#(#style_titleBar, #style_border, #style_sysMenu, #style_minimizeBox)
br0t's picture

I like :)

I like :)

Never get low & slow & out of ideas

kilad's picture

hm. Have you tried ctrl +

hm. Have you tried ctrl + shift + F in mxs editor?

Nevil's picture


This is great idea and useful tool.

Comment viewing options

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