View Single Post
Old 03-10-2011, 12:14 PM   #102
tspin-swla
Junior Member
tspin-swla began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Feb 2011
Device: Archos 70c
Bat file for only one instance

I have been a long-time user of both Calibre and Dropbox, but have only just recently decided to use them together, so I have been following this discussion with interest.

I like pilotbob's suggestion to make a batch file to ensure that another instance of Calibre is not currently running. I did not, however, find an example anywhere in this thread, so I tried my own. You will need to edit the paths to reflect the correct Username and path used by your operating system. Feel free to post your improvements, but this seems to work for me.

Code (this version is for Windows XP):
----------------
@Echo Off
Echo.Always start Calibre from this batch file to prevent running
Echo.multiple copies of Calibre, and corrupting the Calibre database.
Echo.
Echo.This window will disappear and cleanup temporary files when you exit Calibre.
Echo.
Echo.
Echo.
IF NOT EXIST "C:\Documents and Settings\Username\My Documents\My Dropbox\Public\Calibre Library\_Calibre_is_inuse.txt" GoTo Calibre
ECHO.Calibre is presently in use on another PC.
Echo.
PAUSE
Goto EOF

:Calibre
ECHO.Starting Calibre...
echo @echo off > "C:\Documents and Settings\Username\My Documents\My Dropbox\Public\Calibre Library\_Calibre_is_inuse.txt"
"C:\Program Files\Calibre2\calibre.exe"
del "C:\Documents and Settings\Username\My Documents\My Dropbox\Public\Calibre Library\_Calibre_is_inuse.txt"

:EOF
exit
----------------
tspin-swla is offline   Reply With Quote