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
Iconifying a console window
- tonyw
- AmigaOS Core Developer
- Posts: 1479
- Joined: Wed Mar 09, 2011 1:36 pm
- Location: Sydney, Australia
Re: Iconifying a console window
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
1) ENVARC:Sys/def_shell.info
2) SYS:System/Shell.info
3) Default Project icon
cheers
tony
tony
- nbache
- Beta Tester
- Posts: 1716
- Joined: Mon Dec 20, 2010 7:25 pm
- Location: Copenhagen, Denmark
- Contact:
Re: Iconifying a console window
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
Doing it in ENVARC: is potentially a bit intrusive.
Best regards,
Niels
Re: Iconifying a console window
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
Thanks,
redfox
Re: Iconifying a console window
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.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.
AmigaOne X1000 with 2GB memory - OS4.1 FE
- nbache
- Beta Tester
- Posts: 1716
- Joined: Mon Dec 20, 2010 7:25 pm
- Location: Copenhagen, Denmark
- Contact:
Re: Iconifying a console window
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.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.
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
- tonyw
- AmigaOS Core Developer
- Posts: 1479
- Joined: Wed Mar 09, 2011 1:36 pm
- Location: Sydney, Australia
Re: Iconifying a console window
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!
All rather messy. Sorry, but there was never any call for people to use their own icons before!
cheers
tony
tony
Re: Iconifying a console window
Thanks for all your help guys. Temporary assign works like a charm.
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
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
Re: Iconifying a console window
So is there a good reason it looks in ENVARC: rather than ENV: ? Seems contrary to the Style Guide.
Re: Iconifying a console window
My guess would be this:Minuous wrote:So is there a good reason it looks in ENVARC: rather than ENV: ? Seems contrary to the Style Guide.
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