Sign in to follow this  
Followers 0
jazzyjeff

Recompile a script possible?

8 posts in this topic

Hello,

Like the title suggests, I am wondering if it is possible to create a new exe from an existing script.

For example, I have a script that prompts for a name. Once I enter the name and click ok, a new script/exe is created that when run will open up a msgbox that says something like "My name is TYPED-NAME." Whenever that new exe is run, it will always come up and say "My name is TYPED-NAME."

Here is some code just to make it more clear.

Script 1

Global $name

InputBox("Name","Please enter your name")

Script 2

Global $name

MsgBox(0,"Name","My name is " & $name & ".")

So I am basically wondering if by setting the variable $name in Script 1, if a new script (Script 2) can be compiled and a new exe be created with the variable set.

If this doesn't make sense, please let me know so I can elaborate more.

Thanks,

Jeff

Share this post


Link to post
Share on other sites



#4 ·  Posted (edited)

Yes, you can compile a script through the command line, look at the help file under Using AutoIt -> Compiling Scripts

just call the command using Run() on a script you write dynamically as suggested by JohnOne and you'll have your compiled exe on the fly

Edited by maqleod

[u]You can download my projects at:[/u] Pulsar Software

Share this post


Link to post
Share on other sites

Perfect! Thanks guys.

Share this post


Link to post
Share on other sites

Assuming the .exe is not going to be copied off the computer by itself, would it not be easier to use a .ini file or some other method of data storage for the name. And have the script look for the data there.

Share this post


Link to post
Share on other sites

Assuming the .exe is not going to be copied off the computer by itself, would it not be easier to use a .ini file or some other method of data storage for the name. And have the script look for the data there.

Thats exactly what I did. But you have to know the exact use of the program.

For me, I was trying to give new Menu Bar GUI's or program faces for "XP Clean Menu". I ended up using an ini file and the actual program had numerous lines of "create" code built-in.

here is the link... it's still there

http://www.xpcleanmenu.hostrocket.com

8)

BTW: the entire code and ini files are here in Autoit


NEWHeader1.png

Share this post


Link to post
Share on other sites

I've never had the need to write ini files in my scripts, so I was a little nervous about doing this. I've just read the help file, and it seems pretty straight forward. I'll work on this today.

Thanks for your help. I'll post back to let you know how I got on.

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