English Amiga Board

English Amiga Board (https://eab.abime.net/index.php)
-   Coders. System (https://eab.abime.net/forumdisplay.php?f=113)
-   -   Can this application be a Commodity? (https://eab.abime.net/showthread.php?t=109209)

mateusz_s 18 December 2021 23:05

Can this application be a Commodity?
 
Hello,
So I made a very simple Cron like application
that executes any command or script in some time intervals.

I am using it to execute a script that pings my network and setup
ENV variable Online/Offline. That Way and using AmigaOS3.2 I can
have my Internet status updated on my WB menu bar.

The mentioned Cron-like application just runs at system startup
with parameters.

So my question is...
Is that type of application can be rewritten as commodity?
I read that commodities are apps that only takes some input
and then do something with it.

I wanten my Cron-like application to be more "human-friendly"
so it could be controled by Exchange to turn on/off/kill etc..

In my Cron-like app I am just using Delay(time) to get into non-busy "loop"
nad wait to execute command

Thanks in Advance!

bwldrbst 19 December 2021 01:29

You can certainly make it a commodity just so that Exchange can control it. You don't need to register extra key presses. Docs for commodities.library.

Commodities are usually run from WBStartup so you might want to look at using tooltypes or a config file rather than command line parameters.

Rather than using Delay you probably also want to have a look at timer.device for scheduling actions. By using timer.device your main loop becomes a Wait() followed by checking for signals from either the commodity port or the timer. Using Delay means a message might come from Exchange while your program is sleeping and cause problems for the rest of the system.

mateusz_s 19 December 2021 01:54

Quote:

Originally Posted by bwldrbst (Post 1522512)
You can certainly make it a commodity just so that Exchange can control it. You don't need to register extra key presses. Docs for commodities.library.

Commodities are usually run from WBStartup so you might want to look at using tooltypes or a config file rather than command line parameters.

Rather than using Delay you probably also want to have a look at timer.device for scheduling actions. By using timer.device your main loop becomes a Wait() followed by checking for signals from either the commodity port or the timer. Using Delay means a message might come from Exchange while your program is sleeping and cause problems for the rest of the system.

Hi, thanks for help! :great


All times are GMT +2. The time now is 20:36.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.

Page generated in 0.04243 seconds with 11 queries