Jump to content

Recommended Posts

Posted

I want to have a program to encript a string and write it to a file

E.x. file1 ...

Then read file1 decript the code and write it to another file

E.x. file2

the code works up to write the encripted string in file1 but in file2 all i get it 0 or "

can you please help

#include <GUIConstantsEx.au3>
#include <String.au3>


Opt("MustDeclareVars",1)

Global $lvl, $input, $input2

start()
logi()

Func start()
    Local $msg, $button

    $lvl = 1

    GUICreate("Test")

    $input = GUICtrlCreateInput("Input",0, 25)
    $input2 = GUICtrlCreateInput("Input2",0, 50)
    $button = GUICtrlCreateButton("Button",0, 75)

    GUISetState(@SW_SHOW)

    While 1
        $msg = GUIGetMsg()
        Select
            Case $msg = $GUI_EVENT_CLOSE
                Exit
            Case $msg = $button
                Call("logi")
        EndSelect
    WEnd
EndFunc

Func logi()
    Local $read, $read2, $file, $file2, $te

    $read = GUICtrlRead($input)
    $read2 = GUICtrlRead($input2)

    $file = FileOpen("C:\Test.txt",2)

    FileWrite($file,_StringEncrypt(1,$read,$read2,$lvl))

    FileClose($file)

    $te = FileRead($file)

    $file2 = FileOpen("C:\Test2.txt",2)

    FileWrite($file2,_StringEncrypt(0,$te,$read2,$lvl))

    FileClose($file2)


EndFunc
Posted

Authenticity is right, but It'd like to add that "logi()" on line 10 will never be called, because "start()" never returns and that line 31 should just be "logi()" instead of Call("logi").

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...