Move to a tab in Firefox

The below script will open Google News in a new tab. Now if I want to do the inverse, the script will continue to open new tabs. But I just want to go back and forth between the two. I do not really care how this is accomplished. I could close the old tab, when the new one is create, or just move to the new tab. I just do not want to open a whole bunch of new tabs every time this script runs. Make sense?
Thank you in advance.
tell application "Firefox" to set theURL to «class curl» of window 1
if theURL is "http://www.google.com/" then
tell application "Firefox" to Get URL "http://news.google.com"
end if
end

Redshark,
I am not sure I fully understand all of what you request but I have been looking at a possible solution to your inquiry.
The AppleScript dictionary of Firefox will not allow you to do what you want as it has no properties or commands related to tabs.
It is also difficult to get that information directly through probing the application using System Events GUI scripting.
Therefore you can not determine anything about the tabs such as their number, titles, size, location and the solution becomes rather involved and somewhat rough.
Using some of the other capabilities of System Events it is possible to piece together a rough solution that will count the number of tabs, move between tabs, and eliminate specified duplicates/empty tabs.
Without knowing the number of tabs it is difficult to provide a solution. There are at least two ways of determining the number of tabs.
1) Ask the user initially and then keep track;
2) Set a marker at the end of the tabs.
I have arbitrarily set a marker tab, which in my case is an empty tab i.e., no URL, at the end of all the other tabs so that I can determine the number of tabs.
NOTE: This means that there should not be any empty tabs in the middle.
The testing is based on the name of the window, determined using AppleScript, which reflects the name of the tab.
The program does the following:
1) checks for a marker tab at the end of the tabs and creates one if it is missing;
2) eliminates all of the duplicated tabs;
2) opens the Google News in a new tab;
3) creates a new marker tab at the end of the tabs.
click here to open this script in your editor<pre style="font-family: 'Monaco', 'Courier New', Courier, monospace; overflow:auto; color: #222; background: #DDD; padding: 0.2em; font-size: 10px; width:400px">property theTabNames : {}
property WantedURL : "http://news.google.com"
property MarkerTabName : "Mozilla FireFox"
property DuplicateNames : {"Google News", MarkerTabName}
on run {}
my SetMarkerTab()
-- Remove duplicate names
repeat with i from 1 to count of items in DuplicateNames
set theTabNames to my DetermineNumberOfTabs(MarkerTabName)
my EliminateTabs(theTabNames, item i of DuplicateNames)
end repeat
-- Open tab with wanted URL
tell application "Firefox"
Get URL WantedURL
end tell
-- Reset the marker
my CreateMarkerTab()
end run
on SetMarkerTab()
tell application "System Events"
tell process "firefox-bin"
set frontmost to true
keystroke "9" using command down -- move to last tab
if (name of window 1) is not MarkerTabName then my CreateMarkerTab()
end tell
end tell
end SetMarkerTab
on DetermineNumberOfTabs(MarkerName)
tell application "System Events"
tell process "firefox-bin"
set frontmost to true
set i to 1
set theNames to {}
set LastTabName to ""
repeat until LastTabName is equal to MarkerName
keystroke (i as string) using command down -- move to a tab
set LastTabName to name of window 1
set theNames to theNames & LastTabName
set i to i + 1
end repeat
end tell
end tell
return theNames
end DetermineNumberOfTabs
on EliminateTabs(TabNames, DuplicateName)
tell application "System Events"
tell process "firefox-bin"
set frontmost to true
repeat with i from (count of TabNames) to 1 by -1
if (item i of TabNames) is equal to DuplicateName then
keystroke (i as string) using command down -- move to a tab
keystroke "w" using command down -- close a tab within a window
end if
end repeat
end tell
end tell
end EliminateTabs
on CreateMarkerTab()
tell application "System Events"
tell process "firefox-bin"
set frontmost to true
keystroke "t" using command down -- new tab
end tell
end tell
end CreateMarkerTab
</pre>
PowerBook 12"   Mac OS X (10.4.8)  

Similar Messages

  • Opening a new tab in Firefox 16.0.1 the focus is on the address bar but then moves to the search field

    When I open a new tab in Firefox 16.0.1 the focus is on the address bar for a second or so then the focus moves to the search input field. If I start typing something the first character fills in the address bar then the rest is typed into the search field.
    How do I get the focus to remain in the address bar as per previous versions please?
    MacBook Pro OS X 10.8.2
    Firefox 16.0.1
    Thanks.

    Hello surfersteve1970,
    check it in [https://support.mozilla.org/en-US/kb/troubleshoot-firefox-issues-using-safe-mode Safe Mode], select "''Start in Safe Mode''" and see if this happen again, if not see: [https://support.mozilla.org/en-US/kb/troubleshoot-extensions-themes-to-fix-problems Troubleshoot extensions, themes and hardware acceleration issues to solve common Firefox problems]
    thank you
    Please mark "Solved" the answer that really solve the problem, to help others with a similar problem.

  • I have Windows Professional and I used to be able to move the curser over the Firefox icon in the taskbar and it would give me a telescoped view of all open tabs, now it just shows the tab that I'm currently viewing. How do I fix this?

    I have Windows 7 Professional and I used to be able to move the curser over the Firefox Icon in the taskbar and it would show me a telescoped view of all open tabs, now it just shows the tab that I'm currently viewing. How do I fix this?

    Hey MikeDo,
    Do you have the option checked for ''Show Tab Previews in the Windows Taskbar''? If not, just go to ''tools->options->tabs.'' You can find more information on what each of these settings do in the Knowledge Base article [[Options window - Tabs panel]].
    Hopefully this helps!

  • How to focus the tab in Firefox 3.6 (to move to beginning/end)

    I believe in previous versions of Firefox, when the tab was focused, you could use the keyboard shortcuts ctrl+end or ctrl+home to move the focused tab to either the end or beginning of your tabs. This functionality no longer seems to work, I believe because I can no longer actually focus a tab. Previously, but selecting the tab, I'd see a little box highlighting the text inside of the tab. I can still drag tabs to different locations, but being able to move them all the way to the beginning or end with a keyboard shortcut is a lot faster.
    == This happened ==
    Every time Firefox opened
    == I believe in 3.6

    Hello,
    I had this problem too. It seems to be a request since Firefox 3.5. You must have focus on tabs bar in order the shortcuts [Ctrl][Left] and [Ctrl][Right] work. You can read information about that here: https://bugzilla.mozilla.org/show_bug.cgi?id=462289
    I made a small plugin to provide new shortcuts to move tabs: https://addons.mozilla.org/en-US/firefox/addon/220875/

  • Can no longer move a new tab into Pinned App section in FF17

    After the update to FF17 I can no longer move a new tab into the Pin As App section without first pinning the tab. I liked how it worked before, where if you put it to the front or between 2 pinned tabs it would just pin itself and place it where you told it to... Is there an option to restore this? If not, no big deal, more of a minor annoyance really.

    hello andvarix, the drag&drop behaviour for tabs has changed in firefox 17 - they now move within the tab strip while being dragged. unfortunately the behaviour that you're now observing seems to be a somewhat intentional by-product of this change, it is unlikey that this will be fixed soon. you'd have to resort to the usual method of right-clicking a tab & select to pin it as app tab.
    for reference see [https://bugzilla.mozilla.org/show_bug.cgi?id=787897 bug #787897] (please don't post in bug reports).

  • I'm not able to close the filefox or any tab in Firefox 28.0 v for sometime. It seems that i don't have control over it.

    I'm not able to close the filefox or any tab in Firefox 28.0 v for sometime. It seems that i don't have control over it. Also if i'm watching any video not able pause it or move forward or use full screen.
    While as i'm opening the same like in IE itz working fine.
    I'm using firefox from past 5 years. Can u fix it as i temporary moved to chrome.

    hello, i'm not sure what filefox is - can you try to replicate this behaviour when you launch firefox in safe mode once? if not, maybe an addon is interfering here...
    [[Troubleshoot extensions, themes and hardware acceleration issues to solve common Firefox problems]]

  • Can't delete tabs from Firefox on my iPhone

    How can I delete tabs from Firefox on my iPhone? I'm using Firefox Sync and the number of tabs keep getting bigger. I'm up to 48.
    PS: I've tried the iPhone forum but no one replies. It's looking like there is no support for Sync??????

    Good morning,
    Sorry, ContactsTap does not solve the problem. It doesn't know about the "All on my iPhone" Group. Inside the app the contacts show as uncategorized.
    The problem is that if a contact is saved as "All on my iPhone" how can I move it to another of the native iPhone groups so that it syncs with the other group source.
    It is possible to link the contact with other contacts on other groups but I cannot move it to another group. It seems you have to retype the contacts.
    Someone forgot to include this feature. May be next iOs update?
    Best regards

  • How to disable double click to move through many tabs? Double click should mean move to next tab, twice

    I just upgraded to new firefox and there seems to be a new "feature", which makes working with multiple (50-80+) tabs impossible.
    When I click the move to left tab / move to right tab button, instead of being moved twice, everything jumps at gigantic speed for 15 or 20 tabs (something like PG up, PG down button maybe).
    This makes firefox unusable and Im considering downgrading.
    How to disable this "feature"?
    I tried messing around with
    toolkit.scrollbox
    but apparently the new mentality of the developers is "WE KNOW BETTER".
    How can I fix this?

    You can hold down the mouse button on a scroll button a bit longer to initiate scrolling multiple tabs.<br />
    Otherwise you need to wait longer between the clicks on the scroll button.<br />
    If you click twice on a tab bar scroll button too fast then you perform a 'page up' or 'page down' and the tabs scroll a tab bar width like you noticed.
    I'm not sure what you mean with new feature because this is the behavior in Firefox 3.6.x as well.

  • I am using a MacBook Pro and when I open a new tab in Firefox it opens to Trovi. Mozilla has a forum but solutions are all for the PC/Windows. How do I remove it?

    I am using a OSX MacBook Pro running Mavericks version 10.9.4 and using Firefox 30.0.  My Mac has recently been hijacked by a program called "Trovi". Whenever I open a blank new tab in Firefox the tab opens it opens with Trovi. The Mozilla forums offer support but all solutions are for users who run Windows. How do I remove Trovi from my Mac? Please help.

    Hey there! I answered this in another post a moment ago, this may be extremely helpful...I had the same problem until very recently with Trovi.
    Re: Trovi Virus Removal Needed
    Best of luck!

  • How do I open additional tabs in Firefox Home? I can see the tabs screen but it's blank and I can't find a way of opening a page in a new tab. Using an iphone 4 with ios 4.3.1.

    How can I open more than one tab in Firefox Home on an iphone 4 with ios 4.3.1? I can access the tabs page but all the entries are blank and I can't find a way to open a new page in a new tab.

    That doesn't fix the problem which seems to be more of a bug, but that's a great solution. In fact I think I like that more than right clicking. Thanks.

  • Why can I no longer open more than one tab in Firefox? Has Firefox been saboutaged by an update by Microsoft?

    I have been using Firefox for over 2 years and like the (unreliable) Windows Explorer before it I took for granted the ability to open multiple tabs. 2 days ago my computer downloaded some updates (even though I try to stop it) and after the compulsary restart I cannot open more than one tab in Firefox, even though the browser apparently invites me to. Is this an attempt by Microsoft to saboutage Firefox to build up support for its own product?

    Not Microsoft, it is the Ask toolbar. Try uninstalling the Ask toolbar and it should work again. There is a compatibility issue with the Ask toolbar and the current version of Firefox.

  • I like the feature of the PDF being opened on the new tab on firefox browser windows. But the newer version (3.6 or 4.0) will automatically open PDF in a pop up adobe apps. How do I keep the PDF open on the new tab as before? thank you

    I like the feature of the PDF being opened on the new tab on firefox browser's windows. But the newer version (3.6 or 4.0) will automatically open PDF in a pop up adobe apps. How do I keep the PDF open on the new tab as before like the 3.5 ver.? I want the PDF opened in the new tab rather than in the Adobe's app's pop up window. Could you help?
    thank you

    '''I fixed mine by removing the Ask.com extension.'''
    Tools
    Add-ons
    Settings icon
    View Recent Updates
    Ask.com '''DISABLE'''
    Running FF 8.0 on Windows 7 (64-bit)

  • Firefox will not connect or open. Mac OS 10.6.8. I was working with many open tabs when Firefox stopped working. Now it won't connect. I have uninstalled and downloaded it several times.

    I was working with many open tabs and firefox crashed. Now it won't connect to the internet at all.

    Create a new profile as a test to check if your current profile is causing the problems.
    See "Basic Troubleshooting: Make a new profile":
    *https://support.mozilla.com/kb/Basic+Troubleshooting#w_8-make-a-new-profile
    There may be extensions and plugins installed by default in a new profile, so check that in "Tools > Add-ons > Extensions & Plugins" in case there are still problems.
    If that new profile works then you can transfer some files from the old profile to that new profile, but be careful not to copy corrupted files.
    See:
    *http://kb.mozillazine.org/Transferring_data_to_a_new_profile_-_Firefox

  • When I open a second tab in Firefox, it does not go to my home page. Instead it goes to a page that displays what looks like a collection of pages (or links) t

    When I open a second tab in Firefox, it does not go to my home page. Instead it goes to a page that displays what looks like a collection of pages (or links) that I have visited in the recent or distant past. I would much rather have it go to my home page which is much more useful to me. I have tried to change this in 'Options' but with no luck. Please fix this.

    See also this article about the New Tab page (about:newtab):
    *https://support.mozilla.org/kb/new-tab-page-show-hide-and-customize-top-sites

  • How do you get new tabs on firefox to open to your home page?

    When I open new tabs in firefox they open to the blank "new tab" pg. How do i get them to open directly to my homepage on igoogle that opens when I start firefox?

    You can do that by using an add-on such as [https://addons.mozilla.org/firefox/addon/2221/ NewTabURL] or [https://addons.mozilla.org/firefox/addon/777/ New Tab Homepage].

Maybe you are looking for

  • Can't open Raw files in Photoshop CS6 using Nikon D7100?

    I have a Nikon D7100 and recently did a photoshoot where I shot in Raw. Upon uploading my images and then attempting to open them in Photoshop it came up with a pop up saying that photoshop is unable to open that camera raw file. I have downloaded th

  • EXTREMELY URGENT!!  Last question on Local Interfaces

    Using Oracle9iAS 9.0.3 Running on RedHat 8.0 Trying to implement local interfaces to my entity bean. (Oracle9iAS Containers for J2EE for 9.0.3) provides an example for writing local interfaces. pg. 2-10 states: //The variable is specified in the asse

  • Withholding tax - payment

    Dear experts, I have two A/R invoices with withholding tax and the customer is different in each two documents. This two invoices have been paid with an only cheque (so I have 2 invoices, 2 customers and an only payment). How can I do the payment by

  • Just checking in, any progress on the bugs?

    Specifically the midi driver conflict that seems to plague Mainstage unless I turn on my Ultralight, Axon 50 in that order after starting Mainstage. I also tried to use Omnisphere in Mainstage to no avail. It simply doesn't see any midi coming in. Ma

  • Adobe cs5.5 trial won't launch

    This is driving me mad! I have downloaded the trial version, i'm trying to launch on my mac running 10.7.2, I used to have CS3 but this no longer works with lion! Tried to open photoshop for the first time today and it just won't lauch, I am in a nev