Plainjay
26th June 2010 00:07 UTC
Copy compiled .exe at/after compile time
I'm looking for a way to add the .exe I'm compiling to a folder and build an ISO image off that folder during the compile process (sort of a one-stop process for building everything). It sounds like I'd need to call another batch file or executable to copy the compiled program and do the rest of the processing. How do you call a program and tell the compiler to keep running without waiting for the called program to finish?
Plainjay
26th June 2010 00:13 UTC
Perhaps I should create an .exe to call the compile process and then run the commands I need, after it finishes compiling?
MSG
26th June 2010 08:20 UTC
I don't think there's any practical difference between creating an exe or a batch file.
Anyway, I'm not at all sure if you can access the compiled .exe before the compiler is 100% finished. But if you can, there is a post in these forums explaining how to call a vbs script during compilation.
Afrow UK
26th June 2010 10:40 UTC
You need to use a batch file.
Stu
Plainjay
26th June 2010 15:57 UTC
I suppose it's like trying to pull a rug out from under you while you're standing on it. I still find it strange that you couldn't call a file or program to run in parallel while letting the main exe to continue.
Afrow UK
26th June 2010 16:57 UTC
If you want to add support, go for it :)
Stu
demiller9
26th June 2010 17:26 UTC
Originally posted by Plainjay
I still find it strange that you couldn't call a file or program to run in parallel while letting the main exe to continue.
You can. I do that in several of my scripts. A number of my scripts call other programs to produce md5 hashes of the installer, or create an iso file with the installer and other files.
The last few lines of one of my nsi's look like this:
# create the iso file and its md5
!define ISOFile "${LanguageSuffix}_${VersionMajor}${VersionMinor}_OPSManual"
!system 'start wscript.exe "${BUILDDIR}\MakeIso.vbs" "${SRCDIR}" "${ISOFile}" ${INSTALLER_NAME}'
The MakeIso vbscript starts while makensis.exe is still running, and in fact has not yet written the setup.exe. The vbscript waits for makensis to exit, then does its work with the setup.exe
Sub WaitForMakeNSIS()
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
Do
Set colProcesses = objWmiService.ExecQuery("SELECT * FROM Win32_Process WHERE Name='MakeNSIS.exe'" )
ProcessIsActive = cBool(colProcesses.Count > 0)
If ProcessIsActive Then Wscript.Sleep 250
Loop While ProcessIsActive
End Sub
I've left out most of the vbscript, and didn't show my !defines, but this should be enough for you to duplicate it.
Don
Plainjay
26th June 2010 18:18 UTC
That's the kind of thing I was looking for, thanks! Still considering making an exe to do compiling and building of the various ISO's' however, master compiler essentially. Looking for a way to send a /switch to the .exe with variable info (to change the what the .exe does at the time it's run depending on the variable given). I'm sure that's written somewhere in the documentation.. and I'm missing it.
Plainjay
26th June 2010 19:00 UTC
Nevermind I'll use a GUI to select the file, was considering using the /D switch on execute to determine which program was going to be compiled but in this case a GUI is the way to go for my company.