Re: Moving an application to the foreground
- From: Arnaud Nicolet <arnau@xxxxxxxx>
- Date: Tue, 10 Jan 2006 22:37:30 +0100
Arnaud Nicolet wrote:
Jonathan Hoyle wrote:
I have a REALbasic 5.5.5 application which kicks off a support application using the Launch() method from the FolderItem class. The problem is, I want my REAlbasic application to remain in the foreground, yet after I launch the support app, the support app moves to the forefront. (This is true even when I pass "false" into the Launch() method.)
I thought that perhaps a work-around would be to somehow force the main application back into the foreground subsequent to the support app's launching. Unfortuntaely, i do not see a way to do this in REALbasic. Is there perhaps an AppleTalk command that would do this for me? How would I execute it in REAlbasic?
My answer is for Mac:
The simplest way would be to make it as an AppleScript:
OSX script:
On run {AppName,MyAppName} --AppName is the name of your application which must remain in the background, while MyAppName is the name of your application (since I do not know if "tell current application" works in an RB-AppleScript environment)
tell application "System Events"
repeat
set p to every process whose name contains "Finder"
if (count items of p) > 0 then exit repeat
end repeat
end tell
--Now, we know that the app AppName has been launched
tell application "QuickTime Player" to activate
End Run
For OS9, replace the "System Events" application by the "Finder" (since it's the "Finder" which handled processes for Mac OS9; for MacOS X, the "Finder" also handles process, but it's in the Legacy suite).
If you don't want to rely on AppleScript, use declares (or the MBS plugin) to do the equivalent.
Oops, sorry. The script I posted was the one I used to test. Here's the right one:
On run {AppName,MyAppName} --AppName is the name of your application
which must remain in the background, while MyAppName is the name of your
application (since I do not know if "tell current application" works in
an RB-AppleScript environment)tell application "System Events"
repeat
set p to every process whose name contains AppName
if (count items of p) > 0 then exit repeat
end repeat
end tell
--Now, we know that the app AppName has been launched
tell application MyAppName to activate
End RunI apologize. .
- References:
- Moving an application to the foreground
- From: Jonathan Hoyle
- Re: Moving an application to the foreground
- From: Arnaud Nicolet
- Moving an application to the foreground
- Prev by Date: Re: Moving an application to the foreground
- Next by Date: Re: Refresh window
- Previous by thread: Re: Moving an application to the foreground
- Index(es):
Relevant Pages
|