Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Library Management

Notices

Reply
 
Thread Tools Search this Thread
Old 03-27-2014, 10:09 AM   #16
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 21,772
Karma: 30237628
Join Date: Mar 2012
Location: Sydney Australia
Device: none
@Vortex - can you post

1. what you get when you double click the HTMLZ
2. what you get when you Send the HTMLZ To your batch file

Or are they the same ?

I would expect to see something like

Code:
echo copy "Title - Author.HTMLZ" "Title - Author.ZIP"
"C:\Program Files\Program Files Portable\ubook\uBook.exe" "Title - Author.ZIP"


Send To on "«library path»\Title - Author.HTMLZ" will invoke your batch file with this command

Code:
C:\htmlz2zip.bat "«library path»\Title - Author.HTMLZ"
I don't understand why you are iterating through a directory, why don't you

extract the string before the ".HTMLZ" from %1 into %N (name)
concatenate %N and ".ZIP" to create %F,
copy %1 to %F
run ubook with %F

BTW: You should delete the ZIP when ubook exits. Its bad practice to leave files in book files that calibre doesn't know about

BR

Last edited by BetterRed; 03-27-2014 at 10:51 AM. Reason: MB went to sleep
BetterRed is offline   Reply With Quote
Old 03-27-2014, 10:30 AM   #17
PeterT
Grand Sorcerer
PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.
 
Posts: 13,548
Karma: 79436716
Join Date: Nov 2007
Location: Toronto
Device: Libra H2O, Libra Colour
From my experiments the "file not Found" means there are NO files matching *.html in the current directory when your script runs.

This is reinforced by the fact that IF any files had been found we should have seen lines like
copy "foo.htmlz" "foo.zip"
being output.

Even in your example above
Quote:
================================================
C:\>for /F "tokens=* delims= " %a in ('dir/b *.htmlz') do (
copy "%a" "%~Na.zip"
"C:\Program Files\Program Files Portable\ubook\uBook.exe" "%~Na.zip"
)
File Not Found

C:\>Pause
Press any key to continue . . .
================================================
all it's saying is there are NO htmlz files in your c:\ directory.
PeterT is offline   Reply With Quote
Old 03-27-2014, 02:55 PM   #18
Vortex
Groupie
Vortex began at the beginning.
 
Vortex's Avatar
 
Posts: 171
Karma: 10
Join Date: Dec 2008
Device: Likebook Mars
Quote:
Originally Posted by BetterRed View Post
@Vortex - can you post

1. what you get when you double click the HTMLZ
2. what you get when you Send the HTMLZ To your batch file

Or are they the same ?

I would expect to see something like

Code:
echo copy "Title - Author.HTMLZ" "Title - Author.ZIP"
"C:\Program Files\Program Files Portable\ubook\uBook.exe" "Title - Author.ZIP"
Send To on "«library path»\Title - Author.HTMLZ" will invoke your batch file with this command

Code:
C:\htmlz2zip.bat "«library path»\Title - Author.HTMLZ"
I don't understand why you are iterating through a directory, why don't you
extract the string before the ".HTMLZ" from %1 into %N (name)
concatenate %N and ".ZIP" to create %F,
copy %1 to %F
run ubook with %F

BTW: You should delete the ZIP when ubook exits. Its bad practice to leave files in book files that calibre doesn't know about

BR
BR, I didn't write the batch file, I'm useless at coding, it's all double dutch to me. Putting "echo" infront of the copy command is stopping the batch from working so this is what I get with '@echo on'.

1. When I double click the HTMLZ I get:
================================================== ===
C:\Program Files\Program Files Portable\Calibre Portable\Calibre Library\Carolin
e B. Cooney\Freeze Tag (6)>for /F "tokens=* delims= " %a in ('dir/b *.htmlz') do
(
copy "%a" "%~Na.zip"
"C:\Program Files\Program Files Portable\ubook\uBook.exe" "%~Na.zip"
)

C:\Program Files\Program Files Portable\Calibre Portable\Calibre Library\Carolin
e B. Cooney\Freeze Tag (6)>(
copy "Freeze Tag - Caroline B. Cooney.htmlz" "Freeze Tag - Caroline B. Cooney.zi
p"
"C:\Program Files\Program Files Portable\ubook\uBook.exe" "Freeze Tag - Carolin
e B. Cooney.zip"
)
1 file(s) copied.
================================================== =
(it works fine)

When I 'Send to' the HTMLZ to the batch file I get:
================================================
C:\>for /F "tokens=* delims= " %a in ('dir/b *.htmlz') do (
copy "%a" "%~Na.zip"
"C:\Program Files\Program Files Portable\ubook\uBook.exe" "%~Na.zip"
)
File Not Found

C:\>Pause
Press any key to continue . . .
================================================
(batch file is in C:\)
Vortex is offline   Reply With Quote
Old 03-27-2014, 03:02 PM   #19
Vortex
Groupie
Vortex began at the beginning.
 
Vortex's Avatar
 
Posts: 171
Karma: 10
Join Date: Dec 2008
Device: Likebook Mars
Peter, even if I copy the htmlz file I'm trying to open through Calibre with the batch file into C:\ it still gives the same error.
Vortex is offline   Reply With Quote
Old 03-27-2014, 04:05 PM   #20
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 21,772
Karma: 30237628
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
Originally Posted by Vortex View Post
BR, I didn't write the batch file, I'm useless at coding, it's all double dutch to me.
@Vortex - Aaah, OK

I'm using «library path» as shorthand for the calibre library/author/book folder. So using the book you're using as your test that would be
Code:
C:\Program Files\Program Files Portable\Calibre Portable\Calibre Library\Caroline B. Cooney\Freeze Tag (6)
The command line 'template' as shown in the bottom panel of File Types Manager is
Code:
"C:\htmlz2zip.bat " "%1"
So when you Send (To) your test HTMLZ the %1 is replaced by the path to the HTMLZ file ie
Code:
"C:\htmlz2zip.bat "«library path»\Freeze Tag - Caroline B. Cooney.htmlz"
I suggest you ask whoever wrote the batch file you have, to rewrite it to do the following,

extract the string before the ".HTMLZ" from %1 into %N (name)
concatenate %N and ".ZIP" to create %F (file)
copy %1 to %F (.htmlz to .zip)
run ubook with %F
delete %F

Don't throw the old one away - rename it to htmlz2zip.batsave

Maybe one of the script kiddies here could do it for you

BR

Last edited by BetterRed; 03-27-2014 at 08:18 PM.
BetterRed is offline   Reply With Quote
Old 03-27-2014, 08:10 PM   #21
PeterT
Grand Sorcerer
PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.
 
Posts: 13,548
Karma: 79436716
Join Date: Nov 2007
Location: Toronto
Device: Libra H2O, Libra Colour
Maybe this?
Code:
@echo off & setLocal enableDELAYedeXpansioN

:main
for /f "tokens=* delims= " %%a in ('dir/b *.htmlz') do (
copy "%%~fa" "%%~da%%~pa%%~na.zip"
"C:\Program Files (x86)\ubook\uBook.exe" "%%~da%%~pa%%~na.zip"
)
Pause
I might have gone slightly overboard in there
The %~da returns the drive letter (ends with a : )
The %~pa returns the path only (fully pathed, and ends with a \ )
The %~na returns just the file name
PeterT is offline   Reply With Quote
Old 03-27-2014, 08:22 PM   #22
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 21,772
Karma: 30237628
Join Date: Mar 2012
Location: Sydney Australia
Device: none
@PeterT - well done (I hope), but you forgot to remove the zip - Vortex wants to run the batch file against HTMLZ files in book folders.

BR
BetterRed is offline   Reply With Quote
Old 03-27-2014, 08:30 PM   #23
PeterT
Grand Sorcerer
PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.
 
Posts: 13,548
Karma: 79436716
Join Date: Nov 2007
Location: Toronto
Device: Libra H2O, Libra Colour
I thought the idea was to copy an HTMLZ file to a ZIP file and thats what I'm doing.

The 'dir/b *.htmlz' looks for the htmlz files
The copy "%%~fa" "%%~da%%~pa%%~na.zip" copys the original fully qualified name (the %%~fa) to the NEW name (the "%%~da%%~pa%%~na.zip") with a ZIP extension

The only thing I'm NOT doing is the delete of the file.

If desired add
Code:
del  "%%~da%%~pa%%~na.zip"
AFTER the
Code:
"C:\Program Files (x86)\ubook\uBook.exe" "%%~da%%~pa%%~na.zip"
and before the
Code:
)
PeterT is offline   Reply With Quote
Old 03-27-2014, 09:05 PM   #24
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 21,772
Karma: 30237628
Join Date: Mar 2012
Location: Sydney Australia
Device: none
@PeterT - the batch file is used as the 'program' that does an 'open' verb in the OS File Association table for HTMLZ - there's no need to look for the HTMLZ file because its full path is passed as the only argument as in

Code:
C:\htmlz2zip.bat "%1"
So when its used the command will be something like

Code:
C:\htmlz2zip.bat "C:\Program Files\Program Files Portable\Calibre Portable\Calibre Library\Caroline B. Cooney\Freeze Tag (6)\Freeze Tag - Caroline B. Cooney.HTMLZ"
So the batch file needs copy the .HTMLZ to a .ZIP in the same location with the same file name, run ubook with the .ZIP and when ubook finishes delete the .ZIP.

@Vortex try this

Rename htmlz2zip.bat to htmlz2zip.batsave
Then replace htmlz2zip.bat with this
Code:
REM echo off !unREM this when you're happy it works
setlocal ENABLEDELAYEDEXPANSION 
set str=%1
set name=%str:HTMLZ=ZIP%
copy %1 %name%
start /wait "C:\Program Files\Program Files Portable\ubook\uBook.exe" %name%
del %name%
There should be no need to use Open With - just press 'V' and select HTMLZ or click HTMLZ in Book Details

BR

Last edited by BetterRed; 03-27-2014 at 10:46 PM.
BetterRed is offline   Reply With Quote
Old 03-28-2014, 01:53 PM   #25
Vortex
Groupie
Vortex began at the beginning.
 
Vortex's Avatar
 
Posts: 171
Karma: 10
Join Date: Dec 2008
Device: Likebook Mars
Ah! looks like we're getting somewhere. That works through Calibre but strangely opens the zip in Winzip instead of ubook. Deletes the zip fine after closing Winzip.
Vortex is offline   Reply With Quote
Old 03-28-2014, 02:00 PM   #26
Vortex
Groupie
Vortex began at the beginning.
 
Vortex's Avatar
 
Posts: 171
Karma: 10
Join Date: Dec 2008
Device: Likebook Mars
Quote:
Originally Posted by PeterT View Post
Maybe this?
Code:
@echo off & setLocal enableDELAYedeXpansioN

:main
for /f "tokens=* delims= " %%a in ('dir/b *.htmlz') do (
copy "%%~fa" "%%~da%%~pa%%~na.zip"
"C:\Program Files (x86)\ubook\uBook.exe" "%%~da%%~pa%%~na.zip"
)
Pause
I might have gone slightly overboard in there
The %~da returns the drive letter (ends with a : )
The %~pa returns the path only (fully pathed, and ends with a \ )
The %~na returns just the file name
That gets the same 'File not found' error as mine.
Vortex is offline   Reply With Quote
Old 03-28-2014, 02:20 PM   #27
Vortex
Groupie
Vortex began at the beginning.
 
Vortex's Avatar
 
Posts: 171
Karma: 10
Join Date: Dec 2008
Device: Likebook Mars
Removing the "Start \wait" from infront of ""C:\Program Files\Program Files Portable\ubook\uBook.exe" %name%" make it work perfectly.
Quote:
REM echo off !unREM this when you're happy it works
setlocal ENABLEDELAYEDEXPANSION
set str=%1
set name=%str:HTMLZ=ZIP%
copy %1 %name%
"C:\Program Files\Program Files Portable\ubook\uBook.exe" %name%
del %name%
Vortex is offline   Reply With Quote
Old 03-28-2014, 02:36 PM   #28
PeterT
Grand Sorcerer
PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.
 
Posts: 13,548
Karma: 79436716
Join Date: Nov 2007
Location: Toronto
Device: Libra H2O, Libra Colour
@BR

Remember the first parameter to the start command is the Window Title; the second one is the command to execute.
PeterT is offline   Reply With Quote
Old 03-28-2014, 03:09 PM   #29
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 21,772
Karma: 30237628
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
Originally Posted by PeterT View Post
@BR

Remember the first parameter to the start command is the Window Title; the second one is the command to execute.
@PeterT - Whaddya mean "Remember ..." I never knew to forget

@Vortex - it might be better to reinstate the start command, otherwise I think there's a danger that the 'del %name%' might happen before ubook has finished reading it

Here's the doco for START http://ss64.com/nt/start.html, have a read about what it says re TITLE - so I think this would be better

Code:
start "" /wait "C:\Program Files\Program Files Portable\ubook\uBook.exe" %name%
BR

Last edited by BetterRed; 03-28-2014 at 04:35 PM.
BetterRed is offline   Reply With Quote
Old 03-28-2014, 05:25 PM   #30
Vortex
Groupie
Vortex began at the beginning.
 
Vortex's Avatar
 
Posts: 171
Karma: 10
Join Date: Dec 2008
Device: Likebook Mars
I did try just removing the "/wait" but that still had it opening in Winzip. With the new line of code above it works perfectly
Vortex is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
MacBook can't read the Calibre program tbhudson Devices 4 07-15-2013 12:44 AM
read HTMLZ format Linux BluePhoenix175 Devices 0 11-16-2012 11:46 PM
NEW? Sony Reader Program - ????? bookratt Deals and Resources (No Self-Promotion or Affiliate Links) 10 12-17-2009 08:53 AM
Is there a program that can read your book file names and make a list? GatorDeb Reading and Management 6 09-26-2008 12:57 PM
ubook 0.9b e-book reader available Colin Dunstan Reading and Management 5 12-28-2004 04:21 PM


All times are GMT -4. The time now is 05:28 PM.


MobileRead.com is a privately owned, operated and funded community.