Freemind Collaboration on Windows: Difference between revisions

From FreeMind
Jump to navigationJump to search
No edit summary
Line 151: Line 151:


Us at [http://www.oebfa.co.at/ Austrian Federal Financing Agency], Austria
Us at [http://www.oebfa.co.at/ Austrian Federal Financing Agency], Austria
== Big Fat Warning ==
It won't lock referenced files, if you open a mindmap from within another mindmap, or from the file-open Menu, it won't lock the files nor check if it is locked.

Revision as of 13:52, 13 June 2008

Introduction

Share your mindmaps and build them in collaboration. This simple batch file authorizes collaboration on freemind maps via a fileserver. If you can access the same disk with your collegues in your organisation, you can now work together on your mindmaps : this script avoid multiple edition at the same time (lock the file for you and tell the others that YOU are currently editing it) and make backups each time you open a mindmap (like 2006-04-02_myfilename.mm). Works only on Windows.

Use

Call share.bat instead of the freemind file directly (ex : toto.mm) to lock and backup the map prior editing. Easy way to use it : put your freemind file + share.bat on your shared disk (ex : J://freemindFiles/share.bat and J://freemindFiles/toto.mm) and make a share.bat shortcut on your windows desk (right click on share.bat and select "send to" > "desk")

Code

Copy the code below to a text file (located in the same dir as your mindmap to share if possible) named share.bat (for example). Check if the configuration lines (first lines) fits your needs.

@ECHO OFF
CLS
REM *** CONFIG : Edit here if necessary ***

SET freemindProgramPath = "C:\Program files\FreeMind\Freemind.exe"

REM if this script is in the same dir as the file (.mm), just write : filepath=.\
SET filepath=.\

REM the name of the file to share
SET filename=toto.mm

REM if you like the backuped file to be stored in their own dir. Don't forget the trailing slash
REM example : backupsdir=versions\
SET backupsdir=

REM ******** Do not edit below ********

IF EXIST %filepath%lock.txt GOTO :LOCKEDFILE

ECHO STARTING FREEMIND on %computername% 
echo .

REM ********** Backups ***************
set mydate=%date:~11,4%%date:~8,2%%date:~5,2%
set mytime=%time:~0,2%%time:~3,2%%time:~6,2%
ECHO Saving preceding version of this file (good idea, is'nt it ?)
copy "%filepath%%filename%" "%filepath%%backupsdir%%mydate%_%mytime%_%filename%"
ECHO .
echo %filepath%%backupsdir%%mydate%_%mytime%_%filename%
echo %mydate%
echo %mytime%
REM ********** lock file creation ***************
ECHO %computername% > "%filepath%lock.txt"
%freemindProgramPath% "%filepath%%filename%"
ECHO You locked this mindmap file. You can free it later by pressing space bar in this window
echo .
PAUSE
CLS
ECHO That's it, your file is now free to be edited by others.
DEL "%filepath%lock.txt"
GOTO THEEND

:LOCKEDFILE
CLS
ECHO Sorry, the file is already edited by  
TYPE "%filepath%lock.txt"
GOTO THEEND

:THEEND
echo .
PAUSE

Licence

This code is released under GPL licence by Starcrouz. Hope it could be usefull for you.

Who use it ?

Us at EDF R&D, France


Generalization

I've put the above idea to more general use, meaning the replacement of Freemind.exe in the windows registered filetypes. This means that the script mentioned below will be called instead and locks the mindmap for every opening through the explorer. Another difference of the script to the original is that the user doesn't need to press any keys in command shells anymore, as the script only continues after the freemind executable (actually java) has been closed by the user. There is still commandshells being opened, which I'm not too happy about.

Use

"Install" the script + the windows registry changes and simply open your .mm files in the explorer

Code

Copy the code below to a command script named startLockFreemind.cmd (for example) and put into your Freemind program folder. Check if the configuration lines (first lines) fits your needs.

Copy the registry entries to a .reg file (e.g. FreemindLock.reg) and import into registry (doubleclicking). In case you changed the name of the command script then you have to modify the contents accordingly. Also you might need to change the path to the command script to reflect your Freemind program folder location.

@ECHO OFF
CLS
REM *** CONFIG : Edit here if necessary ***
(SET fPP=C:\Programme\Freemind\)

REM if you like the backuped file to be stored in their own dir. Don't forget the trailing slash
REM example : backupsdir=MMversions\
SET backupsdir=MMversions\

REM ******** Do not edit below ********
set fileFP=%~1%
set fileN=%~n1%
set fileP=%~p1%

IF EXIST "%fileFP%.lock" GOTO :LOCKEDFILE

ECHO STARTING FREEMIND on %computername%

REM ********** Backups ***************
set mytime=%time:~0,2%%time:~3,2%%time:~6,2%

REM You might need to change that to reflect your local date display...
set mydate=%date:~6,4%%date:~3,2%%date:~0,2%

IF NOT EXIST "%fileP%%backupsdir%" mkdir "%fileP%%backupsdir%"
copy "%fileFP%" "%fileP%%backupsdir%%mydate%_%mytime%_%fileN%.mm"

REM ********** lock file creation ***************
ECHO %computername% > "%fileFP%.lock"
start /wait java.exe -cp %fPP%lib\freemind.jar;%fPP%lib\ant\lib\jaxb-api.jar;%fPP%lib\ant\lib\jaxb-impl.jar;%fPP%lib\ant\lib\jaxb-libs.jar;%fPP%lib\ant\lib\namespace.jar;%fPP%lib\ant\lib\relaxngDatatype.jar;%fPP%lib\ant\lib\xsdlib.jar;%fPP%lib\ant\lib\jax-qname.jar;%fPP%lib\ant\lib\sax.jar;%fPP%lib\ant\lib\dom.jar freemind.main.FreeMind "%fileFP%"
DEL "%fileFP%.lock"
GOTO THEEND

:LOCKEDFILE
CLS
ECHO Sorry, the file is already edited by  
TYPE "%fileFP%.lock"
PAUSE
GOTO THEEND

:THEEND

Registry Settings

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\FreeMind Map\Shell\Open\Command]
@="\"C:\\Programme\\FreeMind\\startLockFreemind.cmd\" \"%1\""

Licence

This code is released under GPL licence by Roland.

Who uses it ?

Us at Austrian Federal Financing Agency, Austria

Big Fat Warning

It won't lock referenced files, if you open a mindmap from within another mindmap, or from the file-open Menu, it won't lock the files nor check if it is locked.