Jim,
I have generalized the solution to the following which works in both Script Editor and Script Debugger on Sierra. Have to download Evernote to test on it but have other pressing needs at the moment.
Same proviso with regard to the tabs being next to each other and setting left-one with first script.
David
First script ========
tell application "System Events" set frontmostApp to name of first item of (processes whose frontmost = true) tell process frontmostApp to set frontTab to name of window 1 end tell tell application "Keyboard Maestro Engine" to setvariable "firstTab" to frontTab
tell application "System Events" set frontmostApp to name of first item of (processes whose frontmost = true) tell process frontmostApp to set frontTab to name of window 1 end tell tell application "Keyboard Maestro Engine" to set firstTab to getvariable "firstTab" if frontTab = firstTab then goToTab(frontmostApp, "Next") else goToTab(frontmostApp, "Previous") end if
on goToTab(frontmostApp, tabName) tell application "System Events" tell process frontmostApp set nextTabMenuItem to first item of (menu items of menu 1 of menu bar item "Window" of menu bar 1 whose name contains tabName & " Tab") click nextTabMenuItem end tell end tell end goToTab
On Mar 30, 2017, at 9:53 AM, Jim Underwood < email@hidden> wrote:
David,
Many thanks again for your ideas and scripts. I really didn't expect anyone to write the scripts for me.
It is very kind of you to do so.
Please see my reply below.
Jim Underwood
aka JMichaelTX
From: David Gregg < email@hidden>
Date: Thu, Mar 30, 2017 at 8:33 AM
Subject: Re: Looking for Scripts, Snippets, Ideas for Toggling Windows and Tabs of an App
The tabbing solution is more difficult because there currently isn't a standard way for keeping track of the tab history. Even if there is a way to get the tab index it is generally just ordered in a left to right sequence (this is the case in both Safari
and Script Debugger).
Exactly! You nailed the issue/challenge.
Solution 2
========
To simplify the solution, if possible physically move the tabs so they are next to each other.
Thanks. While I'd prefer not to move the tabs, this provides a workaround until we can find a better solution.
Below is an example for Script Debugger using mostly System Events. A Keyboard Maestro variable is used to save off the name of the left-most tab.
Example for Script Debugger
======================
Thanks again for this script.
When I tried to script Script Debugger 6, I found that it was not possible to directly set a document/Tab as frontmost.
However, the SD developer was very responsive to my query, and I believe that this capability will be coming soon in a SD6 update.
With this update, we should be able to target any two Tabs for toggling, without the need to move them adjacent first.
But in the meantime, your script provides a workable solution.
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: | |
| >Looking for Scripts, Snippets, Ideas for Toggling Windows and Tabs of an App (From: Jim Underwood <email@hidden>) |
| >Re: Looking for Scripts, Snippets, Ideas for Toggling Windows and Tabs of an App (From: David Gregg <email@hidden>) |
| >Re: Looking for Scripts, Snippets, Ideas for Toggling Windows and Tabs of an App (From: Jim Underwood <email@hidden>) |
| >Re: Looking for Scripts, Snippets, Ideas for Toggling Windows and Tabs of an App (From: David Gregg <email@hidden>) |
| >Re: Looking for Scripts, Snippets, Ideas for Toggling Windows and Tabs of an App (From: Jim Underwood <email@hidden>) |
|