i want to zip selected files with 7z.exe. I can not use zip_add() because it should also work with *.7z format and I need to set a password.
My problem is: after the zip file is created i want to select it. But this do not work reliable. Adding a litte timeout improves the situation but still sometimes the zip file is not selected.
It seems that the cmd windows which runs the 7z.exe mess up the focus.
Maybe someone knows a solution for this.
Thanks, pulp
Code: Select all
//zip all selected files
//get selected files
$current_files = "<selitems>";
End ("$current_files"==""), "No files selected!"; //check if any file is selected
//[additonal checks removed...]
$zip_name_full="C:\temp\test.zip";
$zip_name="test.zip";
//create the zip with 7z.exe
run """C:\Program Files\7-Zip\7z.exe"" a ""$zip_name_full"" $current_files",,2;
//Trick1: Waiting for the zip file, do not help
/*while (1==1)
{
$zip_created=exists("$zip_name_full");
if ("$zip_created")=="1"
{
break;
}
wait(100);
}*/
//Trick2: Wait a little bit, do not work reliable
wait(200);
focus;
wait(200);
//Set the focus to the new created zip file
//do not work reliable
sel "[$zip_name]",,1;