357mag 2 Posted December 11 I'm considering working in Delphi for awhile, and I was looking through my books (I have four of them), and every book starts off right away with Windows programming. None of the books teaches you console programming. Personally, I like console programming. I was wondering if there is a reason all of my books starts you off that way. Perhaps because Delphi is a clean, fairly easy to grasp language? Share this post Link to post
Remy Lebeau 1435 Posted December 12 2 hours ago, 357mag said: I was wondering if there is a reason all of my books starts you off that way. Maybe because the majority of end users are not console users, and the books want you to reach a larger userbase more quickly? Just speculating... Share this post Link to post
FPiette 385 Posted December 12 Yes, you should! Console programming (Like Unix utilities) are mostly included in GUI programs... without GUI. Share this post Link to post
PeterBelow 239 Posted December 12 13 hours ago, 357mag said: I'm considering working in Delphi for awhile, and I was looking through my books (I have four of them), and every book starts off right away with Windows programming. None of the books teaches you console programming. Personally, I like console programming. I was wondering if there is a reason all of my books starts you off that way. Perhaps because Delphi is a clean, fairly easy to grasp language? GUIs are just the majority of the applications build with Delphi. But you can easily build console programs with it, too. The File -> New dialog also offers a template for that. Share this post Link to post
Die Holländer 49 Posted December 12 Console programming is easy with Delphi. The books will learn you the Delphi (Pascal) syntax and that is one of the most easy to learn of all the programming languages. 14 hours ago, 357mag said: None of the books teaches you console programming. That was dummzeuch's conclusion already 10 years ago: twm's blog Important : Console with parameters (With a Gui example..) Share this post Link to post
David Schwartz 429 Posted Wednesday at 11:24 PM If you prefer working from the command line, why not just use something that's oriented that way? I mean, you don't need a language as complex as Pascal to write simple scripts. Try playing with bash or sh or ksh or some other shell scripting language. The thing you're missing in just focusing on the command-line is not the GUI, but the entire Event-Driven ecology. That's what really sets Delphi apart from even simple Pascal. if you don't want to mess with a UI, then consider playing around with back-end services using one of the many REST frameworks that are available for that. Nobody gives two craps about Pascal today. Delphi is still alive and kicking because of the VCL, which is mainly an EVENT-DRIVEN FRAMEWORK. That's how it SUPPORTS such a rich and complex GUI environment. The basic Pascal language and RTL is available to command-line apps, but nothing from the VCL or FMX frameworks are, even though that's where 99% of the VALUE lies. Share this post Link to post
Rollo62 539 Posted Thursday at 07:27 AM Scripts are perhaps not powerful enough or too clumsy to use them easily. Maybe DosCommand is a bridge between both worlds, that works for you and can bring the best of both worlds close together. https://github.com/TurboPack/DOSCommand/blob/master/Demo/Unit4.pas Share this post Link to post
Die Holländer 49 Posted Thursday at 08:30 AM I view console applications not just as user (prompt) programs, but also as tools for performing tasks that just don’t require a GUI. We have numerous console applications that are often started by a task scheduler or installed as services. These programs are hard to write with scripts alone, which is why we use Delphi and its tools and libraries. (such as FireDac, sFTP and the mORMot HTTPs web server). These applications handle all the automated processes and tasks essential for our company. All the code can of course used in other projects for GUI or console applications. Share this post Link to post
David Marcus 1 Posted Saturday at 09:15 PM Delphi is perfectly happy to create a console app (I have lots that I've written). In fact, if you have a Delphi GUI app, you can just change the dpr to say {$AppType console} and now your "GUI" app can use writeln; handy for debugging (if you have bugs). Share this post Link to post
Remy Lebeau 1435 Posted Sunday at 12:31 AM (edited) 3 hours ago, David Marcus said: In fact, if you have a Delphi GUI app, you can just change the dpr to say {$AppType console} and now your "GUI" app can use writeln; handy for debugging (if you have bugs). You don't need to change the AppType to use WriteLn(). A GUI app can simply call AllocConsole() or AttachConsole() and then WriteLn() will automatically work. That being said, another way to debug would be to use OutputDebugString() instead, and then you can see the messages in the IDE's debugger, or in SysInternals DebugView when running outside of the debugger. Edited Sunday at 12:32 AM by Remy Lebeau Share this post Link to post