Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Mar 17, 2007, 07:37 AM   #1
blueskyredkite
macrumors member
 
Join Date: Nov 2004
Location: By the sea.
Applescript window focus

I've a task in automator that enables me to select files in finder, call the automator tast (it's on my Script menu) and add Spotlight tags to those selected items. It's built thusly:
Get selected Finder items.
Add Spotlight Comments to Finder Items.

The problem with this, though, is that when it's completed it doesn't return focust to the original Finder window, Finder is still focused but not any window. I can find no Automator action that will change focus so I investigated AppleScript.

I've never used AppleScript before, I'm quite new to Macs, I've done absolute minimal C and am conversant with Perl (though I'm no guru). I've Googled developer.apple.com and I found links to Tk stuff... seen that under Linux in the past so not sure what it's doing here, though TK is an abrev. for ToolKit, I dunno. Anyway, I've not been able to find what I was looking for there or elsewhere. What I want is something that selects the previous window.

I thank you for any suggestions.
__________________
Justin C, by the sea.
blueskyredkite is offline   0 Reply With Quote
Old Mar 17, 2007, 11:04 AM   #2
lancestraz
macrumors 6502a
 
lancestraz's Avatar
 
Join Date: Nov 2005
Location: RI
Try adding an AppleScript action at the end of your workflow that says:
Code:
tell application "Finder" to activate
lancestraz is offline   0 Reply With Quote
Old Mar 17, 2007, 03:23 PM   #3
blueskyredkite
Thread Starter
macrumors member
 
Join Date: Nov 2004
Location: By the sea.
Quote:
Originally Posted by lancestraz View Post
Try adding an AppleScript action at the end of your workflow that says:
Code:
tell application "Finder" to activate
Bingo! That's exactly what I needed. Thank you.
__________________
Justin C, by the sea.
blueskyredkite is offline   0 Reply With Quote
Old Feb 28, 2013, 05:53 AM   #4
skulpture
macrumors newbie
 
Join Date: Feb 2008
I know this a really really old thread but I have been using the above script to focus on an application.

However the software I am using has two windows; its for an instillation piece; the mac mini autostarts up and the software opens, this then launches a full screen video window. 90% of the time it goes full screen and its all fine. But just now and again the application window sits on top of the full screen video window.

Using Mountain Lion and the Accessibility Inspector I can see that the Full Screen Window (the one I want to be at the front) is called AXTitle: "testCTM.izz Stage 1"

testCTM.izz is the file name and extension and Stage 1 is the window in question.

So... how can I focus on just that window?

Hope that makes sense! Thanks!
skulpture is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

Forum Jump

Similar Threads
thread Thread Starter Forum Replies Last Post
AppleScript to mount Windows shares dwright1974 Mac Programming 3 May 1, 2011 05:36 PM
iTunes Resize Error AppleScript Konki Mac Applications and Mac App Store 1 Nov 21, 2010 12:47 PM
Strange window focus problem Ankit S. OS X 5 Sep 10, 2007 05:13 AM
Question about window focus and clicking.. ohcrap OS X 9 Oct 4, 2005 03:20 PM


All times are GMT -5. The time now is 02:12 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC