Opening windows on Frontmost screen (partial solution found)

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

Opening windows on Frontmost screen (partial solution found)

Postby mpiva » Tue Jul 05, 2011 6:58 am

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 8:35 pm, edited 1 time in total.
mpiva
 
Posts: 35
Joined: Sun Jul 03, 2011 11:05 pm

Re: Opening windows on Frontmost screen

Postby PowerPC » Tue Jul 05, 2011 8:35 am

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

Image
_____________________________________________
My SAM440ep-flex (click)
User avatar
PowerPC
 
Posts: 3
Joined: Sun Jun 19, 2011 10:45 pm

Re: Opening windows on Frontmost screen

Postby afxgroup » Tue Jul 05, 2011 12:13 pm

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?
afxgroup
Beta Tester
Beta Tester
 
Posts: 17
Joined: Sun Jun 19, 2011 2:15 pm

Re: Opening windows on Frontmost screen

Postby mpiva » Tue Jul 05, 2011 8:41 pm

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).
mpiva
 
Posts: 35
Joined: Sun Jul 03, 2011 11:05 pm

Re: Opening windows on Frontmost screen

Postby tonyw » Wed Jul 06, 2011 3:19 am

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

Re: Opening windows on Frontmost screen

Postby mpiva » Wed Jul 06, 2011 7:03 am

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.
mpiva
 
Posts: 35
Joined: Sun Jul 03, 2011 11:05 pm

Re: Opening windows on Frontmost screen

Postby tingo » Thu Jul 07, 2011 8:52 am

Not that I have AmigaOS 4.x; but doesn't ARexx already have a library / functions for handling public screens?
Torfinn
User avatar
tingo
Beta Tester
Beta Tester
 
Posts: 191
Joined: Mon Dec 20, 2010 2:52 pm
Location: Oslo, Norway

Re: Opening windows on Frontmost screen

Postby mpiva » Fri Jul 15, 2011 8:33 pm

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.
mpiva
 
Posts: 35
Joined: Sun Jul 03, 2011 11:05 pm

Re: Opening windows on Frontmost screen

Postby nbache » Fri Jul 15, 2011 10:54 pm

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

Re: Opening windows on Frontmost screen

Postby mpiva » Sat Jul 16, 2011 12:46 am

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.
mpiva
 
Posts: 35
Joined: Sun Jul 03, 2011 11:05 pm


Return to General AmigaOS

Who is online

Users browsing this forum: No registered users and 6 guests