Re: [Lazarus] Launching External Tool Cmd.exe in Windows

2016-09-26 Thread Lars via Lazarus
On Sat, September 24, 2016 11:06 pm, Cyrax via Lazarus wrote:
>> Any idea what workarounds people used before? Surely someone used
>> cmd.exe before as an external tool in an older version.  I tend to not
>> use the latest version from source control. But I can, if I have to!
>>
>
> In Tools->Configure External tools...->Add dialog, input these:
>
>
> Title : Command Prompt
> Program Filename : $Env(COMSPEC)
> Parameters : '/c "start "Command Prompt" "%COMSPEC%""'
>
>

Genius! Any idea how to launch a console app using this trick?


i.e. I develop a console app in lazarus (the $TargetFile()) and want to
launch it but leave it open. Cmd /k was what I thought.

 other option would be to make a ms dos batch file, that launches a
command window, and run it. Or like the other poster said, create a
launcher program
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Launching External Tool Cmd.exe in Windows

2016-09-24 Thread Cyrax via Lazarus

On 23.09.2016 02:22, Lars wrote:

On Thu, September 22, 2016 3:45 pm, Mattias Gaertner wrote:

Oh, when did you add this, long ago or just recent... which release...
or is it only on the latest github/svn. Thanks, I did not see this
option


Just recently, as in today.


Mattias



Any idea what workarounds people used before? Surely someone used cmd.exe
before as an external tool in an older version.  I tend to not use the
latest version from source control. But I can, if I have to!



In Tools->Configure External tools...->Add dialog, input these:

Title : Command Prompt
Program Filename : $Env(COMSPEC)
Parameters : '/c "start "Command Prompt" "%COMSPEC%""'

If single line contains at least one space to separate parameters then 
whole line will be enclosed with double quotes automatically, thus 
making it one parameter option. Single quotes at the beginning and the 
end will prevent this.


In Parameters text box, you can have multiple lines and those lines will 
be one parameter per line.


--
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Launching External Tool Cmd.exe in Windows

2016-09-23 Thread shoKwave

Am 22.09.2016 um 23:13 schrieb Lars:


To clarify I meant the external tools in the IDE that allow you to launch
a tool from the IDE tools menu...
i.e. not actual lazarus coding, but a tool to launch from the IDE. Most
text editors have this feature, lazarus has really good access to lots of
macros that fill in values.

I'm sorry, I totally misread your mail.

As a workaround (Mathias already fixed it in trunk) you could use a 
simple program to start the program you actually want to run. I attached 
an example (runner.lpi). It just starts the program given in the 1st 
parameter with all following parameters.


The picture shows how I used it to run the time command inside the cmd.exe.

Hope this helps you.

Ingo
program runner;

uses SysUtils, Process;

var AProc: TProcess;
i: Integer;

begin
  //Any Parameters at all?
  if ParamCount > 0 then
  begin
//Create the Process
AProc:= TProcess.Create(NIL);
//First parameter is the program to run
AProc.Executable := ParamStr(1);
//Add Parameters
if ParamCount > 1 then
begin
  for i := 2 to ParamCount do
  begin
AProc.Parameters.Add(ParamStr(i));
  end;
end;
//Run and free the Process
try
  AProc.Execute;
finally
  AProc.Free;
end;
  end;
end.

-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Launching External Tool Cmd.exe in Windows

2016-09-22 Thread Lars
On Thu, September 22, 2016 3:45 pm, Mattias Gaertner wrote:
>> Oh, when did you add this, long ago or just recent... which release...
>> or is it only on the latest github/svn. Thanks, I did not see this
>> option
>
> Just recently, as in today.
>
>
> Mattias


Any idea what workarounds people used before? Surely someone used cmd.exe
before as an external tool in an older version.  I tend to not use the
latest version from source control. But I can, if I have to!
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Launching External Tool Cmd.exe in Windows

2016-09-22 Thread Mattias Gaertner
On Thu, 22 Sep 2016 15:14:21 -0600
"Lars"  wrote:

> On Thu, September 22, 2016 3:08 am, Mattias Gaertner wrote:
> >
> > I added two options "Show console" and "Hide window". Enable Show
> > console and disable Hide window and cmd.exe will be shown in a console
> > window.
> >
> > Mattias  
> 
> 
> Oh, when did you add this, long ago or just recent... which release... or
> is it only on the latest github/svn. Thanks, I did not see this option

Just recently, as in today.

Mattias
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Launching External Tool Cmd.exe in Windows

2016-09-22 Thread Lars
On Thu, September 22, 2016 3:08 am, Mattias Gaertner wrote:
>
> I added two options "Show console" and "Hide window". Enable Show
> console and disable Hide window and cmd.exe will be shown in a console
> window.
>
> Mattias


Oh, when did you add this, long ago or just recent... which release... or
is it only on the latest github/svn. Thanks, I did not see this option
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Launching External Tool Cmd.exe in Windows

2016-09-22 Thread Lars
On Thu, September 22, 2016 2:38 am, shoKwave wrote:
> Hi,
>
>
> I simply tried putting a TProcess and a TButton on a form and used
> following code
>
> procedure TForm1.Button1Click(Sender: TObject); begin
> Process1.ApplicationName:='c:\windows\system32\cmd.exe';
> Process1.Execute;
> end;
>
> Works for me on a Win10 32bit machine with FPC 3.0.0 and Lazarus 1.6.
>


To clarify I meant the external tools in the IDE that allow you to launch
a tool from the IDE tools menu...
i.e. not actual lazarus coding, but a tool to launch from the IDE. Most
text editors have this feature, lazarus has really good access to lots of
macros that fill in values.

For some reason cmd.exe /k doesn't launch the command line from lazarus
external tools in the menu. /k option keeps the command line window open
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Launching External Tool Cmd.exe in Windows

2016-09-22 Thread Mattias Gaertner
On Thu, 22 Sep 2016 00:14:17 -0600
"Lars"  wrote:

> Hi, Lazarus has the nice feature of being able to launch an external tool.
> 
> I'm trying to launch a console app...
> 
> So I put C:\Windows\System32\cmd.exe in the program file name for the
> external tool. This does nothing and gives no error message. Also add the
> parameter /k and it still does nothing.
> 
> Any idea how to get lazarus to launch a simple cmd.exe instance as an
> external tool? Should this be filed as a bug if it doesn't work?
> 
> Other things I will try... COMSPEC... but still cmd.exe should work, no?

I added two options "Show console" and "Hide window". Enable Show
console and disable Hide window and cmd.exe will be shown in a console
window.

Mattias
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Launching External Tool Cmd.exe in Windows

2016-09-22 Thread shoKwave

Hi,

I simply tried putting a TProcess and a TButton on a form and used 
following code


procedure TForm1.Button1Click(Sender: TObject);
begin
  Process1.ApplicationName:='c:\windows\system32\cmd.exe';
  Process1.Execute;
end;

Works for me on a Win10 32bit machine with FPC 3.0.0 and Lazarus 1.6.

Ingo

Am 22.09.2016 um 08:14 schrieb Lars:

Hi, Lazarus has the nice feature of being able to launch an external tool.

I'm trying to launch a console app...

So I put C:\Windows\System32\cmd.exe in the program file name for the
external tool. This does nothing and gives no error message. Also add the
parameter /k and it still does nothing.

Any idea how to get lazarus to launch a simple cmd.exe instance as an
external tool? Should this be filed as a bug if it doesn't work?

Other things I will try... COMSPEC... but still cmd.exe should work, no?




--
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus


[Lazarus] Launching External Tool Cmd.exe in Windows

2016-09-21 Thread Lars
Hi, Lazarus has the nice feature of being able to launch an external tool.

I'm trying to launch a console app...

So I put C:\Windows\System32\cmd.exe in the program file name for the
external tool. This does nothing and gives no error message. Also add the
parameter /k and it still does nothing.

Any idea how to get lazarus to launch a simple cmd.exe instance as an
external tool? Should this be filed as a bug if it doesn't work?

Other things I will try... COMSPEC... but still cmd.exe should work, no?


-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus