Iconifying a console window

A forum for general AmigaOS 4.x support questions that are not platform-specific
redfox
Posts: 27
Joined: Wed Nov 09, 2011 2:29 am

Iconifying a console window

Post by redfox »

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
User avatar
tonyw
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 1479
Joined: Wed Mar 09, 2011 1:36 pm
Location: Sydney, Australia

Re: Iconifying a console window

Post by tonyw »

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
nbache
Beta Tester
Beta Tester
Posts: 1714
Joined: Mon Dec 20, 2010 7:25 pm
Location: Copenhagen, Denmark
Contact:

Re: Iconifying a console window

Post by nbache »

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
redfox
Posts: 27
Joined: Wed Nov 09, 2011 2:29 am

Re: Iconifying a console window

Post by redfox »

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
xenic
Posts: 1185
Joined: Sun Jun 19, 2011 12:06 am

Re: Iconifying a console window

Post by xenic »

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
User avatar
nbache
Beta Tester
Beta Tester
Posts: 1714
Joined: Mon Dec 20, 2010 7:25 pm
Location: Copenhagen, Denmark
Contact:

Re: Iconifying a console window

Post by nbache »

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
tonyw
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 1479
Joined: Wed Mar 09, 2011 1:36 pm
Location: Sydney, Australia

Re: Iconifying a console window

Post by tonyw »

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
redfox
Posts: 27
Joined: Wed Nov 09, 2011 2:29 am

Re: Iconifying a console window

Post by redfox »

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:
Minuous
Posts: 19
Joined: Mon Dec 21, 2015 10:36 am

Re: Iconifying a console window

Post by Minuous »

So is there a good reason it looks in ENVARC: rather than ENV: ? Seems contrary to the Style Guide.
xenic
Posts: 1185
Joined: Sun Jun 19, 2011 12:06 am

Re: Iconifying a console window

Post by xenic »

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
Post Reply