English Amiga Board


Go Back   English Amiga Board > Support > support.Other

 
 
Thread Tools
Old 07 November 2016, 14:20   #1
Pheonix
Registered User
 
Join Date: Aug 2009
Location: Waco USA
Posts: 253
Running Workbench program from CLI (at startup.)

I have a nice little program I came across that changes the look of system request boxes. The problem I'm running into is getting it to start automatically. If I double click on the Icon from Workbench, everything is fine. The program runs, stays in the background, and does what it is supposed to do. The problem I'm facing is that if I run it from CLI (such as in User-Startup,) then the CLI window will never close. I've tried using the run command, and even putting it in a script file and doing a run execute. It all results in the CLI window staying open. The system will complete the bootup, without a problem, and I can even shrink the window down and access everything just fine. With Workbench 2+ I would just put it in the WBStartup drawer. But Workbench 1.3 doesn't have that (and it doesn't run under 2+.) Is there any way to make it run detached, or to have LoadWB run it as if it had been double clicked? I don't remember ever having to do something like this, and I'm not having much luck finding information in a search.
Pheonix is offline  
Old 07 November 2016, 14:45   #2
cyberhead97
Registered User

 
Join Date: Feb 2016
Location: Denmark
Posts: 256
It sounds like you need to use WBRun. Readme says it supports Workbench 1.3.
cyberhead97 is offline  
Old 07 November 2016, 15:36   #3
bubbob42
Registered User
 
Join Date: Oct 2012
Location: Germany
Posts: 422
Quote:
Originally Posted by Pheonix View Post
I've tried using the run command, and even putting it in a script file and doing a run execute.
Did you try just "run" or "run <>nil: yourcommand > nil:" ?
bubbob42 is offline  
Old 07 November 2016, 19:52   #4
Pheonix
Registered User
 
Join Date: Aug 2009
Location: Waco USA
Posts: 253
Quote:
Originally Posted by cyberhead97 View Post
It sounds like you need to use WBRun. Readme says it supports Workbench 1.3.
Heh.... I came here to post that answer Just found it, quite by accident, and finished testing it. Works like a champ. It turns out, I had downloaded it quite a while ago, and didn't know I had it. I'm actually using the one included with CLICon which seems to be a newer version. Though I guess it could also be older.



Quote:
Originally Posted by bubbob42 View Post
Did you try just "run" or "run <>nil: yourcommand > nil:" ?
I've actually never run a program like that. I just used "run command". I usually prefer to see the "startup" messages programs give when you run them during the startup-sequence.
Pheonix is offline  
Old 07 November 2016, 20:09   #5
Akira
Black Lives Matter

Akira's Avatar
 
Join Date: May 2001
Location: New York
Posts: 19,498
Quote:
Originally Posted by Pheonix View Post
I've actually never run a program like that. I just used "run command". I usually prefer to see the "startup" messages programs give when you run them during the startup-sequence.
Well if you don't RUN it the shell will be waiting for it to return but it never will until you close it. So your only choice is to run it. I guess WBRun basically just runs the WB app in a new shell.
Akira is offline  
Old 08 November 2016, 01:45   #6
Pheonix
Registered User
 
Join Date: Aug 2009
Location: Waco USA
Posts: 253
I'm using the run command... Exact command variations:

"run sys:system/newareq"
"run execute s:newareq.s" {one line in script: "run sys:system/newareq"}
"run execute s:newareq.s" {two lines in script: "run sys:system/newareq" & "endcli"}


All 3 in S:Startup-Sequence and in S:User-Startup. Not one variation made a difference except in the "[CLI #]" messages in the boot CLI screen. I tried putting in the re-directors (along with the .bra & .ket lines,) you suggested, but it then just asked for volume ">nil" to be inserted.
Pheonix is offline  
Old 08 November 2016, 09:55   #7
Daedalus
Registered User

Daedalus's Avatar
 
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 5,149
Was the <> form of redirection supported under 1.3? I don't remember ever using it like that before 3.0... The thing is, that redirection won't make a difference to the command working or not anyway. So does WBRun not work as you need it to?
Daedalus is offline  
Old 08 November 2016, 12:45   #8
idrougge
Registered User
 
Join Date: Sep 2007
Location: Stockholm
Posts: 4,003
Along with the .bra .ket? What .bra .ket lines?
idrougge is offline  
Old 08 November 2016, 15:06   #9
Akira
Black Lives Matter

Akira's Avatar
 
Join Date: May 2001
Location: New York
Posts: 19,498
I think redirection is supported under 1.3 but .bra and .ket isn't.
Also I just noticed this was meant to be on 1.3. As far as I know 1.3 cannot multitask in that way, so it won't work.
Akira is offline  
Old 08 November 2016, 17:42   #10
idrougge
Registered User
 
Join Date: Sep 2007
Location: Stockholm
Posts: 4,003
Why wouldn't it work?

Also, I think Daedalus is on to something about <> redirection. You probably need to write <NIL: >NIL: instead of <>NIL:
idrougge is offline  
Old 08 November 2016, 22:09   #11
Akira
Black Lives Matter

Akira's Avatar
 
Join Date: May 2001
Location: New York
Posts: 19,498
Because it isn't implemented in the same way. Go ahead and try it, I just did because I don't have much experience with 1.x. I wouldn't know of any further explanation, but we all know 1.3 was sort of multitasking and only 2.x brought proper multitasking.

I edited the Workbench 1.3 startup sequence to RUN SYS:PREFS/Preferences before Loadwb did. System "opened" a new CLI (in the same window, [CLI 2]) , then loaded Preferences but did NOT continue running the script until I closed Preferences. Either the system doesn't support multitasking in that way or the 1.3 command doesn't work in the same way as in 2.x

Redirecting to NIL: only redirects the output of the command, it has no effect on whether the script waits for the command to return or not. RUN or RUN >NIL: do the same in 2.x (open command in new process so script in the process it was executed from can keep on running)
Akira is offline  
Old 08 November 2016, 23:04   #12
Pheonix
Registered User
 
Join Date: Aug 2009
Location: Waco USA
Posts: 253
WBRun works just fine in 1.3, and it solved my problem. I thought I said that in my second post.

.bra & .ket also work in 1.3, and was needed because <> is normally used for variable insertion. .bra .ket replaces those so that the <> would be recognized as an input/output redirection instead of a variable marker. I didn't realize that the suggested run command would look at it that way until I got the error message the first time I tried to use it. I added in the the .bra .ket commands so that it would look at it the way that bubbob42 wanted it to be used instead.

However, 1.3 does not support <>nil: that way. It looked at it as input from volume ">nil" instead of the double redirection that I believe was intended. However, changing it to <nil: >nil: also didn't seem to have an effect on keeping the process separate from the CLI. WBRun does that for me now, so that I can put it in my startup sequence instead of having to manually double-click the icon every time. The only issue is that I have to have it after the loadwb command, so it can't be in my User-Startup (where I like to keep all my changes & additions if I can,) but in the main Startup-Sequence.
Pheonix is offline  
Old 09 November 2016, 00:41   #13
idrougge
Registered User
 
Join Date: Sep 2007
Location: Stockholm
Posts: 4,003
Quote:
Originally Posted by Akira View Post
Because it isn't implemented in the same way. Go ahead and try it, I just did because I don't have much experience with 1.x. I wouldn't know of any further explanation, but we all know 1.3 was sort of multitasking and only 2.x brought proper multitasking.
I don't know what you intend by multitasking, but 1.3 is just as multitasking as 2.0.
idrougge is offline  
Old 09 November 2016, 16:56   #14
Daedalus
Registered User

Daedalus's Avatar
 
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 5,149
Quote:
Originally Posted by Pheonix View Post
WBRun works just fine in 1.3, and it solved my problem. I thought I said that in my second post.
So you did, I thought I'd missed something else because of the other posts after that

Quote:
However, 1.3 does not support <>nil: that way. It looked at it as input from volume ">nil" instead of the double redirection that I believe was intended. However, changing it to <nil: >nil: also didn't seem to have an effect on keeping the process separate from the CLI.
Yeah, that's what I thought. And redirection won't normally have any effect on the behaviour of a command, just on what happens to its output. The command itself can't tell that it's been redirected to NIL:

Quote:
WBRun does that for me now, so that I can put it in my startup sequence instead of having to manually double-click the icon every time. The only issue is that I have to have it after the loadwb command, so it can't be in my User-Startup (where I like to keep all my changes & additions if I can,) but in the main Startup-Sequence.
You could also implement your very own WBStartup script - add an Execute S:WBStartup to your Startup-sequence after LoadWB and then keep all your post-WBStartup modifications in that script instead. You could even cobble together some sort of script that approximates the WBStartup drawer behaviour of later Workbenches...
Daedalus is offline  
Old 09 November 2016, 17:06   #15
Daedalus
Registered User

Daedalus's Avatar
 
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 5,149
Quote:
Originally Posted by idrougge View Post
I don't know what you intend by multitasking, but 1.3 is just as multitasking as 2.0.
Yep, true. Perhaps it's a limitation of the old Shell that 1.x uses before NEWCON: is mounted. The default ROM-based CLI in 1.x is pretty limited from memory, so you need to mount NEWCON: to make the updated shell available.
Daedalus is offline  
Old 09 November 2016, 23:32   #16
Pheonix
Registered User
 
Join Date: Aug 2009
Location: Waco USA
Posts: 253
Quote:
Originally Posted by Daedalus View Post
You could also implement your very own WBStartup script - add an Execute S:WBStartup to your Startup-sequence after LoadWB and then keep all your post-WBStartup modifications in that script instead. You could even cobble together some sort of script that approximates the WBStartup drawer behaviour of later Workbenches...
That is actually something I haven't thought of Going to have to look into that. Would make things like this a lot easier.

Basically, I would need to WBRun every icon in the drawer. Easy to build a list of them, but passing them, one at a time, to WBRun could be problematical. I haven't build complex scripts like that on the Amiga before, will have to do some research.
Pheonix is offline  
Old 10 November 2016, 01:08   #17
idrougge
Registered User
 
Join Date: Sep 2007
Location: Stockholm
Posts: 4,003
It's easy with List LFORMAT, assuming that is supported in 1.3.
idrougge is offline  
Old 10 November 2016, 03:17   #18
Pheonix
Registered User
 
Join Date: Aug 2009
Location: Waco USA
Posts: 253
Yes, List will get me a list of all the Icon files. The issue comes with setting it up so that I can do a WBRun on each one individually. That takes a little bit of advanced scripting. If I was just running them, I would just create the list and treat it as a script file (which is what WB 2+ does with the Monitors directory.) However, I need to append "WBRun " at the beginning of each line before running it as a script. I'm not exceptionally familiar with Amiga OS scripting language. All I've rally done (language wise,) so far is basic if else type functions. Have also set up lab & skip activities as well. So, that's what I'm going to have to study, to see if it can be done.
Pheonix is offline  
Old 10 November 2016, 04:53   #19
Pheonix
Registered User
 
Join Date: Aug 2009
Location: Waco USA
Posts: 253
OK, it won't let me edit my post for some reason...

lformat looked like it would work after all. But it won't let me strip the .info off of each line. WBLoad is designed to load an icon, and then execute that icon as if it had been double clicked. However, it adds the .info itself, so I need to create the list without the .info, but only for .info files.

I tried switching to WBRun instead, but the parm.library is giving me fits. I found the parm.library (eventually,) on a fred fish disk, but even with it in my libs: directory (and after a reboot as well,) it still throws up a parm.library v1+ required message when I try to use it.
Pheonix is offline  
Old 10 November 2016, 10:17   #20
idrougge
Registered User
 
Join Date: Sep 2007
Location: Stockholm
Posts: 4,003
Try if this works in 1.3:
Code:
List LFORMAT "WBRun %M" #?.info
idrougge 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
How to make an Workbench Icon running a CLI Script ? Marskilla support.Other 9 26 April 2016 23:11
External windows program communicating with program running inside WinUAE xxxxx support.WinUAE 10 19 February 2013 09:27
Possible to run a program from CLI in background? VoltureX support.Apps 17 14 January 2012 03:16
CLI program to resturn joy direction or fire button. olesio request.Apps 26 04 November 2011 18:18
CLI program to make mouse pointer dissapear on KS 3.X Gaula92 request.Apps 5 21 October 2011 14:49

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 11:37.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, vBulletin Solutions Inc.
Page generated in 0.09505 seconds with 14 queries