Ok, I think this is a good one . . .

Bob Basques

Usenet Archive
Joined
Jul 7, 2003
Messages
18
Reaction score
0
All,

While this works just fine (try it in a blank drawing):

(command "_-image"
"attach"
"http://pwultra5.ci.stpaul.mn.us/cp_tiles/L4a/598000_134000_606000_142000.jpg" "598000.0000,134000.0000" 8000
0)

How would one go about validating whether or not the file on the web server exists or not. Either inside of AutoCAD or externally. It seems like there should be something available to do this seeing as how AutoCAD supports importing directly from a webserver like this, wouldn't you think?

The COMMAND function always returns "nil" for example. I also tried the "vl-cmdf" function, but it also works as it's supposed to and returns "T" everytime, I assume because the Command is ordered properly.

running things like this:

(command "_-image"
"attach"
"http://pwultra5.ci.stpaul.mn.us/"
"598000.0000,134000.0000"
8000
0)

I'm prompted to :

Enter image file name to attach :

Maybe this can be of help to match against, although I have no idea how to do that. :c)

Anyone have any ideas?

Thanks

bobb
 
The only thing I can think of is to write your own program to emulate a web browser (it's easy to do this in Perl and there are tons of examples of this). Have acad execute that program, passing it the name of the file to check for and then write the error code returned by the server to a file then have acad read that file. 404 = file not found

Just an idea. The only problem is that this,
http://pwultra5.ci.stpaul.mn.us/, returns the same code as this, http://pwultra5.ci.stpaul.mn.us/cp_tiles/L4a/598000_134000_606000_142000.jpg .. So you may want to check to make sure you are specifying an image file in acad before looking up the file on the webserver.
 
Kevin said:
The only thing I can think of is to write your own program to emulate a web browser (it's easy to do this in Perl and there are tons of examples of this). Have acad execute that program, passing it the name of the file to check for and then write the error code returned by the server to a file then have acad read that file. 404 = file not found

I can use the Activestate PERL install for this by making a package to run, it just seems like a heck of a lot of overkill to me, although the parsing would be very simple with PERL modules that are available.

Just an idea. The only problem is that this,
http://pwultra5.ci.stpaul.mn.us/, returns the same code as this, http://pwultra5.ci.stpaul.mn.us/cp_tiles/L4a/598000_134000_606000_142000.jpg . So you may want to check to make sure you are specifying an image file in acad before looking up the file on the webserver.

Well, the idea was to simply request from the server no matter what, and if it's there fine, load it into the drawing, I have this in production currently, I'm just doing a newer version with some tuning, I would like to know for instance when a Web server (or file on it) was not available for reporting to the user. Right now it just keep pluuging away, but nothing is imported, there's no way to tell the user that the data is either not available or the server is down. I just threw that shorter link in there to show that the same thing is returned,all the requests are correct and will specify a complete path/filename, it may or may not exist on the server however.

Maybe lynx on the commandline will work for this . . . . hmmm.

bobb
 
I just though of another way to do this, although it would slow down the import process to some degree. I could write a simple parser on the server as a CGI, that I can use to see if the corrcet tile exists or not. Still seems kludgy to me though.

still pondering . . . .

bobb
 
Bob, Bob, Bob:

We already showed you the GetRemoteFile method to download a file. Just use it and if the downloaded file exists, then load it up. Heck, I think it would have to be downloaded into the temporary files anyway in order to display it.

Bob Basques said:
All,

While this works just fine (try it in a blank drawing):

(command "_-image"
"attach"
"http://pwultra5.ci.stpaul.mn.us/cp_tiles/L4a/598000_134000_606000_142000.jpg" "598000.0000,134000.0000" 8000
0)

How would one go about validating whether or not the file on the web server
exists or not. Either inside of AutoCAD or
externally. It seems like there should be something available to do this
seeing as how AutoCAD supports importing
directly from a webserver like this, wouldn't you think?

The COMMAND function always returns "nil" for example. I also tried the
"vl-cmdf" function, but it also works as it's
 

Latest threads

Back
Top