-
Posts
15,666 -
Joined
-
Last visited
-
Days Won
455
TheSaint last won the day on April 17
TheSaint had the most liked content!
About TheSaint

- Birthday June 8
Profile Information
-
Member Title
Sharpest Tool On The Shelf
-
Location
South Downunder
-
Interests
Guitar
Songwriting & Recording
Music
Reading - Fiction & Non-Fiction
Computers
Technology
Life concepts
Programming with AutoIt of course
Oops I forgot Sex and Humor ... possibly together even.
Recent Profile Visitors
5,134 profile views
TheSaint's Achievements
-
TheDcoder reacted to a post in a topic: Kobo Cover Fixer
-
Latest update now available, see the first post. Sometimes I make myself laugh ... which is probably a good thing. I can be so sure I've come to end of thinking of new additions and changes, and then something else pops into my brain while asleep or during waking. Such happened today, and so we have another update. Basically, as I was waking, I was contemplating how best to approach working with the Kobo device today. I knew the battery was flat, and that it takes around an hour to charge, so I had that window before I then started getting USB connection issues due to the device being fully charged. So I wanted to make the most of it. That was when it occurred to me that some kind of guide via my program would be helpful in speeding things up etc. That meant having controls (buttons) indicate they were the one to click to get started etc. The first approach I thought of, was using a graphic rectangle around a button, that was colored red, and hide or show that as needed. I'd done that before in a couple of programs, but as I recalled it, it could be a bit tricky ... and I couldn't recall what programs I'd done it to, so would either have to spend time searching for one, or attempt to do it all again from scratch. Then I thought that colored text on the buttons could be almost as effective, so did that instead. Of course, you could color the buttons instead, but you can lose the visual of the push effect. Latest Changes Anyway, I did some of that stuff after creating or adding images to my Kobo device. I managed to process over 100 entries today, and about a third of that was done before implementing the new auto NEXT option. Aside from one ebook, which I need to redo, all the others worked a treat. I'm not sure what happened with that one ebook, but I had connected my Kobo device via wifi a couple of times since building my working list, and sometimes missing number sub-folders and images on them get created during a sync, so it could be related to that. I used my newish 'Restore' option to reset for that entry, but not yet redone it because my Kobo was fully charged and the USB connection started playing up again. P.S. At this point I am not sure, if syncing sometimes causes a loss of number sub-folders and thus their contained cover images. In any case, I have been building a record with my program, and so I guess I will see if that ever happens, or is just the result of my device not downloading everything properly from Kobo.
-
TheDcoder reacted to a post in a topic: Kobo Cover Fixer
-
Latest update now available, see the first post. If I had only realized, there was so little to do, I would have included the changes in my last update. But I was too tired to investigate anything more yesterday. Anyway, I checked today, and determined I needed to do very little, to get the FIX COVERS button code up-to-speed. I've not changed anything substantial in the way it works, just some of the record keeping aspect. See the following details. Please be advised though, that I haven't tested the process yet ... not since I last tested at least 10 months ago. It should work like it did previously, just with extra records. Some related stuff follows. This will hopefully be the last update, at least for a while, unless I find a bug. So I am now seeing my program as version 1, and essentially as a full version, some incomplete aspects aside, which are not a requirement to use the program successfully. As I have stated previously, I probably won't ever complete those lesser aspects ... not unless I find I need to for something. I now intend to use my program in earnest, which will test all the major elements, including the FIX COVERS button code. Enjoy!
-
TheDcoder reacted to a post in a topic: Kobo Cover Fixer
-
Latest update now available, see the first post. I did a stack of work today on the program .... then did a stack more. I started off with some improvements that had occurred to me since yesterday, then discovered a couple of bugs, then thought of some more improvements. Then I discovered my Kobo device was almost flat, so a good time to work with it and test a bunch of things. That led to me finding things weren't as good as I wanted them to be, and that I hadn't completed some stuff that needed to be. So implemented a bunch of things and kept testing, and decided I needed to do a few more, and before you knew it most of the day had disappeared. Eventually my Kobo device was fully charged and so kept connecting and disconnecting, so no more testing, though I still had a bunch of things to code and test without needing my device. Latest Changes While not a huge list, it was a lot of work. I'm pretty sure I still need to do more, especially as I haven't looked at the FIX COVERS code again, yet ... not for 10 months at least. I imagine the process still works okay, just needs some additional Log file recording (perhaps). and some visual updating to the list etc, and perhaps some other records. Anyway, I am pleased to say that the many covers created on my Kobo device today, did the job and worked well. Only a few hundred left to do. Those Fuschia colored rows are successful images copied to my Kobo device. Mostly it was three images per each ebook, but sometimes only one was required. If you look back at a previous screenshot, you can see what has changed.
-
I thought it was time to amend a few things in the first post, so I've done that, and also added a new update to download there. Latest Changes Hopefully my bugfix did not break anything, as it was somewhat elusive to figure out.
-
Latest update now available, see the first post. Okay, as I was waking today, it suddenly occurred to me that I had missed a very obvious improvement. This was a Dropzone for quick and easy renaming and copying of a cover image file, in preparation for the main usage of my program. So after pondering on how best to do that, with limited GUI space, I did the following ... optionally repurposed the 'Cover Image' preview field. To do that, you need to enable it via a checkbox on the 'Settings' window. So basically I did the following. That means another level of automation, making things quicker and less fiddly etc. Enjoy!
-
Latest update now available, see the first post. Everything is now in a single ZIP file, including an EXE version. While the program is still not fully complete, it is complete enough to do what it needs to, and I may never get around to fully implementing the Clone stuff etc. Here's what I worked on today. Here's the latest screenshots. That's it. Enjoy! P.S. I am now going to start using my program in earnest, as a lot of cover image files are missing on my Kobo device. It will be a lengthy process though, with most of that taken up with retrieving image files for those ebooks, that luckily exist in my copy of calibre, and using the clipboard button to retrieve text, to rename them appropriately, before moving each image file to the 'Cover Images - Source' folder, and then refreshing the display of that folder content. I have two calibre library folders I need to keep swapping between - Digital Editions, which has all my DRM ebooks from Kobo, plus Kobo (DRM-Free), which is for ebooks that came DRM-Free from Kobo. While the greater number of my Kobo ebooks are in the Digital Editions library folder, I still have a lot in the Kobo (DRM-Free) library folder.
-
That worked too, once I added in the two functions created by ChatGPT.
-
It's a watery based version of ChatGPT in bathers or swimsuit.
-
You are right. And I even consulted with ChatGPT back then, but got nowhere. Maybe I'm a bit smarter now, and perhaps ChatGPT is too. In any case, we painstakingly worked our way through it all this time, and things were discovered that weren't last time. The code covered in this topic is only half the Python code. Then ChatGPT and I worked on the other half, and solved that too. My feedback to ChatGPT was vital, as it allowed it to explore other avenues, which in the end finally resulted in the solution. We went very deep, and I can now claim to have worked successfully with ChatGPT, and that without its help, I would not have succeeded. As they say, if at first you don't succeed, then try try again.
-
Okay, I've now done away with the previously required Python executable and code. Thanks to my persistence and the heavy lifting of ChatGPT, we finally wrestled a solution using pure AutoIt to get the correct numbered sub-folders for cover images for an ebook. You can read about some of that here. NOTE - This was based on some Python code I found in a file of my calibre install. The original Python script can be found in the Other Dependencies.zip file. See the first post for the updated downloads. The Other Dependencies.zip file is now around 7 MB smaller. P.S. Please note that this has had minimal testing so far.
-
Okay, I don't believe it, ChatGPT actually solved it. First time ever for me. Local $inputstr = "file____mnt_onboard_Imports_Brandon_Sanderson_Shadows_Of_Self_-_Brandon_Sanderson_epub" ConsoleWrite("Final Hash: " & qhash($inputstr) & @CRLF) Func StringToUTF8($str) Local $utf8 = "" For $i = 1 To StringLen($str) Local $c = AscW(StringMid($str, $i, 1)) If $c <= 0x7F Then $utf8 &= Chr($c) ElseIf $c <= 0x7FF Then $utf8 &= Chr(0xC0 + BitShift($c, -6)) $utf8 &= Chr(0x80 + BitAND($c, 0x3F)) Else $utf8 &= Chr(0xE0 + BitShift($c, -12)) $utf8 &= Chr(0x80 + BitAND(BitShift($c, -6), 0x3F)) $utf8 &= Chr(0x80 + BitAND($c, 0x3F)) EndIf Next Return $utf8 EndFunc Func UnsignedRightShift($value, $bits) If $bits >= 32 Then Return 0 If $value < 0 Then $value += 0x100000000 Return Int($value / (2 ^ $bits)) EndFunc Func qhash($inputstr) If Not IsString($inputstr) Then Return -1 Local $utf8 = StringToUTF8($inputstr) Local $h = 0x00000000 Local $temp, $val For $i = 1 To StringLen($utf8) $val = Asc(StringMid($utf8, $i, 1)) $h = Mod($h * 16 + $val, 0x100000000) ; unsigned 32-bit left shift $temp = BitAND($h, 0xF0000000) $h = BitXOR($h, UnsignedRightShift($temp, 23)) $h = BitAND($h, 0x0FFFFFFF) Next Return $h EndFunc There was also an issue with the following Python line. h ^= (h & 0xf0000000) >> 23 What ChatGPT had to say.
-
Yeah, I'm not sure where the issue lies. Here is the original Python 2 (seemingly) code. def qhash (inputstr): instr = "" if isinstance (inputstr, str): instr = inputstr elif isinstance (inputstr, unicode): instr = inputstr.encode ("utf8") else: return -1 h = 0x00000000 for i in range (0, len (instr)): h = (h << 4) + ord(instr[i]) h ^= (h & 0xf0000000) >> 23 h &= 0x0fffffff return h As you can see in the range loop, there are aspects that AutoIt doesn't really have an equivalent for out of the box.
-
Okay, thanks I will now try that. But meanwhile ChatGPT has discovered that my Python code is for Python 2 not 3, and that is also part of the problem. Here's its revised code for latest AutoIt. ; Test Local $inputstr = "file____mnt_onboard_Imports_Brandon_Sanderson_Shadows_Of_Self_-_Brandon_Sanderson_epub" ConsoleWrite("Hash: " & qhash($inputstr) & @CRLF) Func qhash($inputstr) If Not IsString($inputstr) Then Return -1 Local $utf8Bytes = StringToBinary($inputstr, 4) ; 4 = UTF-8 Local $length = BinaryLen($utf8Bytes) Local $h = 0x00000000 Local $i, $byte, $val, $temp For $i = 1 To $length $byte = BinaryMid($utf8Bytes, $i, 1) $val = Dec(Hex($byte)) $h = BitShift($h, -4) + $val $h = BitXOR($h, BitShift(BitAND($h, 0xF0000000), 23)) $h = BitAND($h, 0x0FFFFFFF) Next Return $h EndFunc Your code returned the same wrong value of 30822386
-
Yep, I get the same with my version of AutoIt, so it looks like ChatGPT once again is talking out of its posterior. THANKS.
-
I'm not quite running latest AutoIt (AutoIt v3.3.15.0+), but before I bother to upgrade to it, I'd like to know if it will solve my issue. The issue is related to the following code and its return value. Local $inputstr = "file____mnt_onboard_Imports_Brandon_Sanderson_Shadows_Of_Self_-_Brandon_Sanderson_epub" Local $hash = qhash($inputstr) ConsoleWrite("Hash: " & $hash & @CRLF) Func qhash($inputstr) If Not IsString($inputstr) Then Return -1 ; Convert input string to UTF-8 encoded bytes using StringToBinary Local $utf8Bytes = StringToBinary($inputstr, 4) ; 4 = UTF-8 encoding Local $length = BinaryLen($utf8Bytes) Local $h = 0x00000000 Local $i, $byte, $byteVal, $temp ; Process each byte in the UTF-8 byte sequence For $i = 1 To $length $byte = BinaryMid($utf8Bytes, $i, 1) ; Get each byte $byteVal = Dec(Hex($byte)) ; Convert byte to integer value ; Apply hash logic $h = BitShift($h, -4) + $byteVal $temp = BitAND($h, 0xF0000000) $h = BitXOR($h, BitShift($temp, 23)) $h = BitAND($h, 0x0FFFFFFF) Next Return $h EndFunc According to ChatGPT, I need to upgrade to latest AutoIt, for the following reason. I've converted some Python code to AutoIt, but this appears to be the stumbling block. So if someone using latest AutoIt, could run my script and report the return value, that would be great. ChatGPT tried to come up with a suitable work-around but that failed. It tried to manually write a UTF-8 encoder in AutoIt, but said it is likely complex and error-prone. P.S. It would be even better, if someone could provided a reliable workaround, that meant I did not have to upgrade.