Jump to content

Help with "packing" an executable with script


BastiJi
 Share

Recommended Posts

Hello,

I've just started playing with Auto-IT for scripting some of the things that are routine and time-consuming.

One such task that Auto-IT helped with was with a program that decrypts some log files we get. The program has to be launched, a decrypt password put in, file to be decrypted selected. Auto-IT automated these three tasks fine.

But now I'm trying to create an executable out of this script, and I was wondering if there's anyway to make the decrypt executable part of the executable that Auto-IT generates, so I can just distribute this Auto-IT generated executable without giving out the decrypt executable and the password. This Auto-IT generated executable would launch the decrypt program, put in the decrypt password, and then open a window to select a file.

So basically my question is that for the Auto-IT generated executables, is it possible to include executable files in them too?

Thanks for any help/insights you guys have

Basti

Link to comment
Share on other sites

Welcome to the Autoit Forums!!!

Yes!!, See FileInstall()

it CAN include executable ( exe ) files

8)

Valuater,

Thank you for that tip. That worked great! Another question though. I tried to install the file in the %WINDIR%\System32 directory, but it seems that Auto-IT doesn't actually read the environment variable. So if I code it to install in C:\Windows\System32 and the user had his system installed in D:\Windows\System32 this would fail.

What would be the preferred way to install the file in a known location without actually hardcoding it?

Thanks for your help!

Basti

Link to comment
Share on other sites

Valuater,

Thank you for that tip. That worked great! Another question though. I tried to install the file in the %WINDIR%\System32 directory, but it seems that Auto-IT doesn't actually read the environment variable. So if I code it to install in C:\Windows\System32 and the user had his system installed in D:\Windows\System32 this would fail.

What would be the preferred way to install the file in a known location without actually hardcoding it?

Thanks for your help!

Basti

Okay, figured this one out. I had to use the @DesktopDir and @WindowsDir macros to get these values.

Very cool.

Thanks for the help guys.

Link to comment
Share on other sites

Welcome!

sorry I come in & out of the forums and missed your question

8)

Valuater,

Oh no no. Your tip was the starting point that led me down this path :)

I did have another question. How can I send the script values from the command line. So can I say "Auto-IT_Generated_Executable.exe MyFileName.txt" and then have this value MyFileName.txt be used somewhere in the script?

Thanks,

Basti

Link to comment
Share on other sites

Valuater,

Oh no no. Your tip was the starting point that led me down this path :)

I did have another question. How can I send the script values from the command line. So can I say "Auto-IT_Generated_Executable.exe MyFileName.txt" and then have this value MyFileName.txt be used somewhere in the script?

Thanks,

Basti

You know I really should look at the documentation before posting here! Won't happen again!

I think I've found the answer. I'll try it and if that doesn't work, come back here ;)

Link to comment
Share on other sites

MyFileName.txt can be opened and read for later use. you can include that .txt with FileInstall() also.

You do not have to run the .txt with your .exe file

_FileReadTo Array() is the one I prefer. It gives each line a "string name and number" or an array

example

#include <file.au3>

Dim $aRecords
Dim $File_Name = "C:\Test.txt"

If Not _FileReadToArray($File_Name,$aRecords) Then
   MsgBox(4096,"Error", " Error reading log to Array     error:" & @error)
   Exit
EndIf

For $x = 1 to $aRecords[0]
    Msgbox(0,'Record:' & $x, $aRecords[$x])
Next

8)

NEWHeader1.png

Link to comment
Share on other sites

MyFileName.txt can be opened and read for later use. you can include that .txt with FileInstall() also.

You do not have to run the .txt with your .exe file

_FileReadTo Array() is the one I prefer. It gives each line a "string name and number" or an array

Valuater,

Valid point, but my problem involves different file names for pretty much every iteration that this program will be run for. I am very close to what I want to do. The only problem left is that after I put in the name of the file in the decrypter program, and the decrypt key, I want to hit enter in the program window so it can start the decrypt process, but that is not happening consistently.

It depends if the mouse is on the window or not. If it's not, then the focus of the window is on some other window and the "enter" key is sent to that window. Is there a way to force a keystroke on a specific window?

Thanks,

Basti

Link to comment
Share on other sites

  • Moderators

Is there a way to force a keystroke on a specific window?

Admittingly before any other questions are asked, this is the only post I've read of this thread....

For that answer, look at ControlSend().

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
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
 Share

  • Recently Browsing   0 members

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