vsd2svg - Batch file to process vsd files with several pages



Hi,

The following batch file may be made available on the page http://dia-installer.de/vsd2svg/index.html
It helps in processing vsd files with large number of pages

@ECHO OFF
REM Name: vsdtosvg_all_slides.bat
REM Author: Julien GUYONNET, June 2013, julien dot guyonnet at free.fr
REM Usage: vsdtosvg_all_slides.bat input.vsd
REM Output: As many svg files as pages in input.vsd
REM Copyright: None

REM Set variables
SET Vsd2svgpath="D:\documents and Settings\SESA34631\Desktop\vsd2svg-0.0.3"
SET Inputfile=%~f1
SET Nbofpages=
SET i=
SET j=

REM Change working directory
cd /D %Vsd2svgpath%

REM Check if exe file is present
IF NOT EXIST "vsd2svg.exe" (
        ECHO ERROR 0: vsd2svg.exe is not in the current directory (%Vsd2svgpath%)
        PAUSE
        GOTO :theend
)

REM Check an argument was given
IF "%~f1"=="" (
    ECHO ERROR 1: No argument given
        PAUSE
    GOTO :theend
)

REM Check if input file exists
IF NOT EXIST "%Inputfile%" (
        ECHO ERROR 2: The file %Inputfile% doesn't exist
        PAUSE
        GOTO :theend
)

REM Find the number of pages
FOR /F "tokens=1,2 delims= " %%i in ('vsd2svg.exe "%Inputfile%"') do SET Nbofpages=%%i

REM Check if nb of page is valid in input file 
IF %Nbofpages% LSS 1 (
        ECHO ERROR 3: vsd2svg.exe less than 1 page in %Inputfile%
        PAUSE
        GOTO :theend
)

REM Display the number of pages
ECHO Input file %Inputfile% has %Nbofpages% page(s).

REM Check if the ouput files are not already existing
FOR /L %%j IN (1,1,%Nbofpages%) DO (
        IF EXIST "%Inputfile%_Page_%%j.svg" (
                ECHO ERROR 4: %Inputfile%_Page_%%j.svg already exists
                PAUSE
                GOTO :theend
        )
)

REM process the files
FOR /L %%j IN (1,1,%Nbofpages%) DO (
        vsd2svg.exe "%Inputfile%" "%Inputfile%_Page_%%j.svg" %%j
        ECHO Page %%j of %Nbofpages%: %Inputfile%_Page_%%j.svg file created
)

:theend
REM Unset variables
SET Vsd2svgpath=
SET Inputfile=
SET Nbofpages=
SET i=
SET j=


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]