Code Red > AutoLISP (Vanilla / Visual)

Translating Batch files to Lisp files

(1/1)

CADMAN:
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:
What does not currently work?

CADMAN:
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:
@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: ---(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")

--- End code ---

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.

Navigation

[0] Message Index

Go to full version