MozillaZine

Thunderbird + USB key chain

Discussion of general topics about Mozilla Thunderbird
big_gie
 
Posts: 153
Joined: August 29th, 2003, 7:00 am
Location: Montréal, Québec, Canada

Post Posted June 18th, 2004, 4:48 am

Hi,

I've found some thread talking about firefox/thunderbird on a usb device. But those requires to modify some environement variables with batch files, which isnt really nice.

On Thunderbird's v0.7 release notes, it says:
[quote=http://www.mozilla.org/products/thunderbird/releases/]New Profile Manager which also supports running from a USB device.[/quote]

Anyone knows where I can find more info on this? How is it achievable without nasty batch files?

Thank you very much :)

tanstaafl
Moderator

User avatar
 
Posts: 45577
Joined: July 30th, 2003, 5:06 pm

Post Posted June 18th, 2004, 4:51 am

Nope. But there is a related thread at http://forums.mozillazine.org/viewtopic.php?t=87013 that you might want to track.

big_gie
 
Posts: 153
Joined: August 29th, 2003, 7:00 am
Location: Montréal, Québec, Canada

Post Posted June 18th, 2004, 6:06 am

thanx m8, will try to figure it out. I'll post back what I'll found...

big_gie
 
Posts: 153
Joined: August 29th, 2003, 7:00 am
Location: Montréal, Québec, Canada

Post Posted June 18th, 2004, 7:40 am

Ok I've succesfully done it! :)

F: is my USB key.
I've extracted the 0.7 zip file in F:\Thunderbird07 so I have F:\Thunderbird07\thunderbird.exe

I created a F:\Thunderbird07\profile directory.

I ran
F:\Thunderbird07\thunderbird.exe -ProfileManager
to create a new profile. When asked for the location, I entered "F:\Thunderbird07\profile"

I ran F:\Thunderbird07\thunderbird.exe, and got the choice of 3 profiles (the new one and 2 old ones). I choosed the new one I just created.

I now setted up all my preferences. Added new accounts. After the mail accounts were created, I've copyed the content of each ...\Application Data\Thunderbird\Profiles\<Profile name>\<...>.slt\mail\ folder to the corespondant ones on the new usb profile F:\Thunderbird07\profile\Mail\ directories.

Now, if I run F:\Thunderbird07\thunderbird.exe, I get the choice of the 3 profiles, and if I choose the new one, evertyhing works fine :)

To test everything and to be sure, I renamed ...\Application Data\Thunderbird to ...\Application Data\Thunderbird.bak

Now the with the new "feature" of mozilla/firefox/thunderbird

As from bug #211628 (http://bugzilla.mozilla.org/show_bug.cgi?id=211628) it seams that mozilla/firefox/thunderbird now support the "-Profile" command line parameter to specify the profile to use.

If I run F:\Thunderbird07\thunderbird.exe alone, a new ...\Application Data\Thunderbird folder is created with a default profile. I must run the .exe with the "-Profile" switch.

So instead of running "F:\Thunderbird07\thunderbird.exe" I need to run "F:\Thunderbird07\thunderbird.exe" -Profile "F:\Thunderbird07\profile"
Now you get the "Changing letter from a computer to another one. So I created a simple JScript file which will detect the USB drive letter and run the appropriate files.

Ok it looks maybe a bit like the batch files solution, but I think it is better for those reasons:
-With a JScript file (.js), you don't see an ugly command prompt
-You can perfom additionnal task like running YahooPops and/or HotmailPopper and kill them as soon as Thunderbird exit
-You can get the drive letter from which the .js is run REALLY EASILY.
-You don't modify anything on the hard drive.

Here is the .js file, that I'v putted on the root of my USB key chain (F:\Thunderbird.js)

Code: Select all
/*
File: <USB Drive Letter>:\Thunderbird.js
2nd version
Execute Thunderbird from a USB drive without interacting with the hard drive, with the profile being on the USB drive, in a clean way.
*/


Shell = WScript.CreateObject("WScript.Shell");

USB = Shell.CurrentDirectory;       // Returns the drive letter where the .js script is located
                                    // It is "F:\" on my system (different on others!!!)


ThunderbirdVersion = "07";          // Thunderbird version

PathToThunderbird = USB + "Thunderbird\\" + ThunderbirdVersion + "\\Programme\\";
                                    // Thunderbird is located in F:\Thunderbird\07\Programme\thunderbird.exe
                                    // I changed its path to have a cleaner USB drive.

Profile = USB + "Thunderbird\\" + ThunderbirdVersion + "\\Profile";
                                    // The path to the profile
                                    // It could be different since "-Profile" can receive relative path

Thunderbird = PathToThunderbird + "thunderbird.exe";
                                    // The complet path+name of thunderbird
                                    // It is F:\Thunderbird\07\Programme\thunderbird.exe on my system


YahooPops = USB + "YahooPOPs\\YahooPOPs.exe";
YahooPopsConfig = USB + "YahooPOPs\\config.reg";
                                    // Those two lines are [b]optional[/b]
                                    // It is to launch YahooPOPs too.
                                    // F:\YahooPOPs\YahooPOPs.exe

Shell.Run("regedit /s " + "\"" + YahooPopsConfig + "\"", 0, true);
                                    // I exported a reg key with yahoopops config
                                    // [b]optional[/b] so it will listen on the same port on each machine
                                    // The key is situated at HKEY_CURRENT_USER\Software\YahooPOPs!\YahooPOPs!\Settings

Shell.Run("\"" + YahooPops + "\" /SILENT", 0, false);
                                    // Runs YahooPOPs with the silent switch, which means
                                    // that if another instance of YP is running, it won't
                                    // prompt you.

Shell.Run("\"" + Thunderbird + "\" -Profile \"" + Profile + "\\", 1, true);
                                    // This execute Thunderbird
                                    // note the "1" at the left of the true. This means that the .js script
                                    // will wait for the process "thunderbird.exe" to end before continuing.
                                    // If it was "0", like others in the file, the it execute the command
                                    // and continue without waiting.


Shell.Run("\"" + YahooPops + "\" /QUIT", 0, false);
                                    // When thunderbird.exe ends, it execute yahoopops with
                                    // the /quit parameter so it quits the program :)
                                    // This is a new feature from version 0.6



Edit: Changed the .js file to launch YahooPOPs on the usb drive too.
Edit #2: New corrected version of the script + more comments
Last edited by big_gie on June 21st, 2004, 7:02 pm, edited 2 times in total.

tanstaafl
Moderator

User avatar
 
Posts: 45577
Joined: July 30th, 2003, 5:06 pm

Post Posted June 18th, 2004, 4:22 pm

I think what you are saying is that you used to be able to specify the profile name but not its location with the -p command line argument. With 0.7 you can specify the profiles location instead of its name. Your're using a script mainly to automate finding what drive letter to use.

Why in the world didn't they mention the change to -p in the release notes?

wintogreen
 
Posts: 3891
Joined: October 31st, 2003, 8:38 pm

Post Posted June 18th, 2004, 6:44 pm

Very interesting. Here are my results from a few simple experiments, after having installed TB on a USB stick (with the application in "E:\Tbird0.7" and the profile in "E:\TBtestprofile", on WinXP):
E:\Tbird0.7\thunderbird.exe -Profile "E:\TBtestprofile"

Runs TB using the specified profile on the USB stick. Nothing gets written to the hard drive, as big_gie says above. Even if TB is installed on the hard drive, it ignores registry.dat/profiles.ini and launches with the specified profile.
E:\Tbird0.7\thunderbird.exe -P "E:\TBtestprofile"

Does not launch with the specified profile, but instead launches the profile manager. (Same with lower-case -p switch.)
E:\Tbird0.7\thunderbird.exe -Profile "TBtestprofile"

Does nothing. The profile manager does not even come up. But...
E:\Tbird0.7\thunderbird.exe -Profile "\TBtestprofile"

Runs the specified profile on the USB stick, just as in the first example above. Works even if the drive letter of the USB stick is changed from E to F. Would seem to indicate that the .js file is not even necessary, no?

big_gie
 
Posts: 153
Joined: August 29th, 2003, 7:00 am
Location: Montréal, Québec, Canada

Post Posted June 19th, 2004, 7:30 am

thanx wintogreen for the investigation! :)

Would seem to indicate that the .js file is not even necessary, no?

Well, Maybe not. Since you still need to give parameters to thunderbird.exe, you would need a shortcut, a batch file or a .js to launch it with the appropriate parameters...

wintogreen
 
Posts: 3891
Joined: October 31st, 2003, 8:38 pm

Post Posted June 19th, 2004, 8:40 am

Of course, your .js file can do all kinds of tricks. I was thinking more in terms of the average user: what's the simplest possible way to get TB running from a USB stick? A shortcut is probably easiest in most cases.

Thank you, by the way, for figuring out how to get this working in the first place, especially since the release notes didn't provide any instructions! :D

wintogreen
 
Posts: 3891
Joined: October 31st, 2003, 8:38 pm

Post Posted June 19th, 2004, 7:04 pm

Can anyone verify that starting up Thunderbird with the following command, from my first post in this thread, works on OS's other than Windows? (And please indicate what the equivalent command looks like for your OS.) I'd like to update the knowledge base page about running from a USB stick. Thanks!
E:\Tbird0.7\thunderbird.exe -Profile "\TBtestprofile"

FlashBanG
 
Posts: 184
Joined: January 14th, 2003, 7:39 pm

Post Posted June 19th, 2004, 10:50 pm

wintogreen:

as investigated in the firefox usb drive thread, it must either be a batch file, or a script (vb or js) file that launches the program, as a shortcut would need a hardcoded path (which would screw up when the drive letter changes), whereas a batch file can take a relative path, and the script file can work around this.
----------------------------------------------------------

FlashBanG

----------------------------------------------------------

tanstaafl
Moderator

User avatar
 
Posts: 45577
Joined: July 30th, 2003, 5:06 pm

Post Posted June 19th, 2004, 11:27 pm

Can you post a link to the firefox usb thread (since search is disabled)?

wintogreen
 
Posts: 3891
Joined: October 31st, 2003, 8:38 pm

Post Posted June 20th, 2004, 4:54 am

FlashBanG wrote:as investigated in the firefox usb drive thread, it must either be a batch file, or a script (vb or js) file that launches the program, as a shortcut would need a hardcoded path (which would screw up when the drive letter changes), whereas a batch file can take a relative path, and the script file can work around this.

You would think so, but that's not what I've found trying this out with two different WinXP machines. On one machine the USB stick is designated drive E, and on the other it's F. Interestingly, even though the shortcut target was orignally created for thunderbird.exe on E, when I use the same USB stick on the other computer, the shortcut still works and it seemingly rewrites itself. In other words, when I look at the shortcut Properties after using it on E and F, the target automatically changes from
E:\Tbird0.7\thunderbird.exe -Profile "\TBtestprofile"

to
F:\Tbird0.7\thunderbird.exe -Profile "\TBtestprofile"

without me manually changing it. Note also that the path to the profile doesn't even contain the drive letter, so that's not an issue.

I don't know if it's WinXP that's allowing TB to function from the USB stick like this, but it seems to be working very well with nothing more than a simple shortcut. Would appreciate hearing from others who have tried it out.

wintogreen
 
Posts: 3891
Joined: October 31st, 2003, 8:38 pm

Post Posted June 20th, 2004, 5:24 am

tanstaafl wrote:Can you post a link to the firefox usb thread (since search is disabled)?

Search is back (for good, I hope). It's probably this thread: http://forums.mozillazine.org/viewtopic.php?t=81759

big_gie
 
Posts: 153
Joined: August 29th, 2003, 7:00 am
Location: Montréal, Québec, Canada

Post Posted June 20th, 2004, 7:07 pm

Its a windows feature: if a shortcut doesnt point corecltly, it search for the appropriate file. I don't know how it search, but it seams that it will find the file that looks the more the same as the original... since it "just" a drive letter it will surely find it. BUT, if you have a FF/TB installed on another drive, it could get some problem...

It could be a solutio... I still prefer the .js though :)

khabat
 
Posts: 1
Joined: June 21st, 2004, 1:44 am

Post Posted June 21st, 2004, 1:52 am

batch file for Windows 2000/xp

Code:

@echo off
START /D%cd%tb\ /MAX %cd%tb\thunderbird.exe -Profile %cd%profile\tb\

Note:
Thunderbird 0.7 installed on USB in directory \tb
Profile stored on USB in directory \profile\tb

Return to Thunderbird General


Who is online

Users browsing this forum: No registered users and 1 guest