• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: [Fwd: Bring Unix Process Window to Front]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Fwd: Bring Unix Process Window to Front]


  • Subject: Re: [Fwd: Bring Unix Process Window to Front]
  • From: Craig Williams <email@hidden>
  • Date: Sat, 17 Jan 2009 20:49:31 -0700


On Jan 17, 2009, at 8:23 PM, Mark wrote:


How can I bring the GnuCash window to the front upon launch? "Tell application "gnucash-bin" to activate" doesn't seem to work. I don't even know how to simulate pressing cmd-shift-tab, which I would live with. TIA for helping a rank beginner.

See if this works.

-- Get the pid using $!
-- Then bring it to the front like this.
tell application "System Events" to set frontmost of (every process whose unix id is pid_number) to true

-Craig

I'm embarrassed to say I don't know the syntax for getting the pid using $!. Hint?

- Mark


Sorry about that.

The $! captures the PID of the last process executed in that specific shell.

In a Terminal window you can do this:

#!/usr/bin/env bash

/path/to/executable/ &> /dev/null &
PID=$!
echo $PID

From AppleScript

There is an actual return after '&> /dev/null &' that way we are executing two commands
one after the other.

set theCommand to "/path/to/executable/  &> /dev/null &
echo $!"
set thePID to do shell script theCommand

hth,

Craig
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

References: 
 >Re: [Fwd: Bring Unix Process Window to Front] (From: Craig Williams <email@hidden>)
 >Re: [Fwd: Bring Unix Process Window to Front] (From: Mark <email@hidden>)

  • Prev by Date: Re: [Fwd: Bring Unix Process Window to Front]
  • Next by Date: scripting Entourage shared calendar
  • Previous by thread: Re: [Fwd: Bring Unix Process Window to Front]
  • Next by thread: scripting Entourage shared calendar
  • Index(es):
    • Date
    • Thread