Mac Help Forums


Reply
Thread Tools Display Modes

Switching between running applications

 
Member
Join Date: Sep 2008
Posts: 6
 
      29th September 2008
I'm a new Applescript user who is trying to accomplish what I thought was something easy: Switch from one application to the one I was using immediately previously.

For example, if I have switched from Safari to Mail, and I want to switch back to Safari again. I want an Applescript to pay attention to which application I was previously in, and, when I activate the script, switch me back to the one I was just using. If I activate it again, I want to be switched to the other application I was in, because it's now the previous application.

Is there someway to accomplish what I want to do using AppleScript? I don't have enough experience in Applescript to figure out the script necessary to accomplish the task. I've searched the net without finding a script to dowhat seems like something people would need a lot, but...

My basic thought was to get the name of the current application, save it to a variable, switch to the previous application, which was stored in a different variable, swap the two variables. But I began having issues with what the 'current application' was, as far as Applescript was concerned, and swapping.

But there also seems to be a chicken-and-egg situation developing in getting the first pass through.

Or maybe that's not the way to tackle the problems.

Can anybody help?

Thanks.

/ Peter Morgan
 
Reply With Quote
 
 
 
 
Super Moderator
Spawn_Dooley's Avatar
Join Date: Jun 2007
Location: Tassie, the  Isle
Posts: 1,108
 
      29th September 2008
Hello MorganNews and welcome to the forums

Have you tried Command + Tab to switch between open apps?
 
Reply With Quote
 
Member
Join Date: Sep 2008
Posts: 6
 
      29th September 2008
Quote:
Originally Posted by Spawn_Dooley View Post
Hello MorganNews and welcome to the forums

Have you tried Command + Tab to switch between open apps?

Hey, thanks for the welcome!

Yes, I know about that shortcut, but when you've got more nine or 10 apps running, you have to (a) scroll (b) think to yourself: "No, not that one; no, not that one; no, not that one...". And when you do it repeatedly, such as when you're copying something from one window of one app to another window of another app, it gets downright annoying.

The point, at least for me, is to flip between two apps with one keystroke, no scrolling, no mousing, no mumbling.
 
Reply With Quote
 
Super Moderator
Spawn_Dooley's Avatar
Join Date: Jun 2007
Location: Tassie, the  Isle
Posts: 1,108
 
      29th September 2008
Quote:
Originally Posted by MorganNews View Post
... when you've got more nine or 10 apps running ...
Wow! You must be a power user MorganNews

I'm not sure if an AppleScript would be easier that Command + Tab .... but it might work ... I am no expert in this field but check back later as Walrus666 is pretty deft at scripting ... see what he thinks , is my suggestion

I just thought of Expose, have you tried using that? I think it's keyboard shortcut is F9? Also if you press Command + Tab, you don't need to scroll, you can use your mouse and click an apps icon.

I just opened up 10 apps BTW, just to see what it'd be like.

There may be a modification that we can suggest to make things more productive if you tell us exactly what you usually need to do that requires fast App switching ... is it mainly copy/pasting?



.
 
Reply With Quote
 
Super Moderator
Walrus666's Avatar
Join Date: Jul 2007
Location: Chicago
Posts: 1,207
 
      29th September 2008
Hello, Not that it can't be done but I can't picture an AppleScript that would be more efficient than Expose at doing this. In Expose, make sure that one of the corners is set to "All Windows" if you haven't already and you should be in business. If you want to save one step and have no desire to use Expose, you can click on the app that you want to bring to the front by clicking its icon in the dock. The only difference is that you would have to make the selection but if you were to come up with an AppleScript that could do this automatically, you would still have to take the time to activate and, or reactivate the script.
 
Reply With Quote
 
Member
Join Date: Sep 2008
Posts: 6
 
      29th September 2008
Thanks for your comments.

Yes, I'm an editor, with a serious genealogical hobby. There are times when I do quite a bit of copying and pasting of material from:

* Various sources for quotes for news stories -- or just flipping between a source document and the program I'm using to write the material to check a fact, the spelling of a name, to copy a person's job title, often from PDF, web or other types of documents;

* For excerpts of the stories I'm editing, so I can e-mail and ask various reporters what they mean by some phrase or sentence, or to check with them that a change I've made is OK with them;

* When I'm working on my hobby, a lot of bits and pieces -- names of towns, names of people (first name, say, from a document, into a specific field of my genealogical program's database, surname, birth place town's name, birth/marriage/death date... there's _a lot_ of that.

I've tried Expose, but... well, I just tried it now and I've got 23 windows wallpapering my screen. When moving back and forth, I have to pause _between each flip_ to visually identify the window I want and then move my mouse to choose it. And while the location of the windows might remain stable for a few minutes, it moves whenever I open or close a window.

/ Peter Morgan
 
Reply With Quote
 
Member
Join Date: Sep 2008
Posts: 6
 
      30th September 2008
Quote:
Originally Posted by Spawn_Dooley View Post
I'm not sure if an AppleScript would be easier that Command + Tab
.
I'm wondering if perhaps I may have misunderstood this particular comment, SD.

Until about 15 minutes ago, I was under the impression that Command-Tab only called up a bar of large running-app icons, from which I then had to choose one with a mouse selection, or let the system cycle the selection on the bar, and that was what you meant by your comment.

Fifteen minutes ago, however, was when somebody told me in passing that simply hitting Command-Tab and then letting go would flip OS X's attention from the current front app to the previous front app -- which is exactly what I want.

It's even (blush) documented, in the Command-Tab pane of the Finder's Help files: "You can quickly switch from the current application to the last application used by pressing Command-Tab (and releasing the keys)."

So, once again, Apple's programmers are so far ahead of me, I think I'm first.

I'll slink off now...

/ Peter Morgan
 
Reply With Quote
 
Senior Member
teapot's Avatar
Join Date: Nov 2005
Location: Kendal UK
Posts: 214
 
      1st October 2008
Hi Morgannews
I have used logitech multi button mouse or mice for some years now and I have 1 f the buttons programmed to launch the app switcher then just click on the app I need to go to

 
Regards
Teapot

Dual 3.0 Mac Pro
OS 10.5.5 4GB RAM
iPod 40GbWheel iPod video 80Gb
assortment of printers Laser and Inkjet
then for when I am bored a PC!!
 
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
Running iPhone Applications In OS X Kurt R. Todoroff Mac 13 14th July 2009 08:39 AM
Fast User Switching and Server applications 6tc1@qlink.queensu.ca Mac 1 14th March 2006 03:24 AM
Applications running in Primary User only Paul Tilling Mac 3 28th September 2004 06:38 PM
user switching and applications in panther stamp Apps 4 29th October 2003 08:54 PM
Internet Explorer lags when switching between Applications Mitch Hall Mac 0 26th October 2003 10:46 PM


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


Welcome!
Welcome to the Mac Help Forums
 


Latest Threads
Yikes! Teacher needs help!
Mollyc4627 (7 Hours Ago, 08:57 PM)

Unable to log in to websites
AMonty20 (10 Hours Ago, 05:52 PM)

Add Different Speech Commands
bae_22 (11 Hours Ago, 04:40 PM)

Login (2 macs) passwords spontaniously changed?
Roger Vaught (13 Hours Ago, 03:31 PM)

Best car charger or inverter for Macbook Pro?
imeme87 (13 Hours Ago, 03:22 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