<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Lisp creat script batch publish Multiple File in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-creat-script-batch-publish-multiple-file/m-p/12288186#M24861</link>
    <description>&lt;P&gt;Hi!&lt;BR /&gt;Sorry for the late reply when I'm the one who needs help. Anyway, work still comes first.&lt;BR /&gt;I created another lisp to load the lisp you wrote: "Page SetupList"&lt;/P&gt;&lt;LI-CODE lang="general"&gt; (write-line ".Open" scrFile) 
 (write-line dwgName scrFile)
 (write-line "(load\"PageSetupList\") " scrFile)
 (write-line "(load\"PS2A-PageSetup2AllLayout\") " scrFile)
 (write-line "(member "PDF.A1"(get_pgsetup_lst))" scrFile)
 (write-line "(command \"._-PSETUPIN\" \"Yaesu.dwt\" \"*\")" scrFile)
 (write-line "(c:PS2A)" scrFile)
 (write-line "_.Autopublish  " scrFile)
 (write-line "(command)" scrFile)
 (write-line ".zoom e" scrFile)
 (write-line "_.CLOSE _Y " scrFile)
 )  
  (close scrFil)&lt;/LI-CODE&gt;&lt;P&gt;However, line No.5 is wrong. I have tried adding "\" in multiple locations. But it's all wrong. So lisp doesn't work.&lt;BR /&gt;I also noticed that you are giving me the problem to complete. Thank you for your goodwill.&lt;BR /&gt;With my little knowledge, there are definitely many mistakes.&lt;BR /&gt;if you are comfortable with your time and mind. Please look into it for me.&lt;BR /&gt;Thanks&lt;/P&gt;</description>
    <pubDate>Thu, 05 Oct 2023 23:36:33 GMT</pubDate>
    <dc:creator>Vuxvix</dc:creator>
    <dc:date>2023-10-05T23:36:33Z</dc:date>
    <item>
      <title>Lisp creat script batch publish Multiple File</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-creat-script-batch-publish-multiple-file/m-p/12202776#M24845</link>
      <description>&lt;P&gt;Hi!&lt;BR /&gt;I'm trying to fix the attached lisp to do publishing for all files in the folder.&amp;nbsp;&lt;BR /&gt;Is there any other function to open Pop-up that can paste the path link instead of selecting the path like lisp is using. It will save more time.&lt;BR /&gt;Looking forward to helping. Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 29 Aug 2023 00:09:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-creat-script-batch-publish-multiple-file/m-p/12202776#M24845</guid>
      <dc:creator>Vuxvix</dc:creator>
      <dc:date>2023-08-29T00:09:18Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp creat script batch publish Multiple File</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-creat-script-batch-publish-multiple-file/m-p/12203425#M24846</link>
      <description>&lt;P&gt;Would this help&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.lee-mac.com/directorydialog.html" target="_blank"&gt;http://www.lee-mac.com/directorydialog.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Aug 2023 07:56:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-creat-script-batch-publish-multiple-file/m-p/12203425#M24846</guid>
      <dc:creator>paullimapa</dc:creator>
      <dc:date>2023-08-29T07:56:44Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp creat script batch publish Multiple File</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-creat-script-batch-publish-multiple-file/m-p/12203597#M24847</link>
      <description>Hi&lt;BR /&gt;Can you give more specific instructions?&lt;BR /&gt;I run lisp with the bits in the list. Then what needs to be done?</description>
      <pubDate>Tue, 29 Aug 2023 09:14:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-creat-script-batch-publish-multiple-file/m-p/12203597#M24847</guid>
      <dc:creator>Vuxvix</dc:creator>
      <dc:date>2023-08-29T09:14:32Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp creat script batch publish Multiple File</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-creat-script-batch-publish-multiple-file/m-p/12217574#M24848</link>
      <description>&lt;P&gt;What function do you have in mind that will let you get the path where the drawings are so you can paste it into your lisp code?&lt;/P&gt;&lt;P&gt;Currently your code shows this to pop up a window to select a folder:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;  (setq folderName
  (browsefolder "Select folder to perform batch job: ")
  )&lt;/LI-CODE&gt;&lt;P&gt;If you know exactly what the path should be then just replace the above with this:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;; if you know the path will always be C:\Autodesk
  (setq folderName "C:\\Autodesk\\")&lt;/LI-CODE&gt;&lt;P&gt;If you want the opportunity to enter the path at the command line then change to this:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;  (setq dwgprefix (getvar"dwgprefix")) ; set default path to current dwg path
  (while (not folderName)
   (setq folderName (getstring (strcat "\nEnter folder to perform batch job &amp;lt;" dwgprefix "&amp;gt;: ")))
   (if (eq folderName "") ; if enter 
     (setq folderName dwgprefix) ; then use default path
     (if (not (vl-file-directory-p folderName)) ; else check if path entered exists
       (setq folderName nil) ; if no path found then start over
       (if(not(eq "\\" (substr folderName (strlen folderName)))) ; else check if slash at end
         (setq folderName (strcat folderName "\\")) ; if not then add
       )
     ) ; if folderName
   ) ; if enter
  ) ; while&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 05 Sep 2023 00:13:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-creat-script-batch-publish-multiple-file/m-p/12217574#M24848</guid>
      <dc:creator>paullimapa</dc:creator>
      <dc:date>2023-09-05T00:13:39Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp creat script batch publish Multiple File</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-creat-script-batch-publish-multiple-file/m-p/12217588#M24849</link>
      <description>&lt;P&gt;Hi!&lt;BR /&gt;Within my own limited abilities. I combined Lee-Mac's lisp to be able to paste path links.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(setq folderName
  (LM:OFD "Select folder to perform batch job: " nil 16)
  )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I noticed this is "Open folder dialog". The desired window in my question is "Open File dialog".&lt;BR /&gt;Here is the version: Incorporate your lisp hint. but something is wrong. so lisp doesn't work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(defun c:PAD2 (/ dwgs file dwgName scrFile folderName)
  (setq dwgprefix (getvar"dwgprefix")) ; set default path to current dwg path
  (while (not folderName)
   (setq folderName (getstring (strcat "\nEnter folder to perform batch job &amp;lt;" dwgprefix "&amp;gt;: ")))
   (if (eq folderName "") ; if enter 
     (setq folderName dwgprefix) ; then use default path
     (if (not (vl-file-directory-p folderName)) ; else check if path entered exists
       (setq folderName nil) ; if no path found then start over
       (if(not(eq "\\" (substr folderName (strlen folderName)))) ; else check if slash at end
         (setq folderName (strcat folderName "\\")) ; if not then add
       )
     ) ; if folderName
   ) ; if enter
  ) ; while
  (setq scrFile (open (strcat folderName "\\PAD.scr") "w"))
  (foreach file dwgs
 (setq dwgName (strcat "\"" folderName "\\" file "\""))
 (write-line ".Open" scrFile) 
 (write-line dwgName scrFile)
 (write-line "_.Autopublish  " scrFile)
 (write-line "(command)" scrFile)
 (write-line ".zoom e" scrFile)
 (write-line "_.CLOSE _Y " scrFile)
 )  
  (close scrFile)  
  (command ".script" (strcat folderName "\\PAD.scr"))
  (princ)
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Sep 2023 00:28:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-creat-script-batch-publish-multiple-file/m-p/12217588#M24849</guid>
      <dc:creator>Ar_vxv</dc:creator>
      <dc:date>2023-09-05T00:28:34Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp creat script batch publish Multiple File</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-creat-script-batch-publish-multiple-file/m-p/12217601#M24850</link>
      <description>&lt;P&gt;Ok, found the error because I added a slash at end of folderName&lt;/P&gt;&lt;P&gt;Remove this section of code:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;  (setq dwgprefix (getvar"dwgprefix")) ; set default path to current dwg path
  (while (not folderName)
   (setq folderName (getstring (strcat "\nEnter folder to perform batch job &amp;lt;" dwgprefix "&amp;gt;: ")))
   (if (eq folderName "") ; if enter 
     (setq folderName dwgprefix) ; then use default path
     (if (not (vl-file-directory-p folderName)) ; else check if path entered exists
       (setq folderName nil) ; if no path found then start over
       (if(not(eq "\\" (substr folderName (strlen folderName)))) ; else check if slash at end
         (setq folderName (strcat folderName "\\")) ; if not then add
       )
     ) ; if folderName
   ) ; if enter
  ) ; while&lt;/LI-CODE&gt;&lt;P&gt;&amp;amp; replace with this:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;  (setq dwgprefix (getvar"dwgprefix")) ; set default path to current dwg path
  (setq dwgprefix (substr dwgprefix 1 (1- (strlen dwgprefix)))) ; drop slashes at end
  (while (not folderName)
   (setq folderName (getstring (strcat "\nEnter folder to perform batch job &amp;lt;" dwgprefix "&amp;gt;: ")))
   (if (eq folderName "") ; if enter 
     (setq folderName dwgprefix) ; then use default path
     (if (not (vl-file-directory-p folderName)) ; else check if path entered exists
       (setq folderName nil) ; if no path found then start over
       (if(eq "\\" (substr folderName (strlen folderName))) ; else check if slash at end
         (setq folderName (substr folderName 1 (1- (strlen folderName)))) ; if so then drop
       )
     ) ; if folderName
   ) ; if enter
  ) ; while&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Sep 2023 00:41:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-creat-script-batch-publish-multiple-file/m-p/12217601#M24850</guid>
      <dc:creator>paullimapa</dc:creator>
      <dc:date>2023-09-05T00:41:26Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp creat script batch publish Multiple File</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-creat-script-batch-publish-multiple-file/m-p/12217609#M24851</link>
      <description>&lt;P&gt;error: File load canceled&lt;/P&gt;&lt;LI-CODE lang="general"&gt;;;; Function to browse folder
;;; This code was originally posted by kpblc2000 in AUGI AutoLisp Forum

(defun browsefolder (title / shlobj folder fldobj)
  (vl-load-com)
  (setq
 shlobj (vla-getinterfaceobject
   (vlax-get-acad-object)
   "Shell.Application"
 )
 folder (vlax-invoke-method shlobj 'OFD 0 title 0)
  )
  (vlax-release-object shlobj)
  (if folder
 (progn
   (setq
 fldobj (vlax-get-property folder 'self)
 folderName (vlax-get-property fldobj 'path)
   )
   (vlax-release-object folder)
   (vlax-release-object fldobj)
   folderName
 )
  )
)
(princ "\nBatchJob is loaded, Type BatchJob to run.")
(princ)

;;; Main program, command: batchjob                            ;;
;;; old version of line 106:                                   ;;
;;; (browsefolder "Select folder to perform batch job: ")      ;;

(defun c:PAD2 (/ dwgs file dwgName scrFile folderName)
 (setq dwgprefix (getvar"dwgprefix")) ; set default path to current dwg path
 (setq dwgprefix (substr dwgprefix 1 (1- (strlen dwgprefix)))) ; drop slashes at end
  (while (not folderName)
   (setq folderName (getstring (strcat "\nEnter folder to perform batch job &amp;lt;" dwgprefix "&amp;gt;: ")))
   (if (eq folderName "") ; if enter 
     (setq folderName dwgprefix) ; then use default path
     (if (not (vl-file-directory-p folderName)) ; else check if path entered exists
       (setq folderName nil) ; if no path found then start over
       (if(eq "\\" (substr folderName (strlen folderName))) ; else check if slash at end
         (setq folderName (substr folderName 1 (1- (strlen folderName)))) ; if so then drop
       )
     ) ; if folderName
   ) ; if enter
  ) ; while
  (setq scrFile (open (strcat folderName "\\PAD.scr") "w"))
  (foreach file dwgs
 (setq dwgName (strcat "\"" folderName "\\" file "\""))
 (write-line ".Open" scrFile) 
 (write-line dwgName scrFile)
 (write-line "_.Autopublish  " scrFile)
 (write-line "(command)" scrFile)
 (write-line ".zoom e" scrFile)
 (write-line "_.CLOSE _Y " scrFile)
 )  
  (close scrFile)  
  (command ".script" (strcat folderName "\\PAD.scr"))
  (princ)
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Sep 2023 00:48:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-creat-script-batch-publish-multiple-file/m-p/12217609#M24851</guid>
      <dc:creator>Ar_vxv</dc:creator>
      <dc:date>2023-09-05T00:48:35Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp creat script batch publish Multiple File</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-creat-script-batch-publish-multiple-file/m-p/12217623#M24852</link>
      <description>&lt;P&gt;You missed the line of code that collects the dwgs from the folderName path&lt;/P&gt;&lt;P&gt;Also I dropped the browsefolder routine since you no longer need this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;; pad2 enter dwg path, create &amp;amp; run script file 
; https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-creat-script-batch-publish-multiple-file/m-p/12217609#M454238
(princ "\nPAD2 is loading...")
(defun c:PAD2 (/ dwgprefix dwgs file dwgName scrFile folderName)
 (setq dwgprefix (getvar"dwgprefix")) ; set default path to current dwg path
 (setq dwgprefix (substr dwgprefix 1 (1- (strlen dwgprefix)))) ; drop slashes at end
  (while (not folderName)
   (setq folderName (getstring (strcat "\nEnter folder to perform batch job &amp;lt;" dwgprefix "&amp;gt;: ")))
   (if (eq folderName "") ; if enter 
     (setq folderName dwgprefix) ; then use default path
     (if (not (vl-file-directory-p folderName)) ; else check if path entered exists
       (setq folderName nil) ; if no path found then start over
       (if(eq "\\" (substr folderName (strlen folderName))) ; else check if slash at end
         (setq folderName (substr folderName 1 (1- (strlen folderName)))) ; if so then drop
       )
     ) ; if folderName
   ) ; if enter
  ) ; while
  ; need to include the code below to get list of dwg files
  (setq dwgs (vl-directory-files folderName "*.dwg"))
  ;
  (setq scrFile (open (strcat folderName "\\PAD.scr") "w"))
  (foreach file dwgs
   (setq dwgName (strcat "\"" folderName "\\" file "\""))
   (write-line ".Open" scrFile) 
   (write-line dwgName scrFile)
   (write-line "_.Autopublish  " scrFile)
   (write-line "(command)" scrFile)
   (write-line ".zoom e" scrFile)
   (write-line "_.CLOSE _Y " scrFile)
  )  
  (close scrFile)  
; (startapp "Notepad" (strcat folderName "\\PAD.scr")) ; if needed open script file for editing 
  (command ".script" (strcat folderName "\\PAD.scr"))
  (princ)
) ; defun
(princ "\nSuccessfully loaded. Type PAD2 to run.")
(princ)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Sep 2023 01:27:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-creat-script-batch-publish-multiple-file/m-p/12217623#M24852</guid>
      <dc:creator>paullimapa</dc:creator>
      <dc:date>2023-09-05T01:27:36Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp creat script batch publish Multiple File</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-creat-script-batch-publish-multiple-file/m-p/12217632#M24853</link>
      <description>Hi Paul!&lt;BR /&gt;Although it is a "filedia 0" format, it is sufficient for this lisp. Thanks a lot!</description>
      <pubDate>Tue, 05 Sep 2023 01:11:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-creat-script-batch-publish-multiple-file/m-p/12217632#M24853</guid>
      <dc:creator>Ar_vxv</dc:creator>
      <dc:date>2023-09-05T01:11:21Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp creat script batch publish Multiple File</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-creat-script-batch-publish-multiple-file/m-p/12217644#M24854</link>
      <description>&lt;P&gt;Glad to have helped…cheers!!!&lt;/P&gt;</description>
      <pubDate>Tue, 05 Sep 2023 01:20:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-creat-script-batch-publish-multiple-file/m-p/12217644#M24854</guid>
      <dc:creator>paullimapa</dc:creator>
      <dc:date>2023-09-05T01:20:33Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp creat script batch publish Multiple File</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-creat-script-batch-publish-multiple-file/m-p/12283098#M24855</link>
      <description>&lt;P&gt;I encountered an issue while using this lisp to export PDFs for multiple drawings. Some of the drawings have layouts that do not have a "Page setup" assigned. Consequently, the script stops running.&lt;/P&gt;&lt;P&gt;How to edit the script - Let it override a "Page setup" (which may need to be imported from a template file since the dwg file does not have any Page setup) when exporting the PDF file.&lt;/P&gt;&lt;P&gt;Currently, I am using the "Autopublish" command to automatically export the drawing to PDF without modifying any settings. Should I consider an another way?&lt;/P&gt;&lt;LI-CODE lang="general"&gt;...
_.Autopublish  
(command)
.zoom e
_.CLOSE _Y &lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 04 Oct 2023 00:05:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-creat-script-batch-publish-multiple-file/m-p/12283098#M24855</guid>
      <dc:creator>Ar_vxv</dc:creator>
      <dc:date>2023-10-04T00:05:08Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp creat script batch publish Multiple File</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-creat-script-batch-publish-multiple-file/m-p/12283137#M24856</link>
      <description>&lt;P&gt;here's a &lt;A href="https://jtbworld.com/autocad-pagesetup-lsp#:~:text=lsp%20Free%20AutoLISP%20for%20AutoCAD,-Page%20Setup%20functions&amp;amp;text=To%20import%20page%20setups%20the,the%20page%20setup%20to%20import." target="_blank" rel="noopener"&gt;link&lt;/A&gt; to a web page with a number of pagesetup lisp functions:&lt;/P&gt;&lt;P&gt;you can use&amp;nbsp;&lt;SPAN&gt;getPageSetupName to check if there's a named pagesetup in the current layout.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;if not, then use&amp;nbsp;&lt;SPAN&gt;(command "._-PSETUPIN" filename "*") to import all from another dwg or a specific pagesetup before proceeding with autopublish&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Oct 2023 00:44:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-creat-script-batch-publish-multiple-file/m-p/12283137#M24856</guid>
      <dc:creator>paullimapa</dc:creator>
      <dc:date>2023-10-04T00:44:08Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp creat script batch publish Multiple File</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-creat-script-batch-publish-multiple-file/m-p/12283254#M24857</link>
      <description>&lt;P&gt;Hi! Please help me fixed it&lt;BR /&gt;1-I use this lisp to apply&amp;nbsp; Page Setup for all layouts after Psetupin to . But it doesn't work.&lt;/P&gt;&lt;LI-CODE lang="general"&gt;; name - the Page Setup Name
; all - a flag, T for all nil for current layout
(defun SetNamePageSetupAllLayouts (name all / lst)
   (or adoc (setq adoc (vla-get-ActiveDocument (vlax-get-acad-object))))
   (if (vl-position
          name
          (vlax-for pltcfg (vla-get-plotconfigurations adoc)
             (setq lst (cons (vlax-get pltcfg 'Name) lst))
          )
       )
      (progn
         (vlax-for layt (vla-get-Layouts adoc)
            (if (/= (vla-get-name layt) "Model")
               (if all
                  (vla-copyfrom layt (vla-item (vla-get-PlotConfigurations adoc) name))
                  (if (= (vla-get-name layt) (getvar 'ctab))
                     (vla-copyfrom layt (vla-item (vla-get-PlotConfigurations adoc) name))
                  )
               )
            )
         )
         (vla-Regen adoc acActiveViewport)
      )
   )
)
 

To call the main function:
; to change to PageSetup eg:"PDF.A1" all layouts
(defun c:PS2A nil
   (SetNamePageSetupAllLayouts "PDF.A1" T)
   (princ)
)

; to change to PageSetup eg:"PDF.A1" just the active layout
(defun c:PA21 nil
   (SetNamePageSetupAllLayouts "PDF.A1" nil)
   (princ)
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2- In line 2: "*" do not insert all page setup.&amp;nbsp;Does it only work with specific page setup?&lt;/P&gt;&lt;LI-CODE lang="general"&gt;...
 (write-line "(command "._-PSETUPIN" Yaesu.dwt "*")" scrFile)
 (write-line "PS2A " scrFile)
 (write-line "_.Autopublish  " scrFile)
 (write-line "(command)" scrFile)
 (write-line ".zoom e" scrFile)
 (write-line "_.CLOSE _Y " scrFile)
 )  &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;3-How can I incorporate Lisp-1 into lisp-2. To be able to put the values: template file, page setup at the beginning of the lisp file&lt;BR /&gt;look like&lt;/P&gt;&lt;LI-CODE lang="general"&gt;; to change to PageSetup eg:"PDF.A1" all layouts
(defun c:PS2A nil
   (SetNamePageSetupAllLayouts "PDF.A1" T)
   (princ)
)

; to change to PageSetup eg:"PDF.A1" just the active layout
(defun c:PA21 nil
   (SetNamePageSetupAllLayouts "PDF.A1" nil)
   (princ)
)&lt;/LI-CODE&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 04 Oct 2023 02:51:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-creat-script-batch-publish-multiple-file/m-p/12283254#M24857</guid>
      <dc:creator>Ar_vxv</dc:creator>
      <dc:date>2023-10-04T02:51:31Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp creat script batch publish Multiple File</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-creat-script-batch-publish-multiple-file/m-p/12283449#M24858</link>
      <description>&lt;P&gt;&lt;STRONG&gt;(SetNamePageSetupAllLayouts&lt;/STRONG&gt;&amp;nbsp;&lt;STRONG&gt;"PDF.A1" T)&lt;/STRONG&gt; works for me so I'm not sure what's not working for you.&lt;/P&gt;&lt;P&gt;Perhaps attach your&amp;nbsp;&lt;STRONG&gt;Yaesu.dwt&lt;/STRONG&gt; so I can see if you actually have a pagesetup named&amp;nbsp;&lt;STRONG&gt;PDF.A1&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Next change this:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(write-line "(command "._-PSETUPIN" Yaesu.dwt "*")" scrFile)&lt;/LI-CODE&gt;&lt;P&gt;to this:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(write-line "(command \"._-PSETUPIN\" \"Yaesu.dwt\" \"*\")" scrFile)&lt;/LI-CODE&gt;&lt;P&gt;Also change this:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(write-line "PS2A " scrFile)&lt;/LI-CODE&gt;&lt;P&gt;to this:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(write-line "(c:PS2A)" scrFile)&lt;/LI-CODE&gt;&lt;P&gt;finally the first write-line statement should be this:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(write-line "(load\"SetNamePageSetupAllLayouts\")" scrFile)&lt;/LI-CODE&gt;&lt;P&gt;Just make sure&amp;nbsp;&lt;STRONG&gt;SetNamePageSetupAllLayouts.lsp&lt;/STRONG&gt; is saved in one of the &lt;STRONG&gt;AutoCAD's Support File Search Path&lt;/STRONG&gt; &amp;amp;&amp;nbsp;&lt;STRONG&gt;Trusted Locations&lt;/STRONG&gt; so load function will work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Oct 2023 05:26:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-creat-script-batch-publish-multiple-file/m-p/12283449#M24858</guid>
      <dc:creator>paullimapa</dc:creator>
      <dc:date>2023-10-04T05:26:38Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp creat script batch publish Multiple File</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-creat-script-batch-publish-multiple-file/m-p/12283469#M24859</link>
      <description>In case some Drawings have Page setup, when loading this script&lt;BR /&gt;Page setup "PDF.A1" already exists. Redefine it? [Yes/No] &amp;lt;N&amp;gt;: *Cancel*&lt;BR /&gt;how to Yes or No for all !?</description>
      <pubDate>Wed, 04 Oct 2023 05:43:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-creat-script-batch-publish-multiple-file/m-p/12283469#M24859</guid>
      <dc:creator>Ar_vxv</dc:creator>
      <dc:date>2023-10-04T05:43:49Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp creat script batch publish Multiple File</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-creat-script-batch-publish-multiple-file/m-p/12283511#M24860</link>
      <description>&lt;P&gt;One way is to test if pagesetup &lt;STRONG&gt;PDF.A1&lt;/STRONG&gt; is already in the current dwg and only run &lt;STRONG&gt;psetupin&lt;/STRONG&gt; if it's not&amp;nbsp;&lt;/P&gt;&lt;P&gt;here's a function &lt;STRONG&gt;(get_pgsetup_lst)&lt;/STRONG&gt;&amp;nbsp;which returns a list of all pagesetup names in current dwg:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(defun get_pgsetup_lst (/ pgsob1 pgsob2)
  (setq pgsob1(cdr(assoc -1(dictsearch(namedobjdict)"ACAD_PlotSettings"))))
  (setq pgslst '())
  (while (setq pgsob2 (dictnext pgsob1 (not pgsob2)))
      (setq pgslst(cons (cdr(assoc 1 pgsob2)) pgslst))
  )
  (if(&amp;gt; (length pgslst) 1)(setq pgslst (aec_sort_lst pgslst &amp;lt;)))  
 pgslst
)&lt;/LI-CODE&gt;&lt;P&gt;&lt;SPAN&gt;you can then use this to test if &lt;STRONG&gt;"PDF.A1"&lt;/STRONG&gt; page setup is already in the dwg:&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(member "PDF.A1"(get_pgsetup_lst))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the above will return a list if &lt;STRONG&gt;"PDF.A1"&lt;/STRONG&gt; is found or nil if not.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Oct 2023 06:07:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-creat-script-batch-publish-multiple-file/m-p/12283511#M24860</guid>
      <dc:creator>paullimapa</dc:creator>
      <dc:date>2023-10-04T06:07:08Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp creat script batch publish Multiple File</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-creat-script-batch-publish-multiple-file/m-p/12288186#M24861</link>
      <description>&lt;P&gt;Hi!&lt;BR /&gt;Sorry for the late reply when I'm the one who needs help. Anyway, work still comes first.&lt;BR /&gt;I created another lisp to load the lisp you wrote: "Page SetupList"&lt;/P&gt;&lt;LI-CODE lang="general"&gt; (write-line ".Open" scrFile) 
 (write-line dwgName scrFile)
 (write-line "(load\"PageSetupList\") " scrFile)
 (write-line "(load\"PS2A-PageSetup2AllLayout\") " scrFile)
 (write-line "(member "PDF.A1"(get_pgsetup_lst))" scrFile)
 (write-line "(command \"._-PSETUPIN\" \"Yaesu.dwt\" \"*\")" scrFile)
 (write-line "(c:PS2A)" scrFile)
 (write-line "_.Autopublish  " scrFile)
 (write-line "(command)" scrFile)
 (write-line ".zoom e" scrFile)
 (write-line "_.CLOSE _Y " scrFile)
 )  
  (close scrFil)&lt;/LI-CODE&gt;&lt;P&gt;However, line No.5 is wrong. I have tried adding "\" in multiple locations. But it's all wrong. So lisp doesn't work.&lt;BR /&gt;I also noticed that you are giving me the problem to complete. Thank you for your goodwill.&lt;BR /&gt;With my little knowledge, there are definitely many mistakes.&lt;BR /&gt;if you are comfortable with your time and mind. Please look into it for me.&lt;BR /&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 05 Oct 2023 23:36:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-creat-script-batch-publish-multiple-file/m-p/12288186#M24861</guid>
      <dc:creator>Vuxvix</dc:creator>
      <dc:date>2023-10-05T23:36:33Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp creat script batch publish Multiple File</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-creat-script-batch-publish-multiple-file/m-p/12288211#M24862</link>
      <description>&lt;P&gt;**modified with updates**&lt;/P&gt;&lt;P&gt;For line 5 whenever you're writing a statement and it contains a quote " then you have to precede it with a slash \:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(write-line "(member \"PDF.A1\"(get_pgsetup_lst))" scrFile)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But instead of what you're doing I would include as much as possible inside the single lisp file such as testing if&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;"&lt;STRONG&gt;PDF.A1&lt;/STRONG&gt;" is there or not and if not then bring it in&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;:&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;STRONG&gt;PS2A-PageSetup2AllLayout.lsp&lt;/STRONG&gt;:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;; PS2A-PageSetup2AllLayout.lsp
; name - the Page Setup Name
; dwt - drawing template that contains the page setup name
; all - a flag, T for all nil for current layout
(defun SetNamePageSetupAllLayouts (name dwt all / get_pgsetup_lst lst)
 (defun get_pgsetup_lst (/ pgsob1 pgsob2)
  (setq pgsob1(cdr(assoc -1(dictsearch(namedobjdict)"ACAD_PlotSettings"))))
  (setq pgslst '())
  (while (setq pgsob2 (dictnext pgsob1 (not pgsob2)))
      (setq pgslst(cons (cdr(assoc 1 pgsob2)) pgslst))
  )
  (if(&amp;gt; (length pgslst) 1)(setq pgslst (aec_sort_lst pgslst &amp;lt;)))  
  pgslst
 ) 
 ; first test to see if pagesetup name is already in dwg
   (if(not(member name (get_pgsetup_lst)))
    (command "._-PSETUPIN" dwt name) ; if not then insert from template 
   )
   (or adoc (setq adoc (vla-get-ActiveDocument (vlax-get-acad-object))))
   (if (vl-position
          name
          (vlax-for pltcfg (vla-get-plotconfigurations adoc)
             (setq lst (cons (vlax-get pltcfg 'Name) lst))
          )
       )
      (progn
         (vlax-for layt (vla-get-Layouts adoc)
            (if (/= (vla-get-name layt) "Model")
               (if all
                  (vla-copyfrom layt (vla-item (vla-get-PlotConfigurations adoc) name))
                  (if (= (vla-get-name layt) (getvar 'ctab))
                     (vla-copyfrom layt (vla-item (vla-get-PlotConfigurations adoc) name))
                  )
               )
            )
         )
         (vla-Regen adoc acActiveViewport)
      )
   )
)


To call the main function:
; to change to PageSetup eg:"PDF.A1" all layouts
(defun c:PS2A nil
   (SetNamePageSetupAllLayouts "PDF.A1" "Yaesu.dwt" T)
   (princ)
)

; to change to PageSetup eg:"PDF.A1" just the active layout
(defun c:PA21 nil
   (SetNamePageSetupAllLayouts "PDF.A1" "Yaesu.dwt" nil)
   (princ)
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then the one that writes the script file will just need to include the following lines to load the lisp &amp;amp; run either &lt;STRONG&gt;(c:PS2A)&lt;/STRONG&gt; or &lt;STRONG&gt;(c:PS21)&lt;/STRONG&gt;:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt; (write-line ".Open" scrFile) 
 (write-line dwgName scrFile)
 (write-line "(load\"PS2A-PageSetup2AllLayout\")" scrFile)
 (write-line "(c:PS2A)" scrFile)  ; for applying name to all layouts
; (write-line "(c:PS21)" scrFile) ; for applying name to current layouts
 (write-line "_.Autopublish  " scrFile)
 (write-line "(command)" scrFile)
 (write-line ".zoom e" scrFile)
 (write-line "_.CLOSE _Y " scrFile)
 )  
  (close scrFil)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Oct 2023 00:02:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-creat-script-batch-publish-multiple-file/m-p/12288211#M24862</guid>
      <dc:creator>paullimapa</dc:creator>
      <dc:date>2023-10-06T00:02:08Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp creat script batch publish Multiple File</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-creat-script-batch-publish-multiple-file/m-p/12288331#M24863</link>
      <description>&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;1-with PS2A.lsp:　Besides, Looks sound like when opening new file via script. Load PS2A lisp need confirm "allway load/ load once/.."&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Command: PS2A
._-PSETUPIN Enter file name: ; error: bad argument value: AutoCAD command: T&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;2-With PAD.lsp:&lt;/FONT&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;Line is not needed anymore!?&lt;/FONT&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(write-line "(command \"._-PSETUPIN\" \"Yaesu.dwt\" \"*\")" scrFile)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&amp;nbsp;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Command: PAD
; error: bad argument type: streamp nil
​&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Oct 2023 01:52:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-creat-script-batch-publish-multiple-file/m-p/12288331#M24863</guid>
      <dc:creator>Vuxvix</dc:creator>
      <dc:date>2023-10-06T01:52:57Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp creat script batch publish Multiple File</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-creat-script-batch-publish-multiple-file/m-p/12288344#M24864</link>
      <description>&lt;P&gt;that error occurs because I had made a modification update to the lisp which you probably didn't pick up.&lt;/P&gt;&lt;P&gt;This line was this:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(defun SetNamePageSetupAllLayouts (name all dwt / get_pgsetup_lst lst)&lt;/LI-CODE&gt;&lt;P&gt;I changed it to this:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(defun SetNamePageSetupAllLayouts (name dwt all / get_pgsetup_lst lst)&lt;/LI-CODE&gt;&lt;P&gt;So now PSA.lsp should work properly:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;; PS2A.lsp
; name - the Page Setup Name
; all - a flag, T for all nil for current layout
;; https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-creat-script-batch-publish-multiple-file/m-p/12288211#M455772

(defun SetNamePageSetupAllLayouts (name dwt all / get_pgsetup_lst lst)
 (defun get_pgsetup_lst (/ pgsob1 pgsob2)
  (setq pgsob1(cdr(assoc -1(dictsearch(namedobjdict)"ACAD_PlotSettings"))))
  (setq pgslst '())
  (while (setq pgsob2 (dictnext pgsob1 (not pgsob2)))
      (setq pgslst(cons (cdr(assoc 1 pgsob2)) pgslst))
  )
  (if(&amp;gt; (length pgslst) 1)(setq pgslst (aec_sort_lst pgslst &amp;lt;)))  
  pgslst
 ) 
 ; first test to see if pagesetup name is already in dwg
   (if(not(member name (get_pgsetup_lst)))
    (command "._-PSETUPIN" dwt name) ; if not then insert from template 
   )
   (or adoc (setq adoc (vla-get-ActiveDocument (vlax-get-acad-object))))
   (if (vl-position
          name
          (vlax-for pltcfg (vla-get-plotconfigurations adoc)
             (setq lst (cons (vlax-get pltcfg 'Name) lst))
          )
       )
      (progn
         (vlax-for layt (vla-get-Layouts adoc)
            (if (/= (vla-get-name layt) "Model")
               (if all
                  (vla-copyfrom layt (vla-item (vla-get-PlotConfigurations adoc) name))
                  (if (= (vla-get-name layt) (getvar 'ctab))
                     (vla-copyfrom layt (vla-item (vla-get-PlotConfigurations adoc) name))
                  )
               )
            )
         )
         (vla-Regen adoc acActiveViewport)
      )
   )
)


To call the main function:
; to change to PageSetup eg:"PDF.A1" all layouts
(defun c:PS2A nil
   (SetNamePageSetupAllLayouts "PDF.A1" "Yaesu.dwt" T)
   (princ)
)

; to change to PageSetup eg:"PDF.A1" just the active layout
(defun c:PA21 nil
   (SetNamePageSetupAllLayouts "PDF.A1" "Yaesu.dwt" nil)
   (princ)
)&lt;/LI-CODE&gt;&lt;P&gt;Give it a try again.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Oct 2023 02:02:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-creat-script-batch-publish-multiple-file/m-p/12288344#M24864</guid>
      <dc:creator>paullimapa</dc:creator>
      <dc:date>2023-10-06T02:02:58Z</dc:date>
    </item>
  </channel>
</rss>

