Benutzer-Werkzeuge

Webseiten-Werkzeuge


fakturama:dos-link-creator
create-Fakturama-link.cmd
@echo off & setlocal ENABLEDELAYEDEXPANSION
 
REM script written by NoBBi
REM Version 20160425a
REM copy this cmd-file into an existing directory and you get the right name
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:\Prg\Fakturama\Fakturama.exe -workspace "C:\data\Fakturama\shop1" -data "C:\data\Fakturama\shop1"
echo or   "C:\Program Files (x86)\Fakturama\Fakturama.exe" -data "C:\data\Fakturama\shop1"
echo.and creates own data and workspace directories for each
echo.
pause
echo.%date% %time% ### Start script %~nx0
echo.--------------------------------------------------------
::set defaults 
set "_language=-nl de"
set "_activedir=%~dp0"
set "_activedir=%_activedir:~0,-1%"
set "_workspace=%_activedir%"
set "_datadir=%_activedir%"
 
for /f "usebackq" %%A in (`cd`) do set "_activedirname=%%~nA"
REM set "_shop=shop4711"
set "_shop=%_activedirname%" 
 
 
::Link Name (without ".lnk" )
set "_apptitel=Fakturama"
 
::Applicationpath (used for "execute in:" )
set "_appexe=Fakturama.exe"
if exist "C:\Program Files\Fakturama\%_appexe%" set "_appdir=C:\Program Files\Fakturama"
if exist "C:\Programme\Fakturama\%_appexe%" set "_appdir=C:\Programme\Fakturama"
if exist "C:\Prg\Fakturama\%_appexe%" set "_appdir=C:\Prg\Fakturama"
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=3
  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%] :
 
 
  if "%_shop%"=="%_activedirname%" (
    set "_shopdir=%_activedir%"
    set "_workspacedir=%_workspace%"
  ) else ( 
    set "_shopdir=%_datadir%\%_shop%"
    set "_workspacedir=%_workspace%\%_shop%"
  )
 
  ::ask for datadir
  for %%A in ("1" "3" ) do if "%_a%"==%%A (
 
    set "_datadir=%_shopdir%"
    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=%_workspacedir%"
    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 : [fakturama.sebulli.com]
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
rem 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
fakturama/dos-link-creator.txt · Zuletzt geändert: 2017/01/10 15:57 von Admin