Author Topic: Range Of Manipulating External Files  (Read 523 times)

0 Members and 1 Guest are viewing this topic.

Grrr1337

  • Bull Frog
  • Posts: 355
Range Of Manipulating External Files
« on: May 07, 2017, 07:18:26 am »
Hi guys,
just a simple question, regarding manipulations on files - such as changing the filename on jpeg/pdf files:

Heres the thing:
I'm auto-plotting all layouts, using the PLOT command but the output pdf has a filename format of:
<dwg name> - <layout name>
And that <dwg name> prefix is unwanted, so is there a way I can remove it?

I was thinking about a routine that could substr the file name (so the dwgname prefix would be removed) - but then my question is:
Do these files have to be located within a trusted location or I could just use getfileid or even LM:getfiles and do my thing.

I am aware of the PUBLISH command - but more curious about other alternatives.

Lee Mac

  • Seagull
  • Posts: 11781
  • AutoCAD 2015 Windows 7 London, England
Re: Range Of Manipulating External Files
« Reply #1 on: May 07, 2017, 09:16:10 am »
Why not supply the desired PDF filename to the PLOT command?

But to answer your question, vl-file-rename can operate on any type of file, in any location (with write-permission).

Lee Mac

  • Seagull
  • Posts: 11781
  • AutoCAD 2015 Windows 7 London, England
Re: Range Of Manipulating External Files
« Reply #2 on: May 07, 2017, 09:23:41 am »
Here's a quick example:
Code - Auto/Visual Lisp: [Select]
  1. (defun c:pdfall ( / *error* cmd ctb )
  2.  
  3.    (defun *error* ( msg )
  4.        (if ctb (setvar 'ctab ctb))
  5.        (if cmd (setvar 'cmdecho cmd))
  6.        (if (not (wcmatch (strcase msg t) "*break,*cancel*,*exit*"))
  7.            (princ (strcat "\nError: " msg))
  8.        )
  9.        (princ)
  10.    )
  11.  
  12.    (setq ctb (getvar 'ctab)
  13.          cmd (getvar 'cmdecho)
  14.    )
  15.    (setvar 'cmdecho 0)
  16.    (foreach lay (layoutlist)
  17.        (setvar 'ctab lay)
  18.        (command
  19.            "_.-plot"
  20.            "_Y" ;; Detailed plot configuration? [Yes/No]:
  21.            ""   ;; Enter a layout name <Current-Layout>:
  22.            "DWG To PDF.pc3" ;; Enter an output device name:
  23.            "ISO full bleed A4 (297.00 x 210.00 MM)" ;; Enter paper size:
  24.            "_M" ;; Enter paper units [Inches/Millimeters]:
  25.            "_L" ;; Enter drawing orientation [Portrait/Landscape]:
  26.            "_N" ;; Plot upside down? [Yes/No]:
  27.            "_E" ;; Enter plot area [Display/Extents/Limits/View/Window]:
  28.            "_F" ;; Enter plot scale (Plotted Inches=Drawing Units) or [Fit] <1=1>:
  29.            "_C" ;; Enter plot offset (x,y) or [Center]:
  30.            "_Y" ;; Plot with plot styles? [Yes/No]:
  31.            "monochrome.ctb" ;; Enter plot style table name (enter . for none):
  32.            "_Y" ;; Plot with lineweights? [Yes/No]:
  33.            "_N" ;; Scale lineweights with plot scale? [Yes/No]:
  34.            "_N" ;; Plot paper space first? [Yes/No]:
  35.            "_N" ;; Hide paperspace objects? [Yes/No]:
  36.            (LM:uniquefilename (strcat (getvar 'dwgprefix) lay ".pdf"))
  37.            "_N" ;; Save changes to page setup [Yes/No]:
  38.            "_Y" ;; Proceed with plot [Yes/No]:
  39.        )
  40.    )
  41.    (setvar 'ctab ctb)
  42.    (setvar 'cmdecho cmd)
  43.    (princ)
  44. )
  45.  
  46. ;; Unique Filename  -  Lee Mac
  47. ;; Returns a filename suffixed with the smallest integer required for uniqueness
  48.  
  49. (defun LM:uniquefilename ( fnm )
  50.    (if (findfile fnm)
  51.        (apply
  52.           '(lambda ( pth bse ext / tmp )
  53.                (setq tmp 1)
  54.                (while (findfile (setq fnm (strcat pth bse "(" (itoa (setq tmp (1+ tmp))) ")" ext))))
  55.            )
  56.            (fnsplitl fnm)
  57.        )
  58.    )
  59.    fnm
  60. )
  61.  

CAB

  • Global Moderator
  • Seagull
  • Posts: 10222
Re: Range Of Manipulating External Files
« Reply #3 on: May 07, 2017, 09:28:44 am »
Grrrr If your are interested in looking this is my plot routine from 2003 & updated a few times.  :)
https://www.theswamp.org/index.php?topic=1916.msg24899#msg24899
« Last Edit: May 07, 2017, 09:33:53 am by CAB »
I've reached the age where the happy hour is a nap. ()
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Grrr1337

  • Bull Frog
  • Posts: 355
Re: Range Of Manipulating External Files
« Reply #4 on: May 07, 2017, 09:41:36 am »
Thanks Lee, I'll try that out.
I did manage to figure out the alternative - which is renaming already created file:

Code - Auto/Visual Lisp: [Select]
  1. ; (TrimFileName (getfiled "Choose file to trim" "" "pdf" 0) (strcat (cadr (fnsplitl (getvar 'dwgname))) "-") )
  2. (defun TrimFileName ( filepath trimstr )
  3.  (vl-file-rename filepath
  4.    (apply
  5.      (function
  6.        (lambda ( path fnm ext )
  7.          (strcat path (vl-string-left-trim trimstr fnm) ext)
  8.        )
  9.      )
  10.      (fnsplitl filepath)
  11.    )
  12.  )
  13. ); defun TrimFileName


Code - Auto/Visual Lisp: [Select]
  1. (defun C:test ( / L trimstr )
  2.  (and
  3.    (setq L (LM:getfiles "Choose files to trim" "" "pdf"))
  4.    (setq trimstr (strcat (cadr (fnsplitl (getvar 'dwgname))) "-"))
  5.    (mapcar (function (lambda (x) (TrimFileName x trimstr))) L)
  6.  ); and
  7.  (princ)
  8. ); defun C:test

@CAB,
Thanks, I remember that PlotTabs routine - with the pretty dialog that has the CAB image in the lower right corner :)

I guess I need to revise the routines I'm actually using - since I write new and new all the time, but do not revise them.

This is what I used, now this is way off from my style of coding:
Code - Auto/Visual Lisp: [Select]
  1. ;;; Plots all layouts in the drawing:
  2.  
  3. (defun c:QuickPlotLayouts (/ oldPSLTSCALE oldLTSCALE newPSLTSCALE newLTSCALE oldBGPLT newBGPLT )
  4.  
  5.  (setq oldBGPLT (getvar 'BACKGROUNDPLOT))
  6.  (setq newBGPLT (setvar 'BACKGROUNDPLOT 0))
  7.  
  8.  (setq oldPSLTSCALE (getvar "PSLTSCALE"))
  9.  (setq oldLTSCALE (getvar "LTSCALE"))
  10.  (initget "0 1")
  11.  (setq newPSLTSCALE (getint "\nInput PSLTSCALE value <0>: "))
  12.  (if (not newPSLTSCALE) (setq newPSLTSCALE 0 ))
  13.  (initget (+ 4))
  14.  (setq newLTSCALE (getreal "\nInput LTSCALE value <1>: "))
  15.  (if (not newLTSCALE) (setq newLTSCALE 1 ))
  16.  
  17.  (foreach lay (layoutlist) ;lay = each item in the layoutlist
  18.    (setvar 'CTab lay)
  19.    (setvar "PSLTSCALE" newPSLTSCALE)
  20.    (setvar "LTSCALE" newLTSCALE)
  21.    (COMMAND  "-PLOT" "N" "" "" "" "" "N" "Y")
  22.  ); end of foreach function
  23.  
  24.  (command "CTAB" "MODEL")
  25.  (setvar 'BACKGROUNDPLOT oldBGPLT)
  26.  (setvar "PSLTSCALE" oldPSLTSCALE)
  27.  (setvar "LTSCALE" oldLTSCALE)
  28. )

Anyway I see that external files can be manipulated with the vl-file-*** functions - no matter if they are located within trusted paths or not. :)

Lee Mac

  • Seagull
  • Posts: 11781
  • AutoCAD 2015 Windows 7 London, England
Re: Range Of Manipulating External Files
« Reply #5 on: May 07, 2017, 09:47:11 am »
I did manage to figure out the alternative - which is renaming already created file:
Code - Auto/Visual Lisp: [Select]
  1. (strcat path (vl-string-left-trim trimstr fnm) ext)

Be careful with the vl-string-*-trim functions:
Code - Auto/Visual Lisp: [Select]
  1. _$ (vl-string-left-trim "ring" "ringingrings")
  2. "s"

Grrr1337

  • Bull Frog
  • Posts: 355
Re: Range Of Manipulating External Files
« Reply #6 on: May 07, 2017, 10:04:29 am »
Thanks Lee, I guess this may work a bit better:
Code - Auto/Visual Lisp: [Select]
  1. _$ (vl-string-subst "" "ring" "ringingrings")
  2. "ingrings"
But still may fail if theres no prefix to remove, but finds something to substitute in the middle of the string.

After this little task I had now I got the idea for a "filenames suffix/prefix program" - similar to your text suffix/prefix. :)
Only If I'm aware enough that windows doesn't provide such functionality.

Grrr1337

  • Bull Frog
  • Posts: 355
Re: Range Of Manipulating External Files
« Reply #7 on: May 07, 2017, 08:00:57 pm »
Anyway, might be handy for someone:

Code - Auto/Visual Lisp: [Select]
  1. ; Preffix / Suffix (trim or not) multiple filenames
  2. ; Written by Grrr
  3. ; Credits to: Lee Mac
  4. ; Requires (LM:getfiles)
  5. (defun C:test ( / tgassoc PrefixSuffixFileName *error* dcl des dch dcf ext L pref suf trimpref trimsuf )
  6.  
  7.  ; Toggle associator - connect toggle value (0 or 1) with symbol value (nil or T):
  8.  (defun tgassoc ( keyorval ) (cadr (assoc keyorval '((nil "0")(T "1")("0" nil)("1" T)))) ) ; Grrr
  9.  
  10.  ; This subfunction still has troubles: ; _$ (vl-string-left-trim "ring" "ringingrings") -> "s"
  11.  (defun PrefixSuffixFileName ( filepath trimpref pref suf trimsuf )
  12.    (vl-file-rename filepath
  13.      (apply
  14.        (function
  15.          (lambda
  16.            ( path fnm ext / nfnm )
  17.            (setq nfnm fnm)
  18.            (setq nfnm (if trimpref (vl-string-left-trim pref nfnm) (strcat pref nfnm)))
  19.            (setq nfnm (if trimsuf (vl-string-right-trim suf nfnm) (strcat nfnm suf)))
  20.            (strcat path (if (snvalid nfnm) nfnm fnm) ext)
  21.          ); lambda
  22.        ); function
  23.        (fnsplitl filepath)
  24.      ); apply
  25.    ); vl-file-rename
  26.  ); defun PrefixSuffixFileName
  27.  
  28.  (defun *error* ( msg )
  29.    (and (< 0 dch) (unload_dialog dch))
  30.    (and (eq 'FILE (type des)) (close des))
  31.    (and (eq 'STR (type dcl)) (findfile dcl) (vl-file-delete dcl))
  32.    (and msg (or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*") (princ (strcat "\nError: " msg)) ))
  33.    (princ)
  34.  ); defun *error*
  35.  
  36.  (cond
  37.    (
  38.      (not
  39.        (and (setq dcl (vl-filename-mktemp nil nil ".dcl")) (setq des (open dcl "w"))
  40.          (mapcar (function (lambda (x) (princ (strcat "\n" x) des)))
  41.            '("PrefSufFileNames : dialog "
  42.              "{ label = \"Prefix/Suffix FileNames\";"
  43.              "  : column"
  44.              "  { children_alignment = centered; children_fixed_width = true;  width = 16;"
  45.              "    : row "
  46.              "    { children_alignment = centered;"
  47.              "      : edit_box { key = \"pref\"; label = \"Prefix\"; mnemonic = \"P\"; width = 12; edit_width = 12; }"
  48.              "      : toggle { key = \"trimpref\"; label = \"Trim\"; }"
  49.              "    }"
  50.              "    : row "
  51.              "    { children_alignment = centered;"
  52.              "      : edit_box { key = \"suff\"; label = \"Suffix\"; mnemonic = \"S\"; width = 12; edit_width = 12; }"
  53.              "      : toggle { key = \"trimsuf\"; label = \"Trim\"; }"
  54.              "    }"
  55.              "    spacer;"
  56.              "    : edit_box { key = \"ext\"; label = \"Extension\"; mnemonic = \"E\"; width = 4; edit_width = 4; }"
  57.              "    : button { key = \"f\"; label = \"Choose Files >>\"; mnemonic = \"F\"; }"
  58.              "  }"
  59.              "  spacer; ok_cancel; : text { key = \"error\"; }"
  60.              "}"
  61.            ); list
  62.          ); mapcar
  63.          (not (setq des (close des))) (< 0 (setq dch (load_dialog dcl)))
  64.        ); and
  65.      ); not
  66.      (princ "\nUnable to write or load the DCL file.")
  67.    )
  68.    ( (not (new_dialog "PrefSufFileNames" dch)) (princ "\nUnable to display the dialog") )
  69.    (
  70.      (progn
  71.        (action_tile "ext" "(setq ext $value)")
  72.        (action_tile "f"
  73.          (vl-prin1-to-string
  74.            '(cond
  75.              ( (or (= "" ext) (not ext)) (set_tile "error" "Please Specify file extension.") (mode_tile "ext" 2) )
  76.              (T (set_tile "error" "") (setq L (LM:getfiles "Choose files to trim" "" ext)) )
  77.            ); cond
  78.          ); vl-prin1-to-string
  79.        ); action_tile "f"
  80.        (action_tile "accept"
  81.          (vl-prin1-to-string
  82.            '(cond
  83.              ( (not L)
  84.                (cond
  85.                  ( (or (= "" ext) (not ext)) (set_tile "error" "Please Specify file extension.") (mode_tile "ext" 2) )
  86.                  (T (set_tile "error" "Please Specify Files To Rename.") (mode_tile "f" 2) )
  87.                ); cond
  88.              )
  89.              (T (mapcar 'set '(pref suf) (mapcar 'get_tile '("pref" "suff")))
  90.                (mapcar 'set '(trimpref trimsuf) (mapcar 'tgassoc (mapcar 'get_tile '("trimpref" "trimsuf"))))
  91.                (done_dialog 1)
  92.              )
  93.            ); cond
  94.          ); vl-prin1-to-string
  95.        ); action_tile
  96.        (/= 1 (setq dcf (start_dialog)))
  97.      ); progn
  98.      (princ "\nUser cancelled the dialog.")
  99.    )
  100.    (L (mapcar (function (lambda (x) (PrefixSuffixFileName x trimpref pref suf trimsuf))) L) )
  101.  ); cond
  102.  (*error* nil) (princ)
  103. ); defun  

Man I was wondering about something, and ended up with something else completely different.

EDIT: Uploaded new version - with trim options, the PrefixSuffixFileName subfunction is not perfect as Lee mentioned.
« Last Edit: May 08, 2017, 06:12:16 am by Grrr1337 »

OlayRivera

  • Mosquito
  • Posts: 1
Re: Range Of Manipulating External Files
« Reply #8 on: July 15, 2017, 02:37:41 am »
Here's a quick example:
Code - Auto/Visual Lisp: [Select]
  1. (defun c:pdfall ( / *error* cmd ctb )
  2.  
  3.    (defun *error* ( msg )
  4.        (if ctb (setvar 'ctab ctb))
  5.        (if cmd (setvar 'cmdecho cmd))
  6.        (if (not (wcmatch (strcase msg t) "*break,*cancel*,*exit*"))
  7.            (princ (strcat "\nError: " msg))
  8.        )
  9.        (princ)
  10.    )
  11.  
  12.    (setq ctb (getvar 'ctab)
  13.          cmd (getvar 'cmdecho)
  14.    )
  15.    (setvar 'cmdecho 0)
  16.    (foreach lay (layoutlist)
  17.        (setvar 'ctab lay)
  18.        (command
  19.            "_.-plot"
  20.            "_Y" ;; Detailed plot configuration? [Yes/No]:
  21.            ""   ;; Enter a layout name <Current-Layout>:
  22.            "DWG To PDF.pc3" ;; Enter an output device name:
  23.            "ISO full bleed A4 (297.00 x 210.00 MM)" ;; Enter paper size:
  24.            "_M" ;; Enter paper units [Inches/Millimeters]:
  25.            "_L" ;; Enter drawing orientation [Portrait/Landscape]:
  26.            "_N" ;; Plot upside down? [Yes/No]:
  27.            "_E" ;; Enter plot area [Display/Extents/Limits/View/Window]:
  28.            "_F" ;; Enter plot scale (Plotted Inches=Drawing Units) or [Fit] <1=1>:
  29.            "_C" ;; Enter plot offset (x,y) or [Center]:
  30.            "_Y" ;; Plot with plot styles? [Yes/No]:
  31.            "monochrome.ctb" ;; Enter plot style table name (enter . for none):
  32.            "_Y" ;; Plot with lineweights? [Yes/No]:
  33.            "_N" ;; Scale lineweights with plot scale? [Yes/No]:
  34.            "_N" ;; Plot paper space first? [Yes/No]:
  35.            "_N" ;; Hide paperspace objects? [Yes/No]:
  36.            (LM:uniquefilename (strcat (getvar 'dwgprefix) lay ".pdf"))
  37.            "_N" ;; Save changes to page setup [Yes/No]:
  38.            "_Y" ;; Proceed with plot [Yes/No]:
  39.        )
  40.    )
  41.    (setvar 'ctab ctb)
  42.    (setvar 'cmdecho cmd)
  43.    (princ)
  44. )
  45.  
  46. ;; Unique Filename  -  Lee Mac
  47. ;; Returns a filename suffixed with the smallest integer required for uniqueness
  48.  
  49. (defun LM:uniquefilename ( fnm )
  50.    (if (findfile fnm)
  51.        (apply
  52.           '(lambda ( pth bse ext / tmp )
  53.                (setq tmp 1)
  54.                (while (findfile (setq fnm (strcat pth bse "(" (itoa (setq tmp (1+ tmp))) ")" ext))))
  55.            )
  56.            (fnsplitl fnm)
  57.        )
  58.    )
  59.    fnm
  60. )
  61.  


Hello...
with this code, how to change paper size to A3, because i wanted to change it to A3?
 "ISO full bleed A4 (297.00 x 210.00 MM)" ;; Enter paper size:

Lee Mac

  • Seagull
  • Posts: 11781
  • AutoCAD 2015 Windows 7 London, England
Re: Range Of Manipulating External Files
« Reply #9 on: July 15, 2017, 07:33:59 am »
with this code, how to change paper size to A3, because i wanted to change it to A3?
 "ISO full bleed A4 (297.00 x 210.00 MM)" ;; Enter paper size:

Simply change "ISO full bleed A4 (297.00 x 210.00 MM)" to one of the other paper sizes offered by the DWG To PDF.pc3 device, e.g. "ISO A3 (420.00 x 297.0MM)"

JAY

  • Newt
  • Posts: 105
Re: Range Of Manipulating External Files
« Reply #10 on: July 16, 2017, 09:12:11 pm »
Anyway, might be handy for someone:

Code - Auto/Visual Lisp: [Select]
  1. ; Preffix / Suffix (trim or not) multiple filenames
  2. ; Written by Grrr
  3. ; Credits to: Lee Mac
  4. ; Requires (LM:getfiles)
  5. (defun C:test ( / tgassoc PrefixSuffixFileName *error* dcl des dch dcf ext L pref suf trimpref trimsuf )
  6.  
  7.  ; Toggle associator - connect toggle value (0 or 1) with symbol value (nil or T):
  8.  (defun tgassoc ( keyorval ) (cadr (assoc keyorval '((nil "0")(T "1")("0" nil)("1" T)))) ) ; Grrr
  9.  
  10.  ; This subfunction still has troubles: ; _$ (vl-string-left-trim "ring" "ringingrings") -> "s"
  11.  (defun PrefixSuffixFileName ( filepath trimpref pref suf trimsuf )
  12.    (vl-file-rename filepath
  13.      (apply
  14.        (function
  15.          (lambda
  16.            ( path fnm ext / nfnm )
  17.            (setq nfnm fnm)
  18.            (setq nfnm (if trimpref (vl-string-left-trim pref nfnm) (strcat pref nfnm)))
  19.            (setq nfnm (if trimsuf (vl-string-right-trim suf nfnm) (strcat nfnm suf)))
  20.            (strcat path (if (snvalid nfnm) nfnm fnm) ext)
  21.          ); lambda
  22.        ); function
  23.        (fnsplitl filepath)
  24.      ); apply
  25.    ); vl-file-rename
  26.  ); defun PrefixSuffixFileName
  27.  
  28.  (defun *error* ( msg )
  29.    (and (< 0 dch) (unload_dialog dch))
  30.    (and (eq 'FILE (type des)) (close des))
  31.    (and (eq 'STR (type dcl)) (findfile dcl) (vl-file-delete dcl))
  32.    (and msg (or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*") (princ (strcat "\nError: " msg)) ))
  33.    (princ)
  34.  ); defun *error*
  35.  
  36.  (cond
  37.    (
  38.      (not
  39.        (and (setq dcl (vl-filename-mktemp nil nil ".dcl")) (setq des (open dcl "w"))
  40.          (mapcar (function (lambda (x) (princ (strcat "\n" x) des)))
  41.            '("PrefSufFileNames : dialog "
  42.              "{ label = \"Prefix/Suffix FileNames\";"
  43.              "  : column"
  44.              "  { children_alignment = centered; children_fixed_width = true;  width = 16;"
  45.              "    : row "
  46.              "    { children_alignment = centered;"
  47.              "      : edit_box { key = \"pref\"; label = \"Prefix\"; mnemonic = \"P\"; width = 12; edit_width = 12; }"
  48.              "      : toggle { key = \"trimpref\"; label = \"Trim\"; }"
  49.              "    }"
  50.              "    : row "
  51.              "    { children_alignment = centered;"
  52.              "      : edit_box { key = \"suff\"; label = \"Suffix\"; mnemonic = \"S\"; width = 12; edit_width = 12; }"
  53.              "      : toggle { key = \"trimsuf\"; label = \"Trim\"; }"
  54.              "    }"
  55.              "    spacer;"
  56.              "    : edit_box { key = \"ext\"; label = \"Extension\"; mnemonic = \"E\"; width = 4; edit_width = 4; }"
  57.              "    : button { key = \"f\"; label = \"Choose Files >>\"; mnemonic = \"F\"; }"
  58.              "  }"
  59.              "  spacer; ok_cancel; : text { key = \"error\"; }"
  60.              "}"
  61.            ); list
  62.          ); mapcar
  63.          (not (setq des (close des))) (< 0 (setq dch (load_dialog dcl)))
  64.        ); and
  65.      ); not
  66.      (princ "\nUnable to write or load the DCL file.")
  67.    )
  68.    ( (not (new_dialog "PrefSufFileNames" dch)) (princ "\nUnable to display the dialog") )
  69.    (
  70.      (progn
  71.        (action_tile "ext" "(setq ext $value)")
  72.        (action_tile "f"
  73.          (vl-prin1-to-string
  74.            '(cond
  75.              ( (or (= "" ext) (not ext)) (set_tile "error" "Please Specify file extension.") (mode_tile "ext" 2) )
  76.              (T (set_tile "error" "") (setq L (LM:getfiles "Choose files to trim" "" ext)) )
  77.            ); cond
  78.          ); vl-prin1-to-string
  79.        ); action_tile "f"
  80.        (action_tile "accept"
  81.          (vl-prin1-to-string
  82.            '(cond
  83.              ( (not L)
  84.                (cond
  85.                  ( (or (= "" ext) (not ext)) (set_tile "error" "Please Specify file extension.") (mode_tile "ext" 2) )
  86.                  (T (set_tile "error" "Please Specify Files To Rename.") (mode_tile "f" 2) )
  87.                ); cond
  88.              )
  89.              (T (mapcar 'set '(pref suf) (mapcar 'get_tile '("pref" "suff")))
  90.                (mapcar 'set '(trimpref trimsuf) (mapcar 'tgassoc (mapcar 'get_tile '("trimpref" "trimsuf"))))
  91.                (done_dialog 1)
  92.              )
  93.            ); cond
  94.          ); vl-prin1-to-string
  95.        ); action_tile
  96.        (/= 1 (setq dcf (start_dialog)))
  97.      ); progn
  98.      (princ "\nUser cancelled the dialog.")
  99.    )
  100.    (L (mapcar (function (lambda (x) (PrefixSuffixFileName x trimpref pref suf trimsuf))) L) )
  101.  ); cond
  102.  (*error* nil) (princ)
  103. ); defun  

Man I was wondering about something, and ended up with something else completely different.

EDIT: Uploaded new version - with trim options, the PrefixSuffixFileName subfunction is not perfect as Lee mentioned.


Hi Grrr1337

Can you upload a Gif demo ?

Grrr1337

  • Bull Frog
  • Posts: 355
Re: Range Of Manipulating External Files
« Reply #11 on: July 17, 2017, 05:18:44 am »
Hi Grrr1337

Can you upload a Gif demo ?

Yeah.. my demo kinda sucks, sorry:


MSTG007

  • Water Moccasin
  • Posts: 2007
  • I can't remeber what I already asked! I need help!
Re: Range Of Manipulating External Files
« Reply #12 on: July 17, 2017, 07:23:15 am »
That turned out to be a pretty good routine. Sure beats doing each one manually. Great job!
Autodesk Infrastructure Design Suite 2017

JAY

  • Newt
  • Posts: 105
Re: Range Of Manipulating External Files
« Reply #13 on: July 17, 2017, 08:53:07 pm »
Hi Grrr1337

Can you upload a Gif demo ?

Yeah.. my demo kinda sucks, sorry:




Hi Grrr
Thanks for sharing . Great job!
« Last Edit: July 18, 2017, 08:56:12 am by Mark »