Multi Commander > Script

View *.FB2.ZIP

(1/1)

Tezcatlipoca:
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: ---@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;
}

--- End code ---

How to assign F3 to run this script?

Mathias (Author):
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:
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):
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: ---MC.View FILE="${focusfilepath}"
--- End code ---

Tezcatlipoca:
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: ---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;
}

--- End code ---

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

Navigation

[0] Message Index

Go to full version