Hallo,
ich wollte auch "Fakturama für mehr als nur eine Firma verwenden"
siehe https://www.fakturama.info/community/fehler-verbesserungsvorschlaege/fakturama-fuer-mehr-als-nur-eine-firma-verwenden
habe ich ein Command-Script geschrieben, dass das für mich erledigt:
Es legt die neuen Verzeichnisse und einen Link am Desktop an
ich nutze die Fakturama Start-Optionen -workspace und -data
auf Windows XP und Windows 8 getestet
wer es brauchen kann ...
Viel Spaß damit
Scriptname z.B.: create-fakturama-mandant.cmd
@echo off & setlocal ENABLEDELAYEDEXPANSION
REM script written by NoBBi
REM Version 20140129b
echo.
echo.create link for Fakturama
echo.=========================
echo.
echo.will create a link to the Desktop for a Fakturama Shop
echo.
echo.creates a shortcut/link to the users desktop for multi-shop use
echo.like: C:PrgFakturamaFakturama.exe -workspace "C:dataFakturamashop1" -data "C:dataFakturamashop1"
echo or "C:Program Files (x86)FakturamaFakturama.exe" -data "C:dataFakturamashop1"
echo.and creates own data and workspace directories for each
echo.
pause
echo.%date% %time% ### Start script %~nx0
echo.--------------------------------------------------------
::set defaults
set "_shop=Shop7"
set "_language=-nl de"
set "_activedir=%~dp0"
set "_activedir=%_activedir:~0,-1%"
set "_workspace=%_activedir%"
set "_datadir=%_activedir%"
::Link Name (without ".lnk" )
set "_apptitel=Fakturama"
::Applicationpath (used for "execute in:" )
set "_appexe=Fakturama.exe"
if exist "C:Program FilesFakturama%_appexe%" set "_appdir=C:Program FilesFakturama"
if exist "C:ProgrammeFakturama%_appexe%" set "_appdir=C:ProgrammeFakturama"
if exist "C:PrgFakturama%_appexe%" set "_appdir=C:PrgFakturama"
if not defined _appdir (
set "_appdir=C:Program Files (x86)Fakturama"
echo.Fakturama.exe not found in a default Path,
echo.please install it or input right path
)
echo.
::ask for App
echo.define Application now
echo.----------------------
set /p _appdir=Path [%_appdir%] :
set /p _appexe=App.exe [%_appexe%] :
set /p _apptitel=Titel [%_apptitel%] :
if not exist "%_appdir%%_appexe%" (
echo.
echo.File "%_appdir%%_appexe%" do not exist
echo.please install first
echo."%_apptitel%" to "%_appdir%"
pause
exit 1
)
::ask for shopname
set /p _shop=Shopname [%_shop%] :
::merge apptitel with shopname
set "_apptitel=%_apptitel% %_shop%"
:choice_attributes
set _attributes=
set _a=1
echo.
echo.start application with
echo. 0 = no attributes
echo. 1 = -data
echo. 2 = -workspace
echo. 3 = -data and -workspace (do not work correctly in 1.6.3)
set /p _a=Answer [%_a%] :
::ask for datadir
for %%A in ("1" "3" ) do if "%_a%"==%%A (
set "_datadir=%_datadir%%_shop%"
set /p _datadir= -datadir [!_datadir!] :
if not exist "!_datadir!" md "!_datadir!"
set _attributes=TRUE
if "%_a%"=="1" set _workspace=
)
::ask for workspace
for %%A in ("2" "3" ) do if "%_a%"==%%A (
set "_workspace=%_workspace%%_shop%"
set /p _workspace= -workspace [!_workspace!] :
if not exist "!_workspace!" md "!_workspace!"
set _attributes=TRUE
if "%_a%"=="2" set _datadir=
)
if "%_a%"=="0" (
echo.create with no attributes
set "_datadir="
set "_workspace="
set _attributes=FALSE
)
if not defined _attributes goto :choice_attributes
::path to Desktop, link destination dir
set "_destdir=%userprofile%Desktop"
if not exist "%_destdir%" md "%_destdir%"
::comment
set "_linkdescription=%_apptitel%"
echo.
echo.creating VBScript %temp%MakeShortCut.vbs ...
::create temp VBScript ...
echo.Set objShell=WScript.CreateObject( "Wscript.Shell" )>%temp%MakeShortCut.vbs
echo.Set objShortcut=objShell.CreateShortcut( "%_destdir%%_apptitel%.lnk" ) >> %temp%MakeShortCut.vbs
REM WindowStyle: 7=Minimized 0=Maximized 4=Normal
echo.objShortcut.WindowStyle=0 >> %temp%MakeShortCut.vbs
echo.objShortcut.IconLocation="%_appdir%%_appexe%" >> %temp%MakeShortCut.vbs
echo.objShortcut.TargetPath="%_appdir%%_appexe%" >> %temp%MakeShortCut.vbs
REM -workspace and -data can not be combined at the moment! Error in the Templates : [www.fakturama.org]
if defined not _workspace if not defined _datadir echo.objShortcut.Arguments="%_language%" >> %temp%MakeShortCut.vbs
if defined _workspace if not defined _datadir echo.objShortcut.Arguments="%_language% -workspace "^&Chr(34)^&"%_workspace%"^&Chr(34) >> %temp%MakeShortCut.vbs
if defined _datadir if not defined _workspace echo.objShortcut.Arguments="%_language% -data "^&Chr(34)^&"%_datadir%"^&Chr(34) >> %temp%MakeShortCut.vbs
if defined _workspace if defined _datadir echo.objShortcut.Arguments="%_language% -workspace "^&Chr(34)^&"%_workspace%"^&Chr(34)^&" -data "^&Chr(34)^&"%_datadir%"^&Chr(34) >> %temp%MakeShortCut.vbs
echo.objShortcut.Description="%_linkdescription%" >> %temp%MakeShortCut.vbs
echo.objShortcut.WorkingDirectory="%_appdir%" >> %temp%MakeShortCut.vbs
echo.objShortcut.Save >> %temp%MakeShortCut.vbs
::... run VBScript ...
echo.execute VBScript now ...
cscript //nologo %temp%MakeShortCut.vbs
::... and delete VBScript ...
echo.deleting VBScript after work is done ...
del %temp%MakeShortCut.vbs
:: backup copy
echo.make a backup of the newly created lnk-file in active path
if exist "%_activedir%%_apptitel%.lnk" del "%_activedir%%_apptitel%.lnk" > nul
copy "%_destdir%%_apptitel%.lnk" "%_activedir%%_apptitel%.lnk" > nul
echo.
echo.%date% %time% ### END of script %~nx0
echo.
set _a=Y
set /p _a=start the App right now [%_a%] :
if /i "%_a%"=="Y" start "RUN APP" "%_destdir%%_apptitel%.lnk"
exit 0
Gruß
NoBBi
edit: "winking smiley" aus dem code entfernt 😉
edit: Pfadangabe mit Leerzeichen, Auswahl der Attribute/Start optionen, language (hardcoded)
edit: "winking smiley" aus dem code entfernt 😉
edit: diverse verbesserungen, z.b. script in das Fakturama-Haupt-Datenverzeichnis stellen und ausführen
es wird dann der Mandant angelegt und ein Link zum starten von Fakturama für diesen Mandanten
edit: prüfen ob fakturama schon installiert ist und noch ein vergessenes " hinzugefügt