Opening windows on Frontmost screen (partial solution found)
Opening windows on Frontmost screen (partial solution found)
Is there a way to tell a program to open its window on the frontmost public screen? I have AllKeys linking my Calculator button on my multimedia keyboard to the Calculator program. I'd love it if I could push that button and have the Calculator pop-up on whatever screen I happen to be working on, rather than always having to flip back to the Workbench screen.
Last edited by mpiva on Fri Jul 15, 2011 7:35 pm, edited 1 time in total.
Re: Opening windows on Frontmost screen
I think this should be possible, because Amidock has an option to do so.
Re: Opening windows on Frontmost screen
Yes it is possible, but are you asking how to do this with your code or how to "force" a window to be pushed on frontmost screen?
Re: Opening windows on Frontmost screen
No, I'm not coding my own calculator, I mean the actual OS4 Calculator program. I know there is a "PUBSCREEN" tooltype. What I was hoping was that there was a special keyword so I could put in something like "PUBSCREEN=FRONTMOST" and have the Calculator open on the frontmost public screen (and I was really hoping that the keyword would work for any program that has the PUBSCREEN tooltype).
- tonyw
- AmigaOS Core Developer
- Posts: 1479
- Joined: Wed Mar 09, 2011 1:36 pm
- Location: Sydney, Australia
Re: Opening windows on Frontmost screen
I don't know whether this would work, but it's worth a try. It certainly works in some other applications.
PubScreen=**
Note there are TWO asterisks, DOS absorbs the first one.
Good luck.
PubScreen=**
Note there are TWO asterisks, DOS absorbs the first one.
Good luck.
cheers
tony
tony
Re: Opening windows on Frontmost screen
Thanks for the suggestion but, sadly, it doesn't work. In fact, it stops Calculator from loading at all (on that note, there should really be an error message telling the user why the program didn't load; something like: "Unable to find requested Public Screen")tonyw wrote:I don't know whether this would work, but it's worth a try. It certainly works in some other applications.
PubScreen=**
Note there are TWO asterisks, DOS absorbs the first one.
Good luck.
Any chance of requesting the OS4 developers to add a variable like $Frontmost to the OS that refers to the Frontmost screen? And I'm not just talking about in Calculator, I mean the entire OS. This would be extremely useful as you could put it in tooltypes or shell scripts.
Re: Opening windows on Frontmost screen
Not that I have AmigaOS 4.x; but doesn't ARexx already have a library / functions for handling public screens?
Torfinn
Re: Opening windows on Frontmost screen
Well, I finally found a way to do this and thought I'd pass the info along incase anyone is interested.
I found a great little program on Aminet (http://aminet.net/util/batch/FrontPubScreen.lha) that helped.
I was really hoping I could do it all with a single command line; I thought there was a way to embed the output of one command into the options of another command, something like "SYS:Utilities/Calculator PUBSCREEN= | FrontPubScreen", but I couldn't figure out anything that worked.
In the end, I created the following script to be executed by AllKeys:
echo "SYS:Utilities/Calculator PUBSCREEN=" >T:FrontCalc NOLINE
FrontPubScreen >>T:FrontCalc
execute T:FrontCalc
delete >NIL: T:FrontCalc
It works fairly well but I still wish there was a more generic way of passing the name of the frontmost public screen to a program's CLI options or tooltypes.
I found a great little program on Aminet (http://aminet.net/util/batch/FrontPubScreen.lha) that helped.
I was really hoping I could do it all with a single command line; I thought there was a way to embed the output of one command into the options of another command, something like "SYS:Utilities/Calculator PUBSCREEN= | FrontPubScreen", but I couldn't figure out anything that worked.
In the end, I created the following script to be executed by AllKeys:
echo "SYS:Utilities/Calculator PUBSCREEN=" >T:FrontCalc NOLINE
FrontPubScreen >>T:FrontCalc
execute T:FrontCalc
delete >NIL: T:FrontCalc
It works fairly well but I still wish there was a more generic way of passing the name of the frontmost public screen to a program's CLI options or tooltypes.
- nbache
- Beta Tester
- Posts: 1716
- Joined: Mon Dec 20, 2010 7:25 pm
- Location: Copenhagen, Denmark
- Contact:
Re: Opening windows on Frontmost screen
How about using backticks, as in "SYS:Utilities/Calculator PUBSCREEN=`FrontPubScreen`"? It sounds like that would do exactly what you are trying to achieve. I'm assuming "FrontPubScreen" outputs the name of the frontmost public screen? Backticks around a command will run the command in a separate "sub-shell" and cause the backticks and the command between them to be replaced by the command's output.mpiva wrote: I was really hoping I could do it all with a single command line; I thought there was a way to embed the output of one command into the options of another command, something like "SYS:Utilities/Calculator PUBSCREEN= | FrontPubScreen", but I couldn't figure out anything that worked.
Best regards,
Niels
Re: Opening windows on Frontmost screen
AWESOME! Thanks, that's exactly what I was looking for. I knew there was a way to do that. I clearly remembered doing it in the past but, for the life of me, I couldn't remember how and it was surprisingly difficult to find that little tidbit of information in my AmigaDOS manuals.nbache wrote:How about using backticks, as in "SYS:Utilities/Calculator PUBSCREEN=`FrontPubScreen`"? It sounds like that would do exactly what you are trying to achieve. I'm assuming "FrontPubScreen" outputs the name of the frontmost public screen? Backticks around a command will run the command in a separate "sub-shell" and cause the backticks and the command between them to be replaced by the command's output.
Best regards,
Niels