views:

90

answers:

1

I have a lot of tabs open in Firefox. After I close firefox and then run it again, the tabs are there, that's all right.

However, from time to time, Firefox crashes and my tabs are lost. I would like to somehow get the open tabs and backup the list to some file. Any ideas?

(With tabs in file I can also use git/svn/whatever to store them and optionally find some link 'that I saw in my browser but can't remember what it was'.)

What I got so far:

I'm able to get some urls, but that's doesn't seem to be exactly what I see in Firefox:

$c = ((gc c:\Users\..\AppData\Roaming\Mozilla\Firefox\Profiles\xfvj8vd5.default\sessionstore.js ) -join '')
$sess = [Jayrock.Json.Conversion.JsonConvert]::Import( $c.trim('()') )
$sess.windows[0].tabs | 
  % { $_.entries } | 
  % { $_.url } | 
  Select-Object -Unique

Please, don't tell me "use this addon or that addon". I really would like do it as I described.

A: 

Using the JSON module from PoshCode, this looks right (bear in mind: I tested this on Firefox 4, where the Tab Panorama results in "hidden" tabs, ymmv).

ConvertFrom-Json -File ~\AppData\R*\M*\F*\P*\*\sessionstore.js -Type PSObject -EA 0 |
Select -Expand Windows | Select -Expand Tabs | 
Where { !$_.hidden } | ForEach { @($_.Entries)[-1] } | 
Select Title, Url

All the * in the first line are just to make it short. Feel free to expand that to the full path if you care about the (milli)seconds spent searching.

Jaykul
Thx, Jaykul. Since nobody else added any other info, I'll just accept your answer :)
stej
Heh. I'll take that ;)
Jaykul