Iconifying a console window

A forum for general AmigaOS 4.x support questions that are not platform-specific

Iconifying a console window

Postby redfox » Sat Mar 09, 2019 5:39 am

Many of my ARexx scripts open console windows to ask for input or display output as the program progresses.
Some of my scripts use the CON: console and some use KCON: (KingCON). The new console with OS4.1 FE has
most of the features I liked about KingCON, such as vertical scroll bar and scroll buttons.

One nice feature of KingCON is that I can choose my own icon to be displayed when I iconify the console window.
I can choose a different icon for each window I open. For example, I use an icon that looks like an mail envelope for my listmailbox window script to list my emails.

call open(listmailconsole,"KCON:0/50//350/Listmailbox/IMAGEemail/NOMENUS/CLOSE")

By default, the icon image is located in envarc:sys. The IMAGE option specifies a file called email.info.

I was wondering if this feature was available for the console provided with OS4.1 FE.

---
redfox
redfox
 
Posts: 24
Joined: Wed Nov 09, 2011 3:29 am

Re: Iconifying a console window

Postby tonyw » Sat Mar 09, 2019 1:10 pm

There is no way to specify your own icon to be used when iconifying a console window. However, the console looks in these three places for an icon to use. Perhaps you could overwrite one of these. The console seizes on the first icon it finds, so the one in ENVARC: is checked first:

1) ENVARC:Sys/def_shell.info
2) SYS:System/Shell.info
3) Default Project icon
cheers
tony
User avatar
tonyw
AmigaOS Core Developer
AmigaOS Core Developer
 
Posts: 1366
Joined: Wed Mar 09, 2011 2:36 pm
Location: Sydney, Australia

Re: Iconifying a console window

Postby nbache » Sat Mar 09, 2019 2:06 pm

Hmm ... if the first one had been ENV: instead of ENVARC:, it would be possible (disregarding concurrency, but otherwise) to let your script overwrite the icon just before opening the console, and resetting it from ENVARC: (or elsewhere) afterwards.

Doing it in ENVARC: is potentially a bit intrusive.

Best regards,

Niels
User avatar
nbache
Beta Tester
Beta Tester
 
Posts: 1365
Joined: Mon Dec 20, 2010 8:25 pm
Location: Copenhagen, Denmark

Re: Iconifying a console window

Postby redfox » Sun Mar 10, 2019 1:01 am

Thanks for the replies. I agree it would be a bit tricky to change the icon in ENVARC: each time I launch my program (and go back and reset the icon when done). I don't want to upset any "global" variables used by the Shell console or any system programs.

Thanks,
redfox
redfox
 
Posts: 24
Joined: Wed Nov 09, 2011 3:29 am

Re: Iconifying a console window

Postby xenic » Sun Mar 10, 2019 6:57 pm

redfox wrote:Thanks for the replies. I agree it would be a bit tricky to change the icon in ENVARC: each time I launch my program (and go back and reset the icon when done). I don't want to upset any "global" variables used by the Shell console or any system programs.

There is another possibility. ENVARC: is an assignable directory. You could create the directory and sub "myenv/sys" in RAM: and put your "def_shell.info" in the "RAM:myenv/sys" directory. Then before your open your console assign ENVARC: to "RAM:myenv/sys". Open your console and assign ENVARC: back to "SYS:Prefs/Env-Archive". I tried it with a DOS script and it worked. I'm haven't tested it from a program.
AmigaOne X1000 with 2GB memory - OS4.1 FE
xenic
 
Posts: 1159
Joined: Sun Jun 19, 2011 1:06 am

Re: Iconifying a console window

Postby nbache » Sun Mar 10, 2019 7:31 pm

xenic wrote:There is another possibility. ENVARC: is an assignable directory. You could create the directory and sub "myenv/sys" in RAM: and put your "def_shell.info" in the "RAM:myenv/sys" directory. Then before your open your console assign ENVARC: to "RAM:myenv/sys". Open your console and assign ENVARC: back to "SYS:Prefs/Env-Archive". I tried it with a DOS script and it worked. I'm haven't tested it from a program.
Interesting idea. You'd have to find out when the icon file is actually read - at Shell startup or when you iconify it? I haven't checked.

An alternative could be to use Assign ADD. You should first assign ENVARC: to the RAM: path, then Assign ADD the normal one (SYS:Prefs/EnvArc), this will make the system search in the temporary path first and find your custom icon. After using it, you'd do another Assign, this time only to the regular path.

It's still a bit of a kludge, because every other process needing ENVARC: will also search you temporary dir first, until you assign it back.

Best regards,

Niels
User avatar
nbache
Beta Tester
Beta Tester
 
Posts: 1365
Joined: Mon Dec 20, 2010 8:25 pm
Location: Copenhagen, Denmark

Re: Iconifying a console window

Postby tonyw » Mon Mar 11, 2019 1:01 am

If it helps, the icon is sought when the console is opening its (first) window. You could open a temp console first, perform the above kludge, open the second *actual* window you are going to use, then close the original temp window.

All rather messy. Sorry, but there was never any call for people to use their own icons before!
cheers
tony
User avatar
tonyw
AmigaOS Core Developer
AmigaOS Core Developer
 
Posts: 1366
Joined: Wed Mar 09, 2011 2:36 pm
Location: Sydney, Australia

Re: Iconifying a console window

Postby redfox » Mon Mar 11, 2019 2:33 am

Thanks for all your help guys. Temporary assign works like a charm. :mrgreen:

My ARexx program assigns envarc: to ram:, opens a console window and assigns envarc: back to normal assignment.

address command 'assign envarc: ram:'

call open(console,'CON:60/50//320/AmigaMail/CLOSE')

address command 'assign ENVARC: AmigaOS4:Prefs/Env-Archive'

Thanks,
redfox :mrgreen:
redfox
 
Posts: 24
Joined: Wed Nov 09, 2011 3:29 am

Re: Iconifying a console window

Postby Minuous » Mon Mar 11, 2019 11:14 am

So is there a good reason it looks in ENVARC: rather than ENV: ? Seems contrary to the Style Guide.
Minuous
 
Posts: 3
Joined: Mon Dec 21, 2015 11:36 am

Re: Iconifying a console window

Postby xenic » Mon Mar 11, 2019 6:48 pm

Minuous wrote:So is there a good reason it looks in ENVARC: rather than ENV: ? Seems contrary to the Style Guide.


My guess would be this:

The console.device is looking in several places for 'def_shell.info' before it finds one to use. ENVARC: is a directory assignment while ENV: is a device that's not supposed to be accessed as a media device. Locking or opening a file in ENV: to see if a file is present would violate the styleguide for environmental variables.
AmigaOne X1000 with 2GB memory - OS4.1 FE
xenic
 
Posts: 1159
Joined: Sun Jun 19, 2011 1:06 am

Next

Return to General AmigaOS

Who is online

Users browsing this forum: Bing [Bot] and 1 guest