Greetings, julien . guyonnet @ free . fr!

> 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 Vsd2svgpath=%~dp0

...
First, never quote variable values, second, why use hardcoded paths, if it's
way too easy to get what you want right from the system?

> SET Inputfile=%~f1
> SET Nbofpages=
> SET i=
> SET j=

> REM Change working directory
> cd /D %Vsd2svgpath%

What for? Especially "what for", since you CHDIR only to check if the program
is there?
Leave it alone.

> REM Check if exe file is present
> IF NOT EXIST "vsd2svg.exe" (

IF NOT EXIST "%Vsd2svgpath%/vsd2svg.exe" (

>         ECHO ERROR 0: vsd2svg.exe is not in the current directory 
> (%Vsd2svgpath%)
>         PAUSE
>         GOTO :theend
> )

> REM Check an argument was given

Useless check, since you test for file existence afterward.
Nonetheless,

> IF "%~f1"=="" (

IF "%~1"=="" (

>     ECHO ERROR 1: No argument given
>         PAUSE
>     GOTO :theend
> )

> REM Check if input file exists
> IF NOT EXIST "%Inputfile%" (

IF NOT EXIST "%~1" (

>         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

FOR /F "tokens=1,2 delims= " %%i in ('"%Vsd2svgpath%/vsd2svg.exe" "%~1"') 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).

Dumping unrequested shit on console is a bad habit.

> REM Check if the ouput files are not already existing

This is hardly necessary.

> 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=



--
WBR,
Andrey Repin (anrdae...@freemail.ru) 28.06.2013, <14:36>

Sorry for my terrible english...

_______________________________________________
dia-list mailing list
dia-list@gnome.org
https://mail.gnome.org/mailman/listinfo/dia-list
FAQ at http://live.gnome.org/Dia/Faq
Main page at http://live.gnome.org/Dia

Reply via email to