Sign in to follow this  
Followers 0
TheDcoder

Adding information to created files

6 posts in this topic

Let me explain the problem first:

I have a program which packs some .docx files into a .my_docs file (Created with 7za.exe and encrypted with _Crypt_EncryptFile funtion). Now I want the list of .docx files inside .my_docs file..... Can I add the list of .docx files to .my_docs without effecting the 7zip archive?

(Don't tell to "Extract the files to the temp folder and use _FilelistToArray Funtion" to get the list of files b/c the archive is extremely big [~900 MB])


AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

Spoiler

My contributions to the AutoIt Community

Some messages & Apologizes:

If I hurt you, Please accept my apologies, I never (regardless of the situation) mean to hurt anybody!!!

Also, I am very busy with my project so I will appear in the last row of the online list, if you want to contact me: Email@TheDcoder.xyz

Or you can have a nice chat with me in freenode, I use the same nick on freenode too!

3fHNZJ.gif

PLEASE JOIN ##AutoIt AND HELP THE IRC AUTOIT COMMUNITY!

Share this post


Link to post
Share on other sites



7za.exe l  - this will list archive contents; however you will need to decrypt first, of course - or just let 7za handle the encryption for you.when you create the archive.

Share this post


Link to post
Share on other sites

I am a little sceptical now


AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

Spoiler

My contributions to the AutoIt Community

Some messages & Apologizes:

If I hurt you, Please accept my apologies, I never (regardless of the situation) mean to hurt anybody!!!

Also, I am very busy with my project so I will appear in the last row of the online list, if you want to contact me: Email@TheDcoder.xyz

Or you can have a nice chat with me in freenode, I use the same nick on freenode too!

3fHNZJ.gif

PLEASE JOIN ##AutoIt AND HELP THE IRC AUTOIT COMMUNITY!

Share this post


Link to post
Share on other sites

orbs is right.

I will see if I can find an example of how I did it, but don't hold your breath, have a go while you wait, and don't count on me.


AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

See what you can glean from this.

$ebk = '"' & $flepth & '"'
            ;Run(@ComSpec & " /k 7z.exe l " & $ebk, $pfold)
            $txtfle = @ScriptDir & "\zip.txt"
            $zipfle = '"' & $txtfle & '"'
            ; Pipe zipped file content list to a text file for checking
            Run(@ComSpec & " /c 7z.exe l " & $ebk & ">" & $zipfle, $pfold)
            Sleep(2000)
            ; Open and read the piped to text file, to auto find ebook extension
            $file = FileOpen($txtfle, 0)
            $text = FileRead($file)
            FileClose($file)
            $webfld = ""
            ; Check if any text in piped to text file
            If $text <> "" Then
                ; Text found, so count lines and find filenames
                $text = StringSplit($text, @CRLF, 1)
                If $text[0] > 12 Then
                    ; Filenames should start at line 13
                    $exts = ""
                    $dashes = ""
                    For $t = 12 To $text[0]
                        $line = $text[$t]
                        If StringInStr($line, "----") > 0 Then
                            ; Gone past filenames, so exit checking
                            If $dashes = "" Then
                                ; First instance
                                $dashes = 1
                            Else
                                ; Second instance, so exit because file entries have been passed.
                                ExitLoop
                            EndIf
                        Else
                            ; Add any filenames as possibilities
                            $line = StringSplit($line, " ")
                            $file = $line[$line[0]]
                            ;MsgBox(262192, "Text Line", $file, 0)
                            If StringInStr($file, ".") > 0 Then
                                $line = StringSplit($file, ".")
                                $line = $line[$line[0]]
                                If $exts = "" Then
                                    ; Check first extension
                                    If $line <> "jpg" And $line <> "png" And $line <> "gif" Then
                                        ; If not an image file, then add
                                        $id = 1
                                        $exts = $line
                                        $lines = $id & " - " & $file
                                    EndIf
                                Else
                                    ; Check other extensions
                                    If $line <> "jpg" And $line <> "png" And $line <> "gif" Then
                                        ; If not an image file, then add
                                        $id = $id + 1
                                        $exts = $exts & "|" & $line
                                        $lines = $lines & "|" & $id & " - " & $file
                                    EndIf
                                EndIf
                                CheckForWebFolder()
                            Else
                                CheckForWebFolder()
                            EndIf
                        EndIf
                    Next
                    If StringInStr($exts, "|") > 0 Then
                        ; Provide filenames from zip and prompt user to select correct one
                        $lines = StringReplace($lines, "|", @LF)
                        SplashOff()
                        $id = InputBox("Ebook File Query", _
                            "The program found more than one possible" & @LF & _
                            "ebook file type in the zipped file, but could" & @LF & _
                            "not detect the correct one." & @LF & @LF & _
                            "Please enter the number of the correct file" & @LF & _
                            "listed below - any right ebook one will do." & @LF & @LF & _
                            $lines, 1, "", 235, 450, -1, -1, 0, $AddEbook)
                        If @error Then
                            $exts = ""
                        Else
                            $exts = StringSplit($exts, "|")
                            If $id <= $exts[0] Then
                                $form = $exts[$id]
                                $form = StringUpper($form)
                                GUICtrlSetData($Combo_format, "", "")
                                GUICtrlSetData($Combo_format, $formats, $form)
                                ;$fext = $exts[$id]
                                ;$fext = StringUpper($fext)
                                ;GUICtrlSetData($Combo_format, "", "")
                                ;GUICtrlSetData($Combo_format, $formats, $fext)
                            Else
                                $exts = ""
                            EndIf
                        EndIf
                        SplashTextOn("", "Please Wait!", 200, 120, -1, -1, 33)
                    Else
                        ; Only one extension found
                        If StringInStr($formats, "|" & $exts & "|") > 0 Then
                            ; A known ebook type so return it
                            $form = StringUpper($exts)
                            GUICtrlSetData($Combo_format, "", "")
                            GUICtrlSetData($Combo_format, $formats, $form)
                            ;$fext = StringUpper($exts)
                            ;GUICtrlSetData($Combo_format, "", "")
                            ;GUICtrlSetData($Combo_format, $formats, $fext)
                        Else
                            ; Doesn't appear to be a known ebook type
                            $exts = ""
                        EndIf
                    EndIf
                EndIf
            EndIf

I suggest you take it apart line by line and adapt for your code and requirements.

Certainly don't try to run my code as is. Just a chunk of code taken from a much bigger function, etc.

There is no doubt a sizable portion of unnecessary (for you) code there.

I don't doubt for a minute, that there is a better way to do it, but I took the simple, if more laborious route.

NOTE - Obviously I'm using the EXE not the DLL, so you will probably need to adapt for that too.

Edited by TheSaint

AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Share this post


Link to post
Share on other sites

I think its hard, but i am gonna continue my research


AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

Spoiler

My contributions to the AutoIt Community

Some messages & Apologizes:

If I hurt you, Please accept my apologies, I never (regardless of the situation) mean to hurt anybody!!!

Also, I am very busy with my project so I will appear in the last row of the online list, if you want to contact me: Email@TheDcoder.xyz

Or you can have a nice chat with me in freenode, I use the same nick on freenode too!

3fHNZJ.gif

PLEASE JOIN ##AutoIt AND HELP THE IRC AUTOIT COMMUNITY!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0