Not much else to add. I am starting to learn Flex and after it compiles my stuff, I'd love for it to try and launch the resulting .swf file without me needing to push another button!
Launch multiple programs through one tool?
(6 posts) (4 voices)-
Posted 3 years ago #
-
Hi, this is most easily done by creating a batch file that runs your two programs, e.g.
@echo off program1.exe %1 %2 %3 %4 start %2.swfCall the batch file with all the properties you need from Programmer's Notepad, and they'll be in the batch file as %1, %2, ...
Posted 3 years ago # -
It would be convenient if PN passed the tool command to a hidden command prompt instead. Then we can use fancy stuff like && to do this: "g++ somefile.cpp && out.exe" where out.exe is only run if compilation is successful.
Posted 3 years ago # -
Hi everyone ,
I made a tiny program for PN to run several tools at a time
here is the readme file:
-------------
pnbuilderyou can use this program to run several tools at a time.
the tools you need to run have to be config in config.iniusage:
pnbuilder FullFilePath WorkPath [ProjectName]the symbols used in the config file are similar to PN :
%f ----------> file name eg. abc.c
%F ----------> file name with full path eg. D:\abc\abc.c
%n ----------> file name no ext eg. abc
%d ----------> file path eg. D:\abc\
%p ----------> project name
%D ----------> current work paththe configuration is simple, for example:
in my config.ini, I wrote:
[1]
exe=D:\tools\keil\C51\BIN\C51.exe
param=%F
[2]
exe=D:\tools\keil\C51\BIN\BL51.EXE
param=%d%n.obj to %d%n
[3]
exe=D:\tools\keil\C51\BIN\OH51.EXE
param=%d%nif I use this command to launch pnbuilder:
pnbuilder D:\abc\abc.c D:\abc\the following command will be launch in D:\abc\:
D:\tools\keil\C51\BIN\C51.exe D:\abc\abc.c ;this command will generate an .obj file
if no error and wanning found,the following command will be launch:
D:\tools\keil\C51\BIN\BL51.EXE D:\abc\abc.obj to D:\abc\abc ;link a file with no ext
and again if no error and wanning found,the following command will be launch:
D:\tools\keil\C51\BIN\OH51.EXE D:\abc\abc ;generate a hex filesorry for my poor English and hope this tiny program can help you
max
trlsmax@gmail.com
16/2/2009
--------------------
you can download it here
http://www.levelspace.net/up_files/upload/pnbuilder.ziphope you like it.
Posted 2 years ago # -
Thanks, max. Would you mind providing the source code as well?
Posted 2 years ago # -
here is the code,in delphi
[code]
program pnbuilder;{$APPTYPE CONSOLE}
uses
Windows, SysUtils, IniFiles, StrUtils;var
hReadPipe, hWritePipe: THandle;
si : STARTUPINFO;
lsa : SECURITY_ATTRIBUTES;
pi : PROCESS_INFORMATION;
cchReadBuffer : DWORD;
ph : PChar;
fname : PChar;
cmd, param, section : string;
ExistCode : Dword;
config : TIniFile;
i : integer;
begin
if (paramcount = 0) or (paramcount < 2) or (paramcount > 3) then
begin
writeln('PN Builder by Max');
writeln('usage:pnbuilder FullFilePath WorkPath [ProjectName]');
exit;
end;
i := 1;
fname := allocmem(255);
ph := AllocMem(5000);
lsa.nLength := sizeof(SECURITY_ATTRIBUTES);
lsa.lpSecurityDescriptor := nil;
lsa.bInheritHandle := True;
config := TIniFile.Create(ExtractFilePath(Paramstr(0))+'config.ini');if CreatePipe(hReadPipe, hWritePipe, @lsa, 0) = false then
begin
writeln('Can not create pipe!');
exit;
end;
fillchar(si, sizeof(STARTUPINFO), 0);
si.cb := sizeof(STARTUPINFO);
si.dwFlags := (STARTF_USESTDHANDLES or STARTF_USESHOWWINDOW);
si.wShowWindow := SW_SHOW;
si.hStdOutput := hWritePipe;repeat
begin
section := IntToStr(i);
param := config.ReadString(section,'param','NA');
if AnsiContainsStr(param,'%f') then
param := AnsiReplaceStr(param,'%f',ExtractFileName(ParamStr(1)));
if AnsiContainsStr(param,'%F') then
param := AnsiReplaceStr(param,'%F',ParamStr(1));
if AnsiContainsStr(param,'%n') then
param := AnsiReplaceStr(param,'%n',ChangeFileExt(ExtractFileName(ParamStr(1)),''));
if AnsiContainsStr(param,'%d') then
param := AnsiReplaceStr(param,'%d',ExtractFilePath(ParamStr(1)));
if AnsiContainsStr(param,'%P') then
param := AnsiReplaceStr(param,'%P',ParamStr(3));
if AnsiContainsStr(param,'%D') then
param := AnsiReplaceStr(param,'%D',ParamStr(2));
cmd := config.ReadString(section,'exe','NA')+' '+param;
if CreateProcess(nil, PChar(cmd), nil, nil, true, 0, nil, PChar(ParamStr(2)), si, pi) = False then
begin
writeln('can not create process');
FreeMem(ph);
FreeMem(fname);
Exit;
end;while (true) do
begin
if not PeekNamedPipe(hReadPipe, ph, 1, @cchReadBuffer, nil, nil) then
break;
if cchReadBuffer <> 0 then
begin
if ReadFile(hReadPipe, ph^, 8192, cchReadBuffer, nil) = false then
break;
ph[cchReadbuffer] := chr(0);
writeln(ph);
end
else if (WaitForSingleObject(pi.hProcess, 0) = WAIT_OBJECT_0) then
begin
GetExitCodeProcess(pi.hProcess,ExistCode) ;
i := i+1;
break;
end;
end;
end;
Until ((ExistCode > 0) or (config.ReadString(IntToStr(i),'exe','NA') = 'NA'));ph[cchReadBuffer] := chr(0);
writeln(ph);
CloseHandle(hReadPipe);
CloseHandle(pi.hThread);
CloseHandle(pi.hProcess);
CloseHandle(hWritePipe);
FreeMem(ph);
FreeMem(fname);end.
[/code]Posted 2 years ago #
Reply
You must log in to post.