softtouch 9 Posted September 2, 2022 I need to execute external programs like youtube-dl, ffmpeg etc. and also execute chmod and such on macOS. I kept searching for days and days and did not find any working example. Is there anything similar TDosCommand, but for firemonkey? Share this post Link to post
Lars Fosdal 1792 Posted September 2, 2022 https://www.fmxexpress.com/read-and-interact-with-a-command-line-pipe-in-delphi-xe7-firemonkey-on-mac-osx/ NVM: Dead link inside article 😕 Share this post Link to post
Joseph MItzen 251 Posted September 3, 2022 Delphi has always been inexplicably poor for calling external command line programs; FreePascal is actually much better at it (as is most everything else). This is the standard code every Delphi user seems to use to do what you want (because only @Remy Lebeau and @David Heffernan understand it): https://stackoverflow.com/questions/9119999/getting-output-from-a-shell-dos-app-into-a-delphi-app 1 Share this post Link to post
softtouch 9 Posted September 3, 2022 35 minutes ago, Joseph MItzen said: Delphi has always been inexplicably poor for calling external command line programs; FreePascal is actually much better at it (as is most everything else). This is the standard code every Delphi user seems to use to do what you want (because only @Remy Lebeau and @David Heffernan understand it): https://stackoverflow.com/questions/9119999/getting-output-from-a-shell-dos-app-into-a-delphi-app Thanks, but thats unfortunately for Windows only, I need something like that for macOS/Firemonkey and just cant find anything that actually works properly. Share this post Link to post
KenR 29 Posted September 3, 2022 Dues this work? https://stackoverflow.com/questions/25654425/run-a-terminal-command-with-delphi-xe7-fmx Share this post Link to post
softtouch 9 Posted September 3, 2022 4 hours ago, KenR said: Dues this work? https://stackoverflow.com/questions/25654425/run-a-terminal-command-with-delphi-xe7-fmx Unfortunately, no, that does not allow me to capture the output of the external program. Share this post Link to post
KenR 29 Posted September 3, 2022 Or this https://stackoverflow.com/questions/43020737/delphi-capture-osx-console-output Share this post Link to post
softtouch 9 Posted September 3, 2022 2 hours ago, KenR said: Or this https://stackoverflow.com/questions/43020737/delphi-capture-osx-console-output Thats the code I already tried, but it hangs sometimes and is not reliable. Share this post Link to post
mewindy 0 Posted September 4, 2022 (edited) for MACOS I use procedure TForm1.Exec(FileName: PWideChar); var Workspace: NSWorkspace; NSApp: NSApplication; Nw: NSWindow; begin if fileexists(FileName) then begin Workspace := TNSWorkspace.Create; Workspace.launchApplication(NSSTR(FileName)); Workspace.release; end; end; and in the uses: Macapi.Foundation, Macapi.ObjectiveC, Macapi.Helpers, Macapi.AppKit to execute another program or use _system(PAnsiChar(p_cmd)); to execute a command (e.g terminal command) where p_cmd is string e,g '/usr/local/bin/curl "mycommandhere" Edited September 4, 2022 by mewindy Share this post Link to post
limelect 48 Posted September 4, 2022 (edited) This is what I did with Delphi for youtube-dl, ffmpeg https://limelect.com/downloads/youtube_downloader_shell/ is this what you are trying to achieve? Myne is only window and VCL Edited September 4, 2022 by limelect Share this post Link to post
Dave Nottage 557 Posted September 4, 2022 On 9/2/2022 at 7:01 PM, softtouch said: Is there anything similar TDosCommand, but for firemonkey? I don't have any concrete examples as yet, however there is this: https://github.com/DelphiWorlds/Kastri/blob/master/Core/DW.RunProcess.Mac.pas Share this post Link to post