Comic Book CBx-To-CBx Convert & Resize v1.50

Hi!

Thanks for your help! I tried it and got a different error now:

Error at line 402, position 3
Variable is undefined: 'nHeight' (0x800a01f4)

Try this:

CBx to CBx 1.5.2-fixed.dcf (57.2 KB)

1 Like

You're fast! Thank you so much, that worked and the tool did an awesome job! :smiley:

You guys rock!

1 Like

One more question... is there a part of the script or the UI where I can set the default resize option to the ipad air 1536 x 2048, as opposed to the android table that it defaults to?

Thanks again

I think if you edit this highlighted line:

...you can change the 1 at the end of the line to the number of option/line you want to be selected initially in the list of resolutions when the dialog opens.

2 Likes

Ha! you were right! I had previously tried changing the two lines that followed it and when that didn't work, I just asked here.

Thanks again!

AR

No problem. I think those lines change the values in the edit controls to the right of the list, which are probably only used when the "custom" option at the bottom of the list is selected. (I only had a quick look at the script, so this may be wrong.)

It's been awhile since I made this, but I think if you set this value to 20 it should stick. No additional setting needs to be set. I remember that I was playing around with global configuration settings, but can't remember what has happened with that in the end. :slight_smile:

Forgot to reply that yes, 20 was the one I needed. Thank you all for your help, this button/scripts works wonderfully, I've saved a ton of space and they still look great. Props!

so anyone have anyway in this script to set the default to not resize just convert? I tried adding the line

dlgO.Control('chkDoNotResize').Value = 1

after the resize settings block. The button will run but it doesn't recompress the file. Without that line and clicking things manually it works fine.

I haven't tested it, but changing/adding the last two lines here might do it:

'Set defaults
'Resolution: 800×1280
 dlgO.Control("lstResolution").Value = 1
 lngNewHeight = 1280
 lngNewWidth  = 800
 strResizeMode = "Do Not Resize" ' CHANGED -- Was "Auto"
 dlgO.Control("chkDoNotResize").Value = 1 ' ADDED

A post was split to a new topic: Which config file are script vars stored in?

With Dopus 13, this script doesn't work well.

Function ConvertFileInDirectory (folder, Height, Width, srMode, sQuality, sRatio)
dim cmdConvert
dim strT
'Resize
Set cmdConvert = DOpus.Create.Command()
   cmdConvert.Clear()
   cmdConvert.ClearFiles()
   cmdConvert.AddFilesFromFolder(folder)
   [...]
    if sRatio<>0 then
    cmdConvert.Clear()
    cmdConvert.Addline ("Image CONVERT=jpg QUALITY=" & sQuality & " PERCENT="& sRatio & " REPLACE HERE" )
    end if
   cmdConvert.Run()
   End If
End function

The problem is with the convert function. I've got an error when the script try to convert a folder.

If the CBZfile have this structure:

TEst.cbz
     \test (folder)
            test01.jpg
            test02.jpg

the test.cbz is unzipped in temp folder , and we use addfilesfromfolder with the temp folder as parameter.
But now, there is 3 objects that will be send to convert . 2 files and 1 folder.
and I've got an error when he tried to convert the folder.

This script is still working fine with Dopus 12.
I don't know if the problem is that addilesfromfolder adds folders now, or if the CONVERT command is more sensitive to reporting errors!
Is there any ways to filter Addfilesfromfolder to only have files or to force silent to CONVERT?

You can test by renaming the example zip file to cbz and using this parameter
image

Test.zip (3.1 MB)

Not sure if it means anything to you, but I'm still using my original v1.5.0 (from the first post), since it perfectly suits my needs, and it look like it's working just fine with Opus 13.

Thx for your help, but my question was more for @Leo :smiley:

Rated_RR knows more about his script than I do.

As I understand it, you're trying to run the image converter on a folder rather than (or in addition to) the files inside the folder? I don't think that would have ever worked?

As I understand it, you're trying to run the image converter on a folder rather than (or in addition to) the files inside the folder? I don't think that would have ever worked?

In fact, I've never tried to convert a folder :wink: I thought that addfilesfromfolder only add files from folder (and subfolder), and not folder itself. That was why I used this command.
I found now that it has folder name too because my script (the V2) report error on the folder conversion. (and then continue with the files)
The same script on dopus 12 have no error. But I don't know if it because addfilesfromfolder in do12 skip folder, or if the convert command don't report error on DO12.

Opus 13 has more error reporting in the image converter. It was probably failing when asked to convert a folder in 12 but not telling you.

Command.AddFilesFromFolder docs:

Adds the contents of the specified folder to the collection of items this command is to act upon. You can pass the folder's path as either a string or a Path object. You can also append a wildcard pattern to the path to only add files matching the specified pattern.

If you want to filter things beyond a simple wildcard, use FSUtil.ReadDir instead.

I wish I knew, but as I understand @oevesque has heavily modded the initial version of the script. I never really went into details, as I never needed additional options. Sorry. :slight_smile:

1 Like

I've changed
cmdConvert.AddFilesFromFolder(folder)
to

dim folderEnum
dim folderItem
[..]
   Set folderEnum = DOpus.FSUtil.ReadDir(folder) 'pas d'argument r, la recherche recursive est effectué dans la procédure appelante
   Do while (not folderEnum.complete)
   		set folderItem = folderEnum.Next
		if not (folderItem.is_dir) and (InStr(".JPG;.JPEG;.PNG;.WEBP;", Ucase(folderItem.ext) & ";") > 0)   then 'removing folder and non image files
			cmdConvert.AddFile(folder &"\" & folderItem.name)
		End if

My script have been updated in my 2019-04-02 original post.