Mac Help Forums


Reply
Thread Tools Display Modes

Having Automator close a program if it opened it

 
New Member
Join Date: Aug 2011
Posts: 2
 
      26th August 2011
Hey all, I'm having some trouble figuring out a way to complete a simple series of events in Automator.

I used the 'Print Finder Items' command to create a nice desktop shortcut to drag and drop any files I need printed. However, the app will launch whatever program the file is associated with and leave it open. I'm can't find a way to get Automator to close the program if it was opened specifically by Automator itself, but leave it open if the program was already running prior to Automator's involvement.

Just in case I'm not explaining it well:

Preview is open. I drag a PDF to my Automator created app and it prints, leaving Preview open because Automator didn't need to open it.

Preview is not open. I drag a PDF to my Automator created app and it prints, then closes Preview because Automator needed to launch the application in order to print.

Is this possible to do?
 
Reply With Quote
 
 
 
 
Senior Member
Kaveman's Avatar
Join Date: Nov 2010
Location: Westland, NZ
Posts: 1,355
 
      26th August 2011
Not from Automator but you might get some joy from AppleScript.

tell application "System Events" to set holdPreviewRunning to (name of processes) contains "Preview"
 
Reply With Quote
 
New Member
Join Date: Aug 2011
Posts: 2
 
      29th August 2011
(sorry for the long delay in reply)

I just saw this as I'm about to leave work, so I won't get around to trying it until tomorrow. But what about when Automator opens another program, say Word or Excel? Would it be a simple matter of substituting "Preview" for another program name?
 
Reply With Quote
 
Senior Member
Kaveman's Avatar
Join Date: Nov 2010
Location: Westland, NZ
Posts: 1,355
 
      29th August 2011
Yes, but you may have to experiment a little, as there is no guaranty just what the Text for each App will be.
 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Prompt on Close of Program or Shutdown? RichGags Automator 1 12th June 2011 11:17 PM
Does Snow Leopard have Last Opened? Pd UK Macs 3 22nd October 2009 04:20 AM
First miniMac opened... Hugh Browton UK Macs 0 3rd August 2005 10:20 AM
iMac G5 opened S.Chang UK Macs 4 21st September 2004 07:38 PM
iMac G5 opened S.Chang UK Macs 0 21st September 2004 12:37 PM


All times are GMT +1. The time now is 01:13 PM.
Mac-Help.com is an independent website and is not affiliated with Apple Inc.


Welcome!
Welcome to the Mac Help Forums
 


Latest Threads
PDF Document
yura (1 Hour Ago, 12:13 PM)

Difficulties with internet speed (nothing to do with connection)
sammethh (6 Hours Ago, 06:36 AM)

Deleting a homepage/website form my mac book pro
rgandajg (14 Hours Ago, 10:30 PM)

MacBook
basil422 (19 Hours Ago, 06:01 PM)

Outlook reminders not popping up
WonderBot (20 Hours Ago, 05:03 PM)

 


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51