Solved Restore last session
-
@Med1aN1ck said in Restore last session:
Python 2 (the 2nd version)
Hello. Sorry, if I have to post in the old thread. Have exactly the same problem.
Where do you get the Python 2 (the 2nd version) for download?
There are many versions here: https://www.python.org/downloads/
Could anyone help me, please.
-
@Gwen-Dragon
Have the version 2.7.15 installed.
How does that work with the commands exactly?
I think I'm doing something wrong.
-
@DEUnit
Your first command is missing the spaces that separate the parameters.
Your second command has a trailing " that shouldn't be there.That said:
- Did you navigate CMD to the folder containing the .py scripts (where you are in your second screenshot) before trying to run the command?
- The Last Session and Last Tabs file should probably be in the same folder as chromagnonTab.py and chromagnonSession.py, not within the chromagnon folder you have highlighted in screenshot 2.
-
Thank you very much for your detailed help.
A very nice forums moderator
Problem has been successfully completed.
-
@LuigiTheHunter Ported to Python 3, run them, put to that folder. Nothing happened.
-
@Gwen-Dragon Nope. You need to port those scripts to Python 3.
-
Hi,
i followed the instructions and got the current_session.log and current_tabs.log files, looks good, then i tried to
I then you put the files in "C:\Users%username%\AppData\Local\Vivaldi\User...
but nothing happens, no session or tab is restored after a restart and i dont see any menu that would do so.
-
Hi Gwen,
the export via the python tool worked fine, i just don't know what to to with these files - how to import them back into Vivaldi - as just putting them in any session folder did nothing and the format doesn't look like any of the other files.
greetings.
-
Hi Gwen,
isnt it
User Data
instead ofUser/Data
? But i already copied the files there, i start up Vivaldi and it doesnt restore anything, all that shows up is the tab with this forum. I also tried to delete the Current/Last Tabs and Current/Last Session files first, but no difference. I dont think its a file naming mismatch as i copied the python CMD commands from here. -
thx for caring.
i just came up with an individual solution: after exporting the Current Session file with the python script, one could just use this PHP script to convert it into a bookmark file that can be imported back into Vivaldi
<?php $log = file_get_contents('current_session.log'); $lines = explode("\n", $log); $i = 0; foreach($lines as $line){ if(strpos($line, 'SetTabWindow') !== false){ $i++; } if(strpos($line, 'http') !== false){ $tabs[$i] = substr($line, strpos($line, 'http')); } } $tabs = array_unique($tabs); echo '<!DOCTYPE NETSCAPE-Bookmark-file-1> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"> <!-- This is an automatically generated file. It will be read and overwritten. Do Not Edit! --> <TITLE>Bookmarks</TITLE> <H1>Bookmarks</H1> <DL><p>'."\n"; foreach($tabs as $tab){ echo '<DT><A HREF="'.$tab.'">'.$tab.'</A>'."\n"; } echo '</DL><p>';
i used it like
php log2bookmark.php > bookmarks.html
maybe that helps anyone.
-
@chorn I've had the same problem and I reached the same place that you seemed to (having seemingly successfully converted the 'Last Tabs' file and put it in the 'session storage' folder) and am also still unable to open them in Vivaldi.
You say that using that PHP script was able to solve your issue but could you elaborate on how to use it? I've downloaded PHP and am able to successfully execute the program after copying it into a php document and using the command you gave, but how do I direct the program to the 'LAST_TABS' file? i.e. where do I select the file I want to convert to bookmarks?
EDIT: Okay, I realised where I need to put the 'LAST_TABS.log' file (I just replaced the 'current_session.log' part with it. But now I've run into a second issue which is that, despite the .log file having hundreds of tabs (as verified by the hundreds of URLs in its text), the html document the PHP script produces only has one of the tabs, rather than all of them as desired.
Nevertheless, I've been able to solve my problem and open all the tabs by running the LAST_TABS.log file through this program I quickly put together (note that I'm well aware it's crap, but it worked for me and it was quick and easy to write):
lines=open("LAST_TABS.log").read().split("\n") #Change the "LAST_TABS.log" to whichever file you want to input n=0 a=[] while n<len(lines): if "SelectedNavigationInTab" in lines[n]: a.append(n-1) n+=1 for n in range(len(a)-1,-1,-1): a[n]=lines[a[n]] lines="\n".join(a) lines=lines.split("\n") for i in range(0,5): n=0 while n<len(lines): try: b=lines[n].index("http") lines[n]=lines[n][b:] except: lines.append(lines[n]) del lines[n] n+=1 lines="\n".join(lines) open("LAST_TABS.log",'w').write(lines) #Change the "LAST_TABS.log" to whichever file you want to output it to
This should turn it into a text file with all the URLs by themselves and the home pages, options tabs and files from your computer at the bottom. It also gets rid of all the history tabs (for if you were to click the back button) and just keeps the one that you would have had open at the time. Then you can just copy and paste the URLs into an online tab opener tool to open them en masse (rather than clicking on one at a time). This is a pretty crap way of doing it as it's still pretty slow, my program is a chucked together mess that may not work for all cases (I've only tried it on mine), you lose a bit of the information like your history and the tab stacks etc, and it's all round just a pretty crap method but it worked for me so if your trying to get all your tabs back and all else fails, this might possibly work for you... maybe.
-
Is it really no easy way to recover session? In the past I just replacing Current Session/ Current Tabs with Last ones and everything worked fine... until now. And in the window side menu I see only one closed window which I do not need. So I dig into that php shit and eventually got these session.log and tabs.log which obviously not worked wherever I put them.
Now I opened that session.log in text editor and searching for needful URLs and opening them by hand in browser.
update. There is a small extension Open Multiple URLs which can extract urls from copypasted text and it fits perfectly for this task (except for tabs history lines which have to be removed manually leaving only last url).
-
It's ridiculous to still have this problem in a v3 software with 4 years of releases behind it, beyond the Chromium heritage.
Ridiculous that I have to remind myself every now and then to File\Save Open Tabs as Session, manually type the current date, manually prune the collection of old backup sessions. (Or get an extension to do that.)It's the software's job to do all that, especially when it's so simple to do and basic. It's a core feature, it should just work.
It's also annoying that it uses cryptic binary formats instead of plain text. Makes it difficult to manually extract the URLs from "Last Tabs".
-
@Gwen-Dragon I have no idea how Python works, and it is a little ridiculous that I have to do something this technical just to unlock a previous session. I put in the commands as you did, correcting the paths as needed, and all it did was tell me that I had a syntax error.
"File "[path to chromagnonSession.py", line 38 print command ^" and then "SyntaxError: Missing parentheses in call to 'print'. Did you mean print(command)?"
Like I said, I've never used python, I just want to restore my mom's enormous session from her old hard drive, it had like 100 tabs in it.
-
@somnomania Sounds like the script might be written for Python 2 but you have Python 3 installed.
-
@Gwen-Dragon Nevermind, @Komposten had it right, I installed Python 2 and it worked just fine. The files didn't have my mom's session in them, unfortunately, but at least I got the commands to work.
-
You must save the Last Session file (before closing the browser) and then rename it to Current Session. Then you simply have to replace the Current Session file in the Default folder with the new renamed Current Session file (formerly Last Session file).
-
Hello. I followed all the steps above however I am having some issues with getting the tool to extract the Session file URLs. It works fine with the Tabs file and extracts the URLs to the log, however when I try to get the URLs from the Session file, it is giving me an error telling me that the file is corrupt. The file is about 25mb. Is there anyway to get the data from the Session file? Please let me know. Thank you.
-
Here's an alternative version that takes into account multiple windows in the output file, supports both "Session" and "Tabs" files with any kind of URI (not only http), uses an argument for the input file and writes to a corresponding output file directly, and with a line to uncomment when the log file was created from Chromagnon using PowerShell instead of cmd:
-
Why can't we just have a 'Restore last session' button? This is nuts!