View Single Post
Old 03-21-2014, 05:41 AM   #5
Vortex
Groupie
Vortex began at the beginning.
 
Vortex's Avatar
 
Posts: 171
Karma: 10
Join Date: Dec 2008
Device: Likebook Mars
Again I'm not sure what that means so I'd better explain exactly what I'm trying to do.

In the OS I have .htmlz files associated with the batch file so that when one is clicked the batch file creates a copy renamed to .zip and then opens that in my reader, (my reader does not recognize the htmlz file extension and the zip output is incompatible and in use by other programs.)

The batch works perfect out of Calibre. I have the 'Open With' plugin installed and customized so htmlz should open with the batch. If I click the 'HTMLZ' extension link on the right side of Calibre it stops with the error "File not found". If I click on the 'Open With' icon on the top bar of Calibre and click on 'htmlz' the batch just flashes and exits.

The code in the batch is:
::====== script starts here ===============
::
@echo off & setLocal enableDELAYedeXpansioN

:main
for /f "tokens=* delims= " %%a in ('dir/b *.htmlz') do (
copy "%%a" "%%~Na.zip"
"C:\Program Files (x86)\ubook\uBook.exe" "%%~Na.zip"
)
Pause
::====== script ends here =================

With Echo on I get:
================================================
C:\Users\-\Desktop\books\Calibre Portable>for /F "tokens=* delims= " %a in ('dir
/b *.htmlz') do (
copy "%a" "%~Na.zip"
"C:\Program Files (x86)\ubook\uBook.exe" "%~Na.zip"
)
File Not Found

C:\Users\-\Desktop\books\Calibre Portable>Pause
Press any key to continue . . .
============================================

When run outside of Calibre I get:

============================================
C:\Users\-\Desktop\books\Calibre Portable\Calibre Library\Caroline B. Cooney\Fre
eze Tag (6)>for /F "tokens=* delims= " %a in ('dir/b *.htmlz') do (
copy "%a" "%~Na.zip"
"C:\Program Files (x86)\ubook\uBook.exe" "%~Na.zip"
)

C:\Users\-\Desktop\books\Calibre Portable\Calibre Library\Caroline B. Cooney\Fre
eze Tag (6)>(
copy "Freeze Tag - Caroline B. Cooney.htmlz" "Freeze Tag - Caroline B. Cooney.zi
p"
"C:\Program Files (x86)\ubook\uBook.exe" "Freeze Tag - Caroline B. Cooney.zip"

)
1 file(s) copied.
============================================

Looks like it's trying to copy and convert calibre instead of the book? Anyone help me out with this?

Last edited by Vortex; 03-21-2014 at 06:15 PM.
Vortex is offline   Reply With Quote