Restore last session



  • 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.


  • Moderator

    @chorn Did you see my example at https://forum.vivaldi.net/post/270956?
    What des not work, please explain.



  • 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.


  • Moderator

    @chorn @chorn Backup changed ...log files from python tool
    Open Windows Explorer
    Copy&Paste %LOCALAPPDATA%\Vivaldi\User Data\Default in Explorer's address field
    Navigate to folder Session Storage
    Copy changed files to this folder
    Start Vivaldi



  • Hi Gwen,

    isnt it User Data instead of User/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.


  • Moderator

    @chorn

    isnt it User Data

    Yes User Data, if fixed it.

    But i already copied the files there, i start up Vivaldi and it doesnt restore anything

    Hmm, i can not test that as i have no Python on my office PC to convert files.
    Sorry, but you should wait until an other user comes up.



  • 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.


  • Moderator

    @somnomania Please post the command you wrote in Commandline window here with </> code button.
    And post the complete output (you can mark it with mouse and hit Return key to copy!) here when command fails.


  • Vivaldi Translator

    @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.


Log in to reply
 

Looks like your connection to Vivaldi Forum was lost, please wait while we try to reconnect.