Author Topic: Translating Batch files to Lisp files  (Read 1704 times)

0 Members and 1 Guest are viewing this topic.

CADMAN

  • Mosquito
  • Posts: 3
Translating Batch files to Lisp files
« on: February 24, 2017, 04:23:07 AM »
Hello,

I'm trying to translate a script into a lisp and have the following difficulty:
In my batch file, the command to run is as follows
*******************************************
@ECHO OFF
G:
if exist G:\plots\%1d\*.plt rmdir G:\plots\%1d /S /Q
if not exist G:\plots\%1d\*.plt mkdir G:\plots\%1d

echo Duplexdateien werden erzeugt.
echo .
echo Bitte warten.
@ECHO ON

cd \plots\%1v
for %%f in (*.plt) do dup_prn -dc %%f ..\%1\%%f ..\%1d\%%f
cd \plots\%1d

rem Automatische Umwandlung der plt in pdf
call plt2pdf %1

pause
*****************************************

My lisp looks like this:  :idiot2:

%%%%%%%%%%%%%%%%%%%%%%%

(defun C:DUP()
(if (null (vl-file-directory-p (strcat "G:/plots/" ascdat "d")))
       (vl-mkdir (strcat "G:/plots/" ascdat "d"))
      (vl-rmdir (strcat "G:/plots/" ascdat "d"))
      )
      (print "Duplexdateien werden erzeugt.")
      (terpri)
      (print "Bitte warten.")
      (princ)
      (ACET-FILE-chDIR (strcat "G:/Plots/" ascdat "v"))
      (startapp "cmd" "for" "%%f" "(*.plt)" "r:/B/Dup_prn/dup_prn.exe" "-dc" "%%f" "/%1/%%f" "/%1d/%%f")
      (ACET-FILE-chDIR (strcat "G:/Plots/" ascdat "d"))
      (startapp "r:/B/plt2pdf.bat" "%1" pause)
 )

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

I am aware that it can not work yet because it is not yet finished.
But I need urgent help from a professional.
Can someone help me please?

Many Greetings
CADMAN

ChrisCarlson

  • Guest
Re: Translating Batch files to Lisp files
« Reply #1 on: February 24, 2017, 03:46:02 PM »
What does not currently work?

CADMAN

  • Mosquito
  • Posts: 3
Re: Translating Batch files to Lisp files
« Reply #2 on: February 27, 2017, 03:03:20 AM »
espacially the second function:
(startapp "cmd" "for" "%%f" "(*.plt)" "r:/B/Dup_prn/dup_prn.exe" "-dc" "%%f" "/%1/%%f" "/%1d/%%f")
does not work. This small program takes two pdf-documents (front and backsite) and do one pdf- doc.


PKENEWELL

  • Bull Frog
  • Posts: 317
Re: Translating Batch files to Lisp files
« Reply #3 on: April 05, 2017, 01:57:35 PM »
@CADMAN,

(startapp) does not take multiple arguments like that. search for "startapp" in your help. the appcmd argument has to be a single string.

See if this works instead (untested):

Code: [Select]
(startapp "cmd.exe" "for %%f (*.plt) r:/B/Dup_prn/dup_prn.exe -dc %%f /%1/%%f /%1d/%%f")
or
(startapp "cmd for %%f (*.plt) r:/B/Dup_prn/dup_prn.exe -dc %%f /%1/%%f /%1d/%%f")

I am unsure if this will work as I don't have the same environment or files to work with. Alternatively, you could try the "SHELL" OS command. You can test it by typing SHELL at the command line and pasting in the command string without the "cmd" part.
"When you are asked if you can do a job, tell 'em, 'Certainly I can!' Then get busy and find out how to do it." - Theodore Roosevelt