Recent

Author Topic: Run external APP on Os X  (Read 2402 times)

Odacir

  • New Member
  • *
  • Posts: 43
Run external APP on Os X
« on: June 29, 2015, 09:00:55 pm »
Hi,

I'm trying execute a Photoshop, and open a file from and app, but not work, on OS X...

Anyone know how to solve this?

I tryed:
uses
  ..., LCLIntf;
 
procedure ...
begin
  OpenDocument('test.doc');
end;

Using TProcess, don't compile.

Any help on this are welcome.

A hug!

Dr.Theopolis

  • Jr. Member
  • **
  • Posts: 69
Re: Run external APP on Os X
« Reply #1 on: June 30, 2015, 11:18:31 pm »
I tried it (opendocument) with a doc file using full path to file and it worked on my Mac - opened in Open Office. I tried a jpg file and it opened in Preview.

Using TProcess can be tricky for gui apps - I have had problems with the executed app not being able to be brought to the foreground. You can also use TProcess to execute the open command to start an app, for example: open -a OpenOffice /path/to/file.doc

I am still using Lazarus 1.2.6 and OSX 10.7.5


« Last Edit: June 30, 2015, 11:20:24 pm by Dr.Theopolis »

Odacir

  • New Member
  • *
  • Posts: 43
Re: Run external APP on Os X
« Reply #2 on: July 01, 2015, 02:07:48 pm »
Thanks for the help Dr. Theopolis.

I other time tryed the opendocument, and really: jpg, doc, open correctly. But, PSD, PDF, nothing happen...... :-(

Have a way to register the default application on the OS X, like on windows, to solve this?

i work on mac, but i he hate........

Odacir

  • New Member
  • *
  • Posts: 43
Re: Run external APP on Os X
« Reply #3 on: July 01, 2015, 04:05:37 pm »
Problem localized!!!

Space on the path to the file.... If a folder contain a space, the command don't execute nothing.

Odacir

  • New Member
  • *
  • Posts: 43
Re: Run external APP on Os X
« Reply #4 on: July 01, 2015, 04:09:38 pm »
Solved!!!!

Using:

Code: [Select]
  OpenDialog1.Execute;
  arquivo := '''' + OpenDialog1.Filename + '''' ; 
  Opendocument(arquivo);


Thanks a lot Dr. Theopolis for the help on this.

A hug!

Igor Kokarev

  • Sr. Member
  • ****
  • Posts: 370
Re: Run external APP on Os X
« Reply #5 on: June 05, 2020, 09:34:26 am »
Hi,

Please add important info for this article:

"macOS show application bundle in foreground"

https://wiki.freepascal.org/Executing_External_Programs#macOS_show_application_bundle_in_foreground

Add a parameter -W to implement waiting.

 

TinyPortal © 2005-2018