jazzyjeff Posted September 2, 2010 Share Posted September 2, 2010 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 Link to comment Share on other sites More sharing options...
JohnOne Posted September 2, 2010 Share Posted September 2, 2010 $sName = InputBox("InputBox","Name") FileWrite(@ScriptDir & "\newscript.au3",'MsgBox(0,"MsgBox","' & $sName & '")') AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
FuryCell Posted September 2, 2010 Share Posted September 2, 2010 (edited) Do you need to compile the exe automaticly? Edited September 2, 2010 by FuryCell HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code. Link to comment Share on other sites More sharing options...
maqleod Posted September 2, 2010 Share Posted September 2, 2010 (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 September 2, 2010 by maqleod [u]You can download my projects at:[/u] Pulsar Software Link to comment Share on other sites More sharing options...
jazzyjeff Posted September 2, 2010 Author Share Posted September 2, 2010 Perfect! Thanks guys. Link to comment Share on other sites More sharing options...
ShawnW Posted September 2, 2010 Share Posted September 2, 2010 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. Link to comment Share on other sites More sharing options...
Valuater Posted September 2, 2010 Share Posted September 2, 2010 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 therehttp://www.xpcleanmenu.hostrocket.com8)BTW: the entire code and ini files are here in Autoit Link to comment Share on other sites More sharing options...
jazzyjeff Posted September 3, 2010 Author Share Posted September 3, 2010 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. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now