Sign in to follow this  
Followers 0
Total_newbie

Executing exit function when script is killed

7 posts in this topic

Hi,

I'm writting a script that will encrypt the log whene exiting. It works ok if I close the script or when the script finishes

Is there anyway to run a exit(encryption) script when the script is killed via taskmanager or pskill.exe?

Thanks

Total_newbie

Share this post


Link to post
Share on other sites



Why don't you encrypt each entry as it's made?

Sounds like a plan. I will check it slows down the script or any other side effect.

thanks a lot lod3n

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Sounds like a plan. I will check it slows down the script or any other side effect.

thanks a lot lod3n

Opt (" *Insert AutoIt On Exit Func Here Cause I cant Remeber It :"> *", "0 or 1... I cant rember that either :whistle:")

Just do a helpfile seacrch for "exit" and see the opt entry..... Should do what you want.

Edit: The proper is:

Opt("OnExitFunc","OnAutoItExit");"OnAutoItExit" called
Opt("OnExitFunc","FunctionName")
Edited by bert

Share this post


Link to post
Share on other sites

Opt (" *Insert AutoIt On Exit Func Here Cause I cant Remeber It :"> *", "0 or 1... I cant rember that either :whistle:")

Just do a helpfile seacrch for "exit" and see the opt entry..... Should do what you want.

Edit: The proper is:

Opt("OnExitFunc","OnAutoItExit");"OnAutoItExit" called
Opt("OnExitFunc","FunctionName")
thanks bert. I'm actually using it but it only works in the cases I mentioned before. when the script is killed I can't run the function that I want. I think the best option would be encrypting each text string...testing right now :-)

Share this post


Link to post
Share on other sites

Why don't you encrypt each entry as it's made?

Hi guys,

I tried the options suggested by lod3n of encrypting every string before writing to file but got some problem with the crypto.au3 or DLLstruct.au3.

here is my code

CODE
#include <crypto.au3>

$password= "a"

$file="file.enc"

$linecounter=1

Func _WriteLine($text)

ConsoleWrite("Text:" & $text & " Line coutner: "&$linecounter&@CRLF)

$text=_EncryptString($text&@CRLF,$password)

If FileWriteLine($file,$text Then $linecounter=$linecounter+1

If $linecounter>5 then

ConsoleWrite("Counter exceeded maximum number of lines that it can write(5)=" & $linecounter&@CRLF)

Exit

EndIf

EndFunc

_WriteLine("test1")

_WriteLine("test2")

_WriteLine("test3")

_WriteLine("test4")

_WriteLine("test5")

_WriteLine("test6")

_WriteLine("test7")

I have attached the error that I'm receiving. Strange enough the function is definitely there in crypto.au3 :-(.

Thoughts?

Regards,

crypto_au3_error.bmp

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