I have a button works fine no problem.
function OnClick(clickData)
{
if (clickData.func.sourcetab.selected.count !== 0)
{
var eSel = new Enumerator(clickData.func.sourcetab.selected);
var getfoldername = eSel.item().realpath.filepart;
var re = /\s\([0-9]+?\)\.(.*)/;
var regfolder = getfoldername.replace(re, "");
var AlbumCover = regfolder.match(/^[^.]+/);
var AlbumFolderwithCover = AlbumCover[0] + ' Covers';
var cmd = clickData.func.command;
cmd.SetSourceTab(cmd.desttab);
cmd.RunCommand('Copy HERE CREATEFOLDER="' + regfolder + '/' + AlbumFolderwithCover + '"');
cmd.RunCommand('GO "' + regfolder + '"');
cmd.ClearFiles();
var FirstFile = clickData.func.sourcetab.selected_files(0);
cmd.AddFile(FirstFile);
cmd.RunCommand('Copy HERE AS coverart.jpg CREATEFOLDER="' + regfolder + '"');
cmd.RunCommand('Copy HERE AS folder.jpg CREATEFOLDER="' + regfolder + '"');
cmd.RunCommand('Copy HERE AS FolderIcon.jpg CREATEFOLDER="' + regfolder + '"');
cmd.RunCommand('Select (coverart|folder|FolderIcon).jpg');
cmd.RunCommand('Set FOCUS=Toggle');
cmd.RunCommand("Set VIEW=Thumbnails");
cmd.ClearFiles();
cmd.AddFile(clickData.func.desttab.selected_files(0));
cmd.AddFile(clickData.func.desttab.selected_files(1));
cmd.RunCommand("%ProgramFiles(x86)%\\ObviousIdea\\Light Image Resizer 6\\Resize.exe {allfilepath$} /profile=\"Coverart\" /run");
cmd.ClearFiles();
cmd.AddFile(clickData.func.desttab.selected_files(2));
cmd.RunCommand("%ProgramFiles(x86)%\\ObviousIdea\\Light Image Resizer 6\\Resize.exe {allfilepath$} /profile=\"FolderIcon\" /run");
cmd.RunCommand('Select FolderIcon.ico');
}
else
{
var dlg = clickData.func.Dlg;
dlg.buttons = "OK";
dlg.message ="āĻāĻĒāĻ¨āĻŋ āĻā§āĻ¨ āĻ¸āĻŋāĻĄāĻŋāĻ° āĻāĻāĻžāĻ° āĻĢāĻā§ āĻ¸āĻŋāĻ˛ā§āĻā§āĻ āĻāĻ°ā§āĻ¨āĻ¨āĻŋ\n āĻĻā§āĻž āĻāĻ°ā§ āĻāĻā§ āĻ¸āĻŋāĻĄāĻŋāĻ° āĻāĻāĻžāĻ° āĻĢāĻā§ āĻ¸āĻŋāĻ˛ā§āĻā§āĻ āĻāĻ°ā§āĻ¨āĨ¤"
dlg.title = "Error!Š Md. Khalid Hossain 2021";
dlg.want_resize = true;
dlg.show;
return;
}
}
Now I want to marge a function with that, This function also works fine in single button.
function OnClick(clickData)
{
if (clickData.func.sourceTab.selected_files.count != 1) {
return;
}
var selFileName = clickData.func.sourceTab.selected_files(0).name ;
var fso = new ActiveXObject("Scripting.FileSystemObject");
var iniPath = fso.BuildPath(clickData.func.sourceTab.path, "desktop.ini");
if (fso.FileExists(iniPath)){
var txtFileMeta = fso.GetFile(iniPath);
txtFileMeta.Attributes = 0; // Clear Read-Only + Hidden.
}
var txtFile = fso.CreateTextFile(iniPath, true);
txtFile.WriteLine("[.ShellClassInfo]");
txtFile.WriteLine("IconResource=" + selFileName + ",0");
txtFile.Close();
var txtFileMeta = fso.GetFile(iniPath);
txtFileMeta.Attributes = 3; // Read-Only + Hidden.
var currentPath = fso.GetFolder(clickData.func.sourceTab.path);
currentPath.Attributes = 1; // Read-Only.
var icoFileName = clickData.func.sourceTab.selected_files(0);
var fso = new ActiveXObject("Scripting.FileSystemObject");
var icoFileMeta = fso.GetFile(icoFileName);
icoFileMeta.Attributes = 3; // Hidden.
}
The problem is that the 2nd function Need a .ico
file for perform. I had convert a Image file into .ico
file in my 1st button with this line
cmd.RunCommand("%ProgramFiles(x86)%\\ObviousIdea\\Light Image Resizer 6\\Resize.exe {allfilepath$} /profile=\"FolderIcon\" /run");
This Line have Run a 3rd party program name Light Image Resizer 6
and convert a Image file into .ico
file, and for Run the 3rd party program and converting It's take some seconds. So I need to delay the 2nd button Code for 10sec, How to make the delay? Now the 2nd button code has been run before the Image file had been finished the converting.