|
|
|
01-23-2020, 10:36 PM
|
#1
|
Human being with feelings
Join Date: Oct 2017
Location: Russia
Posts: 366
|
Path / "File: Clean current project directory..."
Hello!
There is an action "File: Clean current project directory...", but it scans and cleans only the folder that is specified in the project settings.
It often happens that the rendering takes place in another subfolder for order and constantly changing the path in the project settings is not very convenient (you need to open the project settings, remember the previous path, enter a new path, apply the action, go back to the project settings and change the path back)
Is it possible to make the path of the folder to be cleaned can be added directly to the action window (see screenshot)?
Note: The action should always open with the default path specified in the project settings, as now, so that no one would do anything stupid, but if you need to change the path, then immediately select another folder and clear it.
Many thanks!
|
|
|
01-26-2020, 06:04 AM
|
#2
|
Human being with feelings
Join Date: Oct 2017
Location: Russia
Posts: 366
|
If this is difficult to do, or it can be considered dangerous, it can at least unlock the action windows "Clean current project directory" and "project settings" in order to change the path in one window and clean the folder in the second from unnecessary files. Now you have to do this:
1.Open the project settings and change the path,
2. Close the project settings window
3.Open the action, clean the directory,
4. Close action
5.Open the project settings again and change the path,
And if you clean several folders, it’s absolutely inconvenient to open / close these windows back and forth
Thanks!
|
|
|
06-29-2020, 10:31 AM
|
#3
|
Human being with feelings
Join Date: Dec 2011
Location: Finland
Posts: 792
|
We need this, but we also need "exlude" list option to exclude certain folders from the scan, currently you can't really organize things well and be sure that the cleaning function doesn't remove something you didn't mean to.
|
|
|
06-29-2020, 10:49 AM
|
#4
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,630
|
I'll research into it. Maybe it can be done via manipulating some reaper.ini entries...
Edit:
Would this be a good start for such an action? Keep in mind, that it could clean up files from the folder, that are not associated with this project, but with another one, so you should really really know, what you are doing with this action.
Set variable CleanPath to the path of your choice. Means, exchange C:\\temp2 with your desired path.
On Windows, you need to write backslashes \ doubled as \\
Code:
-- Meo-Ada Mespotine 30th of June 2020 - licensed under MIT-license
--
-- changes the path of the "Clean current project directory..."-dialog to another one of your choice, opens the dialog and allows you to clean within this path
-- it will change the path back to it's original path.
-- Doesn't work during recording, to prevent accidental misplacement of files in recording.
-- Set this variable to the path of your wish.
CleanPath="C:\\temp2"
if reaper.GetPlayState()&4==4 then
reaper.MB("You shouldn't record when using this action.", "Oops", 0)
else
Aretval, AvaluestrNeedBig = reaper.GetSetProjectInfo_String(0, "RECORD_PATH", "", false)
Bretval, BvaluestrNeedBig = reaper.GetSetProjectInfo_String(0, "RECORD_PATH", CleanPath, true)
reaper.Main_OnCommand(40098, 0)
Cretval, CvaluestrNeedBig = reaper.GetSetProjectInfo_String(0, "RECORD_PATH", AvaluestrNeedBig, true)
end
If you prefer a folder-selection-dialog, you can use this one. Just doubleclick a file in the new clean-folder. If you hit esc in the folder-selection, it will use the project's default-folder.
Code:
-- Meo-Ada Mespotine 30th of June 2020 - licensed under MIT-license
--
-- Allows you to choose an alternative path of the "Clean current project directory..."-dialog via file-dialog. It then opens the dialog and allows you to clean within this path.
-- it will change the path back to it's original path.
-- Doesn't work during recording, to prevent accidental misplacement of files in recording.
--
-- You need to select a file to choose the folder(I chose this dialog so you can see the files contained in the path for a doublecheck of the right path).
-- If you hit esc on the path-choose-dialog, it will simply use the project's path
if reaper.GetPlayState()&4==4 then
reaper.MB("You shouldn't record when using this action.", "Oops", 0)
else
buf = reaper.GetProjectPathEx(0, "")
retval, CleanPath = reaper.GetUserFileNameForRead(buf.."/", "Select Path to be cleaned", "")
CleanPath=string.gsub(CleanPath, "\\", "/"):match("(.*)/")
if retval==true then
Aretval, AvaluestrNeedBig = reaper.GetSetProjectInfo_String(0, "RECORD_PATH", "", false)
Bretval, BvaluestrNeedBig = reaper.GetSetProjectInfo_String(0, "RECORD_PATH", CleanPath, true)
reaper.Main_OnCommand(40098, 0)
Cretval, CvaluestrNeedBig = reaper.GetSetProjectInfo_String(0, "RECORD_PATH", AvaluestrNeedBig, true)
else
reaper.Main_OnCommand(40098, 0)
end
end
Last edited by Meo-Ada Mespotine; 06-29-2020 at 03:25 PM.
|
|
|
07-01-2020, 04:03 AM
|
#5
|
Human being with feelings
Join Date: Oct 2017
Location: Russia
Posts: 366
|
Quote:
Originally Posted by Meo-Ada Mespotine
Keep in mind, that it could clean up files from the folder, that are not associated with this project,
|
To avoid this, I would have written it a little differently, so that the code would not allow you to do anything stupid.
Code:
if reaper.GetPlayState()&4==4 then;
reaper.MB("You shouldn't record when using this action.","Oops",0);
else;
if reaper.GetOS():match('Win')then sep = '\\'else sep = '/'end;
local projfn = ({reaper.EnumProjects(-1)})[2]:gsub("[/\\]",sep):match('(.+)'..sep..'.+$')or
reaper.GetProjectPathEx(0,""):gsub('[\\/]',sep);
::res::;
local retval,CleanPath = reaper.GetUserFileNameForRead(projfn..sep,"Select Path to be cleaned","");
if not retval then reaper.defer(function()end)return end;
CleanPath=string.gsub(CleanPath,"[\\/]",sep):match("(.*)"..sep);
if not CleanPath:match(projfn)then;
local MB = reaper.MB("This path has nothing to do with the project.\n\nRepeat?","Oops",1);
if MB == 1 then goto res end;
retval = nil;
end;
if retval==true then;
Aretval, AvaluestrNeedBig = reaper.GetSetProjectInfo_String(0,"RECORD_PATH","" ,false);
Bretval, BvaluestrNeedBig = reaper.GetSetProjectInfo_String(0,"RECORD_PATH",CleanPath,true);
reaper.Main_OnCommand(40098, 0);
Cretval, CvaluestrNeedBig = reaper.GetSetProjectInfo_String(0,"RECORD_PATH",AvaluestrNeedBig,true);
end;
end;
reaper.defer(function()end);
|
|
|
07-01-2020, 06:43 AM
|
#6
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,630
|
Nice
|
|
|
07-01-2020, 08:19 AM
|
#7
|
Human being with feelings
Join Date: Oct 2017
Location: Russia
Posts: 366
|
I already forgot and put up with it, but you reminded me of this and I generally liked the idea and I decided to add this script and add it.
During normal startup, the 'File: Clean current project directory ...' action is launched, and when launched with ctrl held down, a window is opened to indicate the path.
Archie_File; Clean current project directory(ctrl- user input path).lua( Git)
|
|
|
Thread Tools |
|
Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -7. The time now is 01:32 AM.
|