From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,DIET_1, FORGED_GMAIL_RCVD,FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail From: =?UTF-8?Q?Bj=c3=b6rn_Lundin?= Newsgroups: comp.lang.ada Subject: Re: How to run a GNAT program without starting a terminal session Date: Thu, 19 Jul 2018 09:20:56 +0200 Organization: A noiseless patient Spider Message-ID: References: <8771f075-4142-45ef-b636-80d407fedd7f@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Date: Thu, 19 Jul 2018 07:20:55 -0000 (UTC) Injection-Info: h2725194.stratoserver.net; posting-host="2f3c3fe4f00f3b207b6bfdf061030a2b"; logging-data="29930"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/Akh6fdRpQTo05PgC1vnqV" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 Cancel-Lock: sha1:kn3w8M3xVmHTBAvEC8vjmVmozMs= In-Reply-To: <8771f075-4142-45ef-b636-80d407fedd7f@googlegroups.com> Xref: reader02.eternal-september.org comp.lang.ada:53907 Date: 2018-07-19T09:20:56+02:00 List-Id: On 2018-07-19 04:57, Jerry wrote: > On Monday, July 16, 2018 at 6:20:50 PM UTC-7, Jerry wrote: >> How can I get Ada (GNAT) to run a program that has no text I/O without launching a terminal session? Specifically, on macOS, I have the following program. When I double-click it, it runs but first it opens Terminal.app and starts a session. I played with calling it from Applescript but without success. Can I make a bash file that doesn't start a terminal session? >> >> >> with Ada.Calendar; use Ada.Calendar; >> with Common; -- Contains "Beep". >> >> procedure Run is >> begin >> Delay 4.0; >> Common.Beep(1); >> end Run; >> >> >> Jerry > > It looks like there is no easy answer to the original question, how to run a GNAT program without a terminal, but here is a solution to my immediate problem with some do-dads added. Sorry, it's not Ada. It's Applescript. The Applescript compiler bundles this up nicely as a double-clickable application bundle and does what I want. (The dialog box at the end is a little gratuitous.) afplay plays any audio file. > > > delay 30 > do shell script "afplay '/System/Library/Sounds/Frog.aiff'" > delay 15 > do shell script "afplay '/System/Library/Sounds/Ping.aiff'" > delay 13 > beep > delay 1 > beep > delay 1 > beep > say "Stop running Jerry" volume 0.5 > display dialog "Stop running!" buttons {"OK"} default button 1 > > > What is this piece of silliness? For some time I have taken seriously the claim that sitting for long periods of time is unhealthy, and consequently I set my computer to announce the time every half hour at which time I am *supposed* to get up and run in place for one minute. I believe that this is a simple version of interval training and can actually cause me to lose a little weight. The problem is that I have to watch an analog on-screen clock to see when to stop and this does not always have a background that makes the clock easy to see, plus I have to stick next to the computer. Using a utility, I launch this program with a simple key combination. > > Jerry > Ah. Applescript is kind of fun. Until you want to do some advance stuff. I used to script apple iTunes and iPhote with a python binding to applescript. worked better than I thoufht. Anyway, your usercase does sound like you want a daemon. make it start at boot, and then run forever. That is what launchctrl is about. But the applescript soulution may be simpler, except for you need to start it by yourdelf each time. -- -- Björn