English Amiga Board


Go Back   English Amiga Board > Coders > Coders. System > Coders. Scripting

 
 
Thread Tools
Old 31 October 2021, 15:13   #1
Tolgod
Registered User
 
Tolgod's Avatar
 
Join Date: Apr 2019
Location: Heerlen / The Netherlands
Posts: 52
Monitor program so it's status can be a variable for script

Hi there. I've been busy lately to learn more about scripting to make my life as an Amigan/Vampirian easier and have lots of fun doing that along the way.
Currently I'm busy with something that would require me to startup a program via script using wbrun.
This program is dependant on something else, which I startup earlier in the script.
No what I want my script to do is monitor the status of the program I started using WBrun periodically. If it is still running the script waits and then LAB's back to monitor/check again, when the program is no longer running, the script continues and closes down whatever was started that the main program was dependant on.

Is this possible to script?
Preferably the arguments are generic, meaning that I always will know what name the proces will have to monitor.

ie

check status <name of program started / name of proces started by program)

If running a program leads to dynamic assiging of attributes that could be monitored, I would like to see if it could be steered in a fairly fail proof manner.

ie

wbrun program as <controllablevariable> (here some proces number or other parameter would be used that is extremely unlikely to allready be in use.

If this would also not be possible, I would like to see if a wild card manner of checking status is possible.
This would lead to the logic : If a proces containing <unique identifier for started program> is running do this, else do that.

I hope I have been able to bring across what I want in a understandable manner and look forward to finding out what is possible here and what not.

Tnx in advance for any assistance.
Tolgod is offline  
Old 31 October 2021, 16:34   #2
daxb
Registered User
 
Join Date: Oct 2009
Location: Germany
Posts: 3,304
If I understand you right you want something like interprocess communication. As far as I know AmigaDOS has not something like this. With ARexx you could use message ports or maybe SETCLIP()/RXSET and GETCLIP().
daxb is offline  
Old 31 October 2021, 18:02   #3
Tolgod
Registered User
 
Tolgod's Avatar
 
Join Date: Apr 2019
Location: Heerlen / The Netherlands
Posts: 52
Hi there. I think indeed you understand what I want. To put the mechanics into words I'll illustrate as follows.
Script :
Startup whatever program need
Startup program
Label 1
Check program status
If program is running
Wait 1
Skip to label 1
Else
Stop whatever program needed
Endcli

This is the working I'd like to achieve, if possible.

If this can not be scripted, what would be the easiest to get my head around to program this. Arexx has the reputation of being fairly complex from what I've read about, maybe some simple basic programming could suffice?
Tolgod is offline  
Old 01 November 2021, 12:33   #4
meynaf
son of 68k
 
meynaf's Avatar
 
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,323
Quote:
Originally Posted by Tolgod View Post
Currently I'm busy with something that would require me to startup a program via script using wbrun.
Are you 100% complete sure wbrun is the only option ?
What happens if you just run your program as normal cli program ?
meynaf is offline  
Old 01 November 2021, 12:40   #5
thomas
Registered User
 
thomas's Avatar
 
Join Date: Jan 2002
Location: Germany
Posts: 7,001
Yes, I would try

Code:
run >nil: needed_program
program
rx "address needed_program's_port quit"
thomas is offline  
Old 01 November 2021, 12:55   #6
malko
Ex nihilo nihil
 
malko's Avatar
 
Join Date: Oct 2017
Location: CH
Posts: 4,884
If you are not using ARexx, the 'status' command can help you
Code:
status COMMAND <command_name>
Will return you the process number that your command runs into.
You can assign the result to a variable and test it within your script.
If the variable is empty, it means that your command ended.
If you haven't seen it, please mind what I wrote here : https://eab.abime.net/showpost.php?p...6&postcount=20
malko is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Make blitter shift value a variable? Brick Nash Coders. Asm / Hardware 2 22 April 2021 14:31
Variable injection? solarmon support.WinUAE 12 20 January 2019 12:05
Program to monitor joystick port Brannigan support.Apps 4 29 June 2014 15:54
External windows program communicating with program running inside WinUAE xxxxx support.WinUAE 10 19 February 2013 09:27
Variable Master Clock wiltshireguyuk request.UAE Wishlist 0 13 December 2004 16:40

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 00:32.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.07770 seconds with 15 queries