Zip the file and ask for password in a single shortcut key?

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
shamsudeen
Posts: 64
Joined: 05 May 2012 06:58

Zip the file and ask for password in a single shortcut key?

Post by shamsudeen »

Hi folks, how are you doing. ?

I need to make a repetitive task, that is, drag and drop a file into the WinRAR application and click Create Password, then type the password for that file. This is my repetitive task.

Is there a way to make a single shortcut key? When I press the shortcut key, it should zip and wait for me to enter my password. ?

Thank you, guys

highend
Posts: 14571
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Zip the file and ask for password in a single shortcut key?

Post by highend »

Ofc this is not possible, XY doesn't support drag'n drop automation

You are free though to use input() and the winrar command line to do the same without a gui...
One of my scripts helped you out? Please donate via Paypal

shamsudeen
Posts: 64
Joined: 05 May 2012 06:58

Re: Zip the file and ask for password in a single shortcut key?

Post by shamsudeen »

thank for your reply.

but i am not going to drag and drop on xyplorer.

currently i am working like Opened winrar application in my left side screen , and on my right side screen i keep my windows xplorer, i drag and drop a pdf file to winrar, the Winrar automatically pop up for zip and i click to set password. this is what i am doing now.

but i want to make this easy in my xyplorer, click on that folder or file, and press the short cut key to zip and ask for password for the zip file. is this possible to make it. thanks
Attachments
00001.png
00001.png (135.44 KiB) Viewed 4538 times

highend
Posts: 14571
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Zip the file and ask for password in a single shortcut key?

Post by highend »

Read the second part of my first post again
One of my scripts helped you out? Please donate via Paypal

shamsudeen
Posts: 64
Joined: 05 May 2012 06:58

Re: Zip the file and ask for password in a single shortcut key?

Post by shamsudeen »

hi,
i dont understand this, i am not familiar with script or something. can you explain me please?
You are free though to use input() and the winrar command line to do the same without a gui...
can you explain me please?

highend
Posts: 14571
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Zip the file and ask for password in a single shortcut key?

Post by highend »

Code: Select all

    $dst = "E:\file done";
    $rar = "C:\Program Files\WinRAR\WinRar.exe";

    end (exists($rar) != 1), quote($rar) . <crlf 2> . "does not exist, aborted!";
    end (!<curitem>), "No item selected, aborted!";

    $drv = gettoken($dst, 1, ":") . ":\";
    end (exists($drv) != 2), "Drive " . quote($drv) . <crlf 2> . "does not exist, aborted!";
    if (exists($dst) != 2) { new($dst, "dir"); }

    $base = gpc(<curitem>, "base");
    $pass = input("Input encryption pw");
    $opts = ($pass != "") ? "a -afzip -ep1 -p" . quote($pass) : "a -afzip -ep1";

    run lax("$rar" $opts "$dst\$base" "<curitem>"), "%TEMP%";
One of my scripts helped you out? Please donate via Paypal

shamsudeen
Posts: 64
Joined: 05 May 2012 06:58

Re: Zip the file and ask for password in a single shortcut key?

Post by shamsudeen »

Thank for the Script, but this is not working as expected. when i run the script it is asking for the password, after entering the password
the file created in e drive, but its removed the original file extension, and not a zip file, please check and help..
Attachments
FILE 1.png
FILE 1.png (183.55 KiB) Viewed 4510 times

highend
Posts: 14571
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Zip the file and ask for password in a single shortcut key?

Post by highend »

Code: Select all

run lax("$rar" $opts "$dst\$base.zip" "<curitem>"), "%TEMP%";
Replace the original line
One of my scripts helped you out? Please donate via Paypal

shamsudeen
Posts: 64
Joined: 05 May 2012 06:58

Re: Zip the file and ask for password in a single shortcut key?

Post by shamsudeen »

hi, bro thank you very much, its working as a charm.
sorry for the delayed reply. i got outside of our office.
Thank you

shamsudeen
Posts: 64
Joined: 05 May 2012 06:58

Re: Zip the file and ask for password in a single shortcut key?

Post by shamsudeen »

Hi brother, how to make this script to set a default single password and zip the file automatically?

Thank you

$dst = "E:\file done";
$rar = "C:\Program Files\WinRAR\WinRar.exe";

end (exists($rar) != 1), quote($rar) . <crlf 2> . "does not exist, aborted!";
end (!<curitem>), "No item selected, aborted!";

$drv = gettoken($dst, 1, ":") . ":\";
end (exists($drv) != 2), "Drive " . quote($drv) . <crlf 2> . "does not exist, aborted!";
if (exists($dst) != 2) { new($dst, "dir"); }

$base = gpc(<curitem>, "base");
$pass = input("Input encryption pw");
$opts = ($pass != "") ? "a -afzip -ep1 -p" . quote($pass) : "a -afzip -ep1";

run lax("$rar" $opts "$dst\$base.zip" "<curitem>"), "%TEMP%";

jupe
Posts: 3292
Joined: 20 Oct 2017 21:14
Location: Win10 22H2 120dpi

Re: Zip the file and ask for password in a single shortcut key?

Post by jupe »

Code: Select all

  $pass = "PASSWORD";
  $dst  = "E:\file done";
  $rar  = "C:\Program Files\WinRAR\WinRAR.exe";

  end (exists($rar) != 1), quote($rar) . <crlf 2> . "does not exist, aborted!";
  end (!<curitem>), "No item selected, aborted!";
  
  $drv = gpc($dst, "drive") . ":\";
  end (exists($drv) != 2), "Drive " . quote($drv) . <crlf 2> . "does not exist, aborted!";
  if  (exists($dst) != 2) { new($dst, "dir"); }

  run lax("$rar" a -afzip -ep1 -p"$pass" "$dst\<curbase>.zip" "<curitem>"), "%TEMP%";

shamsudeen
Posts: 64
Joined: 05 May 2012 06:58

Re: Zip the file and ask for password in a single shortcut key?

Post by shamsudeen »

Thank you Jupe. it works well

Thanks for the community.

shamsudeen
Posts: 64
Joined: 05 May 2012 06:58

Re: Zip the file and ask for password in a single shortcut key?

Post by shamsudeen »

jupe wrote: 02 Jan 2025 05:13

Code: Select all

  $pass = "PASSWORD";
  $dst  = "E:\file done";
  $rar  = "C:\Program Files\WinRAR\WinRAR.exe";

  end (exists($rar) != 1), quote($rar) . <crlf 2> . "does not exist, aborted!";
  end (!<curitem>), "No item selected, aborted!";
  
  $drv = gpc($dst, "drive") . ":\";
  end (exists($drv) != 2), "Drive " . quote($drv) . <crlf 2> . "does not exist, aborted!";
  if  (exists($dst) != 2) { new($dst, "dir"); }

  run lax("$rar" a -afzip -ep1 -p"$pass" "$dst\<curbase>.zip" "<curitem>"), "%TEMP%";
@jupe
@highend
hi, how to add many files at once and run this script to zip and passoword the files seperately at once. Thank you

highend
Posts: 14571
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Zip the file and ask for password in a single shortcut key?

Post by highend »

By looping over them?

Code: Select all

    $pass = "PASSWORD";
    $dst  = "E:\file done";
    $rar  = "C:\Program Files\WinRAR\WinRAR.exe";

    end (exists($rar) != 1), quote($rar) . <crlf 2> . "does not exist, aborted!";
    $items = <get SelectedItemsPathNames>;
    end (!$items), "No item(s) selected, aborted!";

    $drv = gpc($dst, "drive") . ":\";
    end (exists($drv) != 2), "Drive " . quote($drv) . <crlf 2> . "does not exist, aborted!";
    if  (exists($dst) != 2) { new($dst, "dir"); }

    foreach($item, $items, <crlf>, "e") {
        $base = gpc($item, "base");
        run lax("$rar" a -afzip -ep1 -p"$pass" "$dst\$base.zip" "$item"), "%TEMP%";
    }
One of my scripts helped you out? Please donate via Paypal

shamsudeen
Posts: 64
Joined: 05 May 2012 06:58

Re: Zip the file and ask for password in a single shortcut key?

Post by shamsudeen »

highend wrote: 13 Aug 2025 12:57 By looping over them?

Code: Select all

    $pass = "PASSWORD";
    $dst  = "E:\file done";
    $rar  = "C:\Program Files\WinRAR\WinRAR.exe";

    end (exists($rar) != 1), quote($rar) . <crlf 2> . "does not exist, aborted!";
    $items = <get SelectedItemsPathNames>;
    end (!$items), "No item(s) selected, aborted!";

    $drv = gpc($dst, "drive") . ":\";
    end (exists($drv) != 2), "Drive " . quote($drv) . <crlf 2> . "does not exist, aborted!";
    if  (exists($dst) != 2) { new($dst, "dir"); }

    foreach($item, $items, <crlf>, "e") {
        $base = gpc($item, "base");
        run lax("$rar" a -afzip -ep1 -p"$pass" "$dst\$base.zip" "$item"), "%TEMP%";
    }
Thank you

Post Reply