![]() |
#16 |
null operator (he/him)
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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" 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 |
![]() |
![]() |
![]() |
#17 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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:
|
|
![]() |
![]() |
![]() |
#18 | |
Groupie
![]() Posts: 171
Karma: 10
Join Date: Dec 2008
Device: Likebook Mars
|
Quote:
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:\) |
|
![]() |
![]() |
![]() |
#19 |
Groupie
![]() 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.
|
![]() |
![]() |
![]() |
#20 | |
null operator (he/him)
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 21,772
Karma: 30237628
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
Quote:
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) Code:
"C:\htmlz2zip.bat " "%1" Code:
"C:\htmlz2zip.bat "«library path»\Freeze Tag - Caroline B. Cooney.htmlz" 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. |
|
![]() |
![]() |
![]() |
#21 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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 ![]() 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 |
![]() |
![]() |
![]() |
#22 |
null operator (he/him)
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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 |
![]() |
![]() |
![]() |
#23 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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" Code:
"C:\Program Files (x86)\ubook\uBook.exe" "%%~da%%~pa%%~na.zip" Code:
) |
![]() |
![]() |
![]() |
#24 |
null operator (he/him)
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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" 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" @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% BR Last edited by BetterRed; 03-27-2014 at 10:46 PM. |
![]() |
![]() |
![]() |
#25 |
Groupie
![]() 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.
|
![]() |
![]() |
![]() |
#26 | |
Groupie
![]() Posts: 171
Karma: 10
Join Date: Dec 2008
Device: Likebook Mars
|
Quote:
|
|
![]() |
![]() |
![]() |
#27 | |
Groupie
![]() 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:
|
|
![]() |
![]() |
![]() |
#28 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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. |
![]() |
![]() |
![]() |
#29 | |
null operator (he/him)
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 21,772
Karma: 30237628
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
Quote:
![]() @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% Last edited by BetterRed; 03-28-2014 at 04:35 PM. |
|
![]() |
![]() |
![]() |
#30 |
Groupie
![]() 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
![]() ![]() ![]() ![]() ![]() |
![]() |
![]() |
![]() |
|
![]() |
||||
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 |