Author Topic: Copy jpg to folder with vl-file-copy?  (Read 7277 times)

0 Members and 1 Guest are viewing this topic.

KewlToyZ

  • Guest
Copy jpg to folder with vl-file-copy?
« on: June 09, 2006, 12:12:39 PM »
I'm trying to copy an image file to a project folder automatically within an autolisp routine.
I found a few references to vl-file-copy used but it seems to return "nil" when i try the static file and folder paths.
(defun c:logocopy()
(vl-file-copy "X:\\logo.jpg" "X:\\A\\A0001\\Logos")
)

playing around with it i also tried:

   (defun c:logocopy()
   (setq logo2logos (getfiled "Logo File Import" "X:\\logo.jpg" "jpg" 2))
   (vl-file-copy logo2logos "X:\\A\\A0001\\Logos\\" T)
   )

still got nil
I'm not finding the vl-file-copy in AutoCAD help very clear on its ability to handle image files over a network.
Any direction would be appreciated, Thank you :)

Bob Wahr

  • Guest
Re: Copy jpg to folder with vl-file-copy?
« Reply #1 on: June 09, 2006, 12:25:37 PM »
Code: [Select]
(defun c:test()
  (command "sh")
  (command "copy x:\logo.jpg x:\a\0001\logos")
)
?

Bob Wahr

  • Guest
Re: Copy jpg to folder with vl-file-copy?
« Reply #2 on: June 09, 2006, 12:31:09 PM »
As far as I can see,
Code: [Select]
(defun c:logocopy()
(vl-file-copy "X:\\logo.jpg" "X:\\A\\A0001\\Logos")
)
should work.  Are you sure that the file exists in that location and that the destination folder exists?

Bob Wahr

  • Guest
Re: Copy jpg to folder with vl-file-copy?
« Reply #3 on: June 09, 2006, 12:33:03 PM »
wait, try
Code: [Select]
defun c:logocopy()
(vl-file-copy "X:\\logo.jpg" "X:\\A\\A0001\\Logos\\logo.jpg")
)

KewlToyZ

  • Guest
Re: Copy jpg to folder with vl-file-copy?
« Reply #4 on: June 09, 2006, 12:44:40 PM »
Code: [Select]
(defun c:test()
  (command "sh")
  (command "copy x:\logo.jpg x:\a\0001\logos")
)
?

I was hoping for it to be this simple but it lists "copy x:\logo.jpg x:\a\0001\logos" as an unkown command
Of course adding "" to each component   (command "copy" "x:\logo.jpg" "x:\a\0001\logos") brings up autocad's copy command so this isn't the right course either.
Removing the quotes all together (command copy x:\logo.jpg x:\a\0001\logos)
Returns nil again so I am back to square one lol.

KewlToyZ

  • Guest
Re: Copy jpg to folder with vl-file-copy?
« Reply #5 on: June 09, 2006, 12:48:58 PM »
That was my first attempt and I keep getting a nil.
Which was wy I tried the getfiled to make sure i found the file.
I'm trying to use CAD to place the logo file since the web interface seems to fail arbitrarily on folders over the network.
All have the same permissions but for some reason it misses this image file periodically.
I was hoping a simple lisp routine would help but this is proving strange as well.

KewlToyZ

  • Guest
Re: Copy jpg to folder with vl-file-copy?
« Reply #6 on: June 09, 2006, 12:52:26 PM »
That was my first attempt and I keep getting a nil.
Which was wy I tried the getfiled to make sure i found the file.
I'm trying to use CAD to place the logo file since the web interface seems to fail arbitrarily on folders over the network.
All have the same permissions but for some reason it misses this image file periodically.
I was hoping a simple lisp routine would help but this is proving strange as well.

I forgot the command "sh" to bring up the OS command.
My bad and thank you for the help!

Bob Wahr

  • Guest
Re: Copy jpg to folder with vl-file-copy?
« Reply #7 on: June 09, 2006, 01:00:51 PM »
Glad that fixed you up.  I'm sure that someone who can lisp will be along in the very near future to tell you how to get vl-file-copy to work or why you shouldn't use it and what you should use instead.

KewlToyZ

  • Guest
Re: Copy jpg to folder with vl-file-copy?
« Reply #8 on: June 09, 2006, 01:08:07 PM »
Yes it works well alone but when I try to make the paths defined by the session it doesnt activate within another routine.
I was trying to integrate it with the drawing setup routine the guys here helped me overwhelmingly with.
I'm going to keep playing with it, but I think that the OS command seems not to recognize a variable as a path.
Or I am hust completely failing to structure it properly which is more likely.

KewlToyZ

  • Guest
Re: Copy jpg to folder with vl-file-copy?
« Reply #9 on: June 09, 2006, 01:16:24 PM »
Yes it works well alone but when I try to make the paths defined by the session it doesnt activate within another routine.
I was trying to integrate it with the drawing setup routine the guys here helped me overwhelmingly with.
I'm going to keep playing with it, but I think that the OS command seems not to recognize a variable as a path.
Or I am hust completely failing to structure it properly which is more likely.

It tries to pass the variable path as a command instead of a path.

  (setq idx (vl-string-search "CADD" prefx))
  (setq baseprefix (strcat (substr prefx 1 (+ 5 idx)) "XREF\\"))
  (command "sh")
  (command "copy X:\\logo.jpg" baseprefix))
--------------------------------------------------------------------------------------------
Command: Unkown command "X:\A\A9999\CADD\XREF\" Press F1 for help.
nil

Command:|
-----------------------------------------------------------------------------------
Is where I end up

uncoolperson

  • Guest
Re: Copy jpg to folder with vl-file-copy?
« Reply #10 on: June 09, 2006, 01:22:36 PM »
wait, try
Code: [Select]
defun c:logocopy()
(vl-file-copy "X:\\logo.jpg" "X:\\A\\A0001\\Logos\\logo.jpg")
)


this should be working, if it isn't take a look and make sure the file isn't already there (in the target directory), if it is delete it and try again

Bob Wahr

  • Guest
Re: Copy jpg to folder with vl-file-copy?
« Reply #11 on: June 09, 2006, 01:34:51 PM »
What happens if
Code: [Select]
 (setq idx (vl-string-search "CADD" prefx))
  (setq baseprefix (strcat (substr prefx 1 (+ 5 idx)) "XREF\\"))
  (setq cmdline ( "sh copy x:\\logo.jpg" baseprefix)
;my lisp is weak and lacks leverage but I believe that the above line sets cmdline to
;"sh copy x:\\logo.jpg x:\\a\\a9999\cadd\xref\
  (command cmdline)

***starts looking around desperately for a lisper to step in***

woot!  UCP to the rescue.

KewlToyZ

  • Guest
Re: Copy jpg to folder with vl-file-copy?
« Reply #12 on: June 09, 2006, 01:45:24 PM »
wait, try
Code: [Select]
defun c:logocopy()
(vl-file-copy "X:\\logo.jpg" "X:\\A\\A0001\\Logos\\logo.jpg")
)


this should be working, if it isn't take a look and make sure the file isn't already there (in the target directory), if it is delete it and try again

No the file never made it there with this, I have no idea why.

KewlToyZ

  • Guest
Re: Copy jpg to folder with vl-file-copy?
« Reply #13 on: June 09, 2006, 01:50:30 PM »
What happens if
Code: [Select]
 (setq idx (vl-string-search "CADD" prefx))
  (setq baseprefix (strcat (substr prefx 1 (+ 5 idx)) "XREF\\"))
  (setq cmdline ( "sh copy x:\\logo.jpg" baseprefix)
;my lisp is weak and lacks leverage but I believe that the above line sets cmdline to
;"sh copy x:\\logo.jpg x:\\a\\a9999\cadd\xref\
  (command cmdline)

***starts looking around desperately for a lisper to step in***

woot!  UCP to the rescue.

Nice attempt, I played with this awhile but without command SH doesnt recognize.

KewlToyZ

  • Guest
Re: Copy jpg to folder with vl-file-copy?
« Reply #14 on: June 09, 2006, 02:29:02 PM »
Code: [Select]
  (setq idx (vl-string-search "CADD" prefx))
  (setq baseprefix (strcat (substr prefx 1 (+ 5 idx)) "XREF\\"))
  (command "sh")
  (command "copy X:\\logo.jpg baseprefix" ))

I went back with this above.
It opens the folder with windows explorer for the baseprefix but doesn't copy the file strangely enough.