Author Topic: View *.FB2.ZIP  (Read 18958 times)

Tezcatlipoca

  • Newbie
  • *
  • Posts: 6
    • View Profile
View *.FB2.ZIP
« on: October 22, 2015, 04:29:06 »
I have a lot of books in a format *.fb2. To save disk space, all the books are stored in zip-archives. Therefore, my books have a double extension *.fb2.zip.
To read books using SumatraPDF, without unpack them from the archive.
Conventional zip-archives handle standard way.

Code: [Select]
@var $RunCMD = "SumatraPDF.exe"
@var $file_nm = GetSourceFocusPath();
@var $fb2zip = StrIsRegExpMatchNoCase( $file_nm, ".FB2.ZIP$");
if ( $fb2zip > 0 )
{
   MC.Run CMD='"{$RunCMD}"' ARG='"{$file_nm}"';
}
else
{
   MC.DataViewer.View FILE="${focusfilepath}" BINARY;
}

How to assign F3 to run this script?
« Last Edit: October 22, 2015, 05:19:36 by Tezcatlipoca »

Mathias (Author)

  • Administrator
  • VIP Member
  • *****
  • Posts: 4492
    • View Profile
    • Multi Commander
Re: View *.FB2.ZIP
« Reply #1 on: October 22, 2015, 09:14:03 »
In the "UserDefinedCommand" select your command and then press "hotkey" button
select that you want to assign F3.. It will say there is a conflict. .so press "Resolve Conflict " it will remove F3 from what has it now and then assign F3 to your command again

Tezcatlipoca

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: View *.FB2.ZIP
« Reply #2 on: October 23, 2015, 02:28:31 »
I'm sorry, but I do not know much English, so wrongly asked.
how to assign the desired key, I know.

The problem is that I want to leave everything standart view settings: pictures, texts, etc. as it is, and only on the zip-archive to check what their view.
and that I want to set up in "File Type Setup" tab Viewers (key "F3"!!!)

how to assign the execution of my script for *.zip?
there can only be: "Program Path / Internal Extension (" MC Picture Viewer "and" MultiDataViewer ") / Windows Action"

can somehow use MC.RunUserCmd?

Ideally - to do the treatment by the Commander of double, triple, etc. extensions.

I can write view.cmd and use it to determine the file type and assign the desired program. But then it is no need to configure the file types in the Multi Commander and is the main charm of Multi Commander - own scripting language.

Mathias (Author)

  • Administrator
  • VIP Member
  • *****
  • Posts: 4492
    • View Profile
    • Multi Commander
Re: View *.FB2.ZIP
« Reply #3 on: October 23, 2015, 10:42:11 »
You cannot make the FileType setup run a script.
But you can from your script call the core view function instead. And this view function will then use FileType setup to figure out what viewer it should use.

So instead of calling MC.DataViewer.View in your script call MC.View

Code: [Select]
MC.View FILE="${focusfilepath}"

Tezcatlipoca

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: View *.FB2.ZIP
« Reply #4 on: October 26, 2015, 03:36:58 »
SUPER!!!!  This is exactly what you need!
All the tunes in the "File Type Setup", not need any additional settings.

and the script checks only *.FB2.ZIP, and... VIEWAS="*.FB2"

Code: [Select]
if ( IsFolder( "{focusfilepath}" ) )
{
# This is folder...
MC.Explorer.SizeFolder ONLYFOCUS;
break;
}
if ( StrIsRegExpMatchNoCase( "${focusfilepath}", "\.FB2\.ZIP$" ) )
{
# FictionBook v2 in ZIP
MC.View FILE="${focusfilepath}" VIEWAS="*.FB2";
}
else
{
# other...
MC.View;
}

Here are carried out all my requirements, there is no duplication of settings and everything is easy.