Opening windows on Frontmost screen (partial solution found)

A forum for general AmigaOS 4.x support questions that are not platform-specific
Post Reply
mpiva
Posts: 35
Joined: Sun Jul 03, 2011 10:05 pm

Opening windows on Frontmost screen (partial solution found)

Post by mpiva »

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.

User avatar
PowerPC
Posts: 3
Joined: Sun Jun 19, 2011 9:45 pm

Re: Opening windows on Frontmost screen

Post by PowerPC »

I think this should be possible, because Amidock has an option to do so.
Regards,

Image
_____________________________________________
My SAM440ep-flex (click)

afxgroup
Beta Tester
Beta Tester
Posts: 17
Joined: Sun Jun 19, 2011 1:15 pm

Re: Opening windows on Frontmost screen

Post by afxgroup »

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?

mpiva
Posts: 35
Joined: Sun Jul 03, 2011 10:05 pm

Re: Opening windows on Frontmost screen

Post by mpiva »

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).

User avatar
tonyw
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 1433
Joined: Wed Mar 09, 2011 1:36 pm
Location: Sydney, Australia

Re: Opening windows on Frontmost screen

Post by tonyw »

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.
cheers
tony

mpiva
Posts: 35
Joined: Sun Jul 03, 2011 10:05 pm

Re: Opening windows on Frontmost screen

Post by mpiva »

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.
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")

:?: 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.

User avatar
tingo
Beta Tester
Beta Tester
Posts: 191
Joined: Mon Dec 20, 2010 1:52 pm
Location: Oslo, Norway

Re: Opening windows on Frontmost screen

Post by tingo »

Not that I have AmigaOS 4.x; but doesn't ARexx already have a library / functions for handling public screens?
Torfinn

mpiva
Posts: 35
Joined: Sun Jul 03, 2011 10:05 pm

Re: Opening windows on Frontmost screen

Post by mpiva »

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.

User avatar
nbache
Beta Tester
Beta Tester
Posts: 1463
Joined: Mon Dec 20, 2010 7:25 pm
Location: Copenhagen, Denmark
Contact:

Re: Opening windows on Frontmost screen

Post by nbache »

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.
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

mpiva
Posts: 35
Joined: Sun Jul 03, 2011 10:05 pm

Re: Opening windows on Frontmost screen

Post by mpiva »

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
AWESOME! :D 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.

Post Reply