choice path button

I need for my script new window with 15 buttons, if you press it, it will ask you to pick some folder. After this
localisation will be keep and check-update olways whan script is lanch.
Maybe info about localisation should be save to txt file?
When I press another button "DELETE FILES"
files in picked filders and sub folders will be delited. Can anybody help me with this, I can't figure this out by my slef.
It's imporatant that buttons should remember localisation even after max restart.

Comments

Comment viewing options

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

still won't work, I checked

still won't work, I checked it already and it do nothing, I don't know why.I wished it work:)

miauu's picture

.

Did you read the script?
I did not tell you that you have to create the ini file.
This

local foldersPathIni = "D:\\FolderSettingsIni.ini"

shows where the ini file will be created. Do you have D: drive on your HDD and it is accessable via maxscript(because you can't create files, using maxscript, on C: drive(where mine/your OS is installed)).
So, run the script, go to D: drive and check if you have FolderSettingsIni.ini file.
I can make a video to show you that the code works.
:)

kredka's picture

dont work

Thanks a lot, however it wnon't work
Script dont remove anything and dont hold paths after reseting max:) so it's nice code but don't work. Also i would need location patch as text inside button s if You could check it I would be grateful

barigazy's picture

...

Probably the best solution will be .net + xml for storing paths

bga

miauu's picture

.

The deleted files and folders can't be restored using the Recycle Bin.
Add as many buttons as you want.

(
	global rol_
	try(destroyDialog rol_)catch()
	rollout rol_ ""
	(
		local foldersPathIni = "D:\\FolderSettingsIni.ini"
 
		button btn_1 "Browse" across:2
		button btn_1_dell "Delete"
		button btn_2 "Browse" across:2
		button btn_2_dell "Delete"
		button btn_3 "Browse" across:2
		button btn_3_dell "Delete"
 
		function SelectFolder btn =
		(
			dir = getSavePath caption:"Select folder" initialDir:(getIniSetting foldersPathIni btn "folder_path")
			if dir != undefined do
			(
				setIniSetting foldersPathIni btn "folder_path" dir
			)
		)
 
		function DeleteFoldersAndFiles dir =
		(
			local dIO = dotNetClass "system.IO.directory"
			if doesFileExist dir do
			(
				try(dIO.delete dir true)catch()			
			)
		)
 
		on btn_1 pressed do
		(
			SelectFolder "btn_1" 
		)
 
		on btn_2 pressed do
		(
			SelectFolder "btn_2" 
		)
 
		on btn_3 pressed do
		(
			SelectFolder "btn_3" 
		)
 
		--//	Delete files
		on btn_1_dell pressed do
		(
			DeleteFoldersAndFiles ((getIniSetting foldersPathIni "btn_1" "folder_path"))
		)
		on btn_2_dell pressed do
		(
			DeleteFoldersAndFiles ((getIniSetting foldersPathIni "btn_2" "folder_path"))
		)
		on btn_3_dell pressed do
		(
			DeleteFoldersAndFiles ((getIniSetting foldersPathIni "btn_3" "folder_path"))
		)
	)
	createdialog rol_ 
)

Comment viewing options

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