DPlot Forum Index DPlot
http://www.dplot.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Another shell issue/question

 
Post new topic   Reply to topic    DPlot Forum Index -> Suggestions/Questions
View previous topic :: View next topic  
Author Message
russurquhart1



Joined: 18 Nov 2009
Posts: 14

PostPosted: Fri Jan 15, 2010 4:15 pm    Post subject: Another shell issue/question Reply with quote

My updated macro is as follows:

VAR_A=Request("path")
VAR_B=Request("fname")
FileSaveAs(1,"VAR_AVAR_B.grf")
FileSaveAs("Graphics Interchange Format","VAR_AVAR_B.gif")

' Shell("C:\Program Files\epstool\bin\epstool.exe --copy -bbox VAR_AVAR_B_old.eps VAR_AVAR_B.eps", 3)

Pause


Everything works except the Shell command. I am just trying to call epstool to readjust the bounding box for the given eps file. It seems to error out, but the window either closes too quickly or doesn't open at all.

Any ideas or ways to get the window to stay open?

Thanks,


Russ
Back to top
View user's profile Send private message
raswaim



Joined: 06 Jan 2005
Posts: 69
Location: Houston, TX

PostPosted: Fri Jan 15, 2010 4:31 pm    Post subject: Reply with quote

Russ - maybe it's just a transcription error in your message, but aren't you missing a leading dash for the "--bbox" option? - R
_________________
- RAS
Back to top
View user's profile Send private message
russurquhart1



Joined: 18 Nov 2009
Posts: 14

PostPosted: Fri Jan 15, 2010 4:45 pm    Post subject: Reply with quote

Yes your right. I have that in mine. If i didn't i should at least get an error.
Back to top
View user's profile Send private message
raswaim



Joined: 06 Jan 2005
Posts: 69
Location: Houston, TX

PostPosted: Fri Jan 15, 2010 5:06 pm    Post subject: Reply with quote

Well it's not suitable for production, but for debugging you might try pre-pending "cmd /k" to your command to see if it keeps a window open for you to diagnose the issue. As in:

Shell("cmd /k C:\Program Files\eps......
_________________
- RAS
Back to top
View user's profile Send private message
russurquhart1



Joined: 18 Nov 2009
Posts: 14

PostPosted: Fri Jan 15, 2010 5:12 pm    Post subject: Reply with quote

Well, that kept the window open, now i see:

'C:\Program' is not recognized as an internal or external command
operable program or batch file.

So this must be something with the quoting of the operands, right?
Back to top
View user's profile Send private message
raswaim



Joined: 06 Jan 2005
Posts: 69
Location: Houston, TX

PostPosted: Fri Jan 15, 2010 5:27 pm    Post subject: Reply with quote

I think you may be in luck. Try:

Shell("C:\Progra~1\epstool\bin\epstool.exe .....
_________________
- RAS
Back to top
View user's profile Send private message
russurquhart1



Joined: 18 Nov 2009
Posts: 14

PostPosted: Fri Jan 15, 2010 5:34 pm    Post subject: Reply with quote

I'm getting further:

Failed to open "VAR_AVAR_B_old.eps".
Run "epstool --help" for more details.

It seems the expansion of the variables VAR_A and VAR_B don't seem to be happening.

Should there be some quoting around them?

Thanks,


Russ
Back to top
View user's profile Send private message
raswaim



Joined: 06 Jan 2005
Posts: 69
Location: Houston, TX

PostPosted: Fri Jan 15, 2010 5:55 pm    Post subject: Reply with quote

Okay you got me now... David will have to explain if there's a way for you to do variable substitution into a quoted command line.

BTW - I notice that there's another option for getting around the "spaces in path" issue that David implemented. If you use the format
Shell("cmd /k "C:\Program Files\epstool\bin\epstool.exe" <options>",3) it should work also (at least in the most recent releases).
_________________
- RAS
Back to top
View user's profile Send private message
russurquhart1



Joined: 18 Nov 2009
Posts: 14

PostPosted: Fri Jan 15, 2010 5:57 pm    Post subject: Reply with quote

I had some problems with the double quotes working for me.

I had tried that and may have to again for something else.

Thanks,

Russ
Back to top
View user's profile Send private message
DPlotAdmin
Site Admin


Joined: 24 Jun 2003
Posts: 2311
Location: Vicksburg, Mississippi

PostPosted: Fri Jan 15, 2010 6:03 pm    Post subject: Reply with quote

"It seems the expansion of the variables VAR_A and VAR_B don't seem to be happening."

Whoops. That's exactly right. The expansion happens just before a command is sent to DPlot. But Shell is handled entirely within the macro editor, never passed to DPlot, and the expansion never takes place. This is fixed on my system and will be in the next release. Sorry for the trouble.
_________________
Visualize Your Data
support@dplot.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
DPlotAdmin
Site Admin


Joined: 24 Jun 2003
Posts: 2311
Location: Vicksburg, Mississippi

PostPosted: Fri Jan 15, 2010 6:07 pm    Post subject: Reply with quote

PS: EPSTOOL sounds like it might be of interest to many DPlot users, but the links at http://pages.cs.wisc.edu/~ghost/gsview/epstool.htm don't work. Do you know of another source?
_________________
Visualize Your Data
support@dplot.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
raswaim



Joined: 06 Jan 2005
Posts: 69
Location: Houston, TX

PostPosted: Fri Jan 15, 2010 6:19 pm    Post subject: Reply with quote

Hmmm - Transient condition? I just downloaded the Windows zip file from there a couple minutes ago.....
_________________
- RAS
Back to top
View user's profile Send private message
DPlotAdmin
Site Admin


Joined: 24 Jun 2003
Posts: 2311
Location: Vicksburg, Mississippi

PostPosted: Fri Jan 15, 2010 6:44 pm    Post subject: Reply with quote

Huh. That's odd. Didn't work for me just now. But if you got it then it must be a glitch rather than a permanent problem. I'll try again later.

For those who have used this, as I assume the two of you have, does this fix the problem that "printing" to an EPS file has - namely that the entire page including white space is included? If so I think a lot of LaTeX users will be interested in this.
_________________
Visualize Your Data
support@dplot.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
raswaim



Joined: 06 Jan 2005
Posts: 69
Location: Houston, TX

PostPosted: Fri Jan 15, 2010 9:08 pm    Post subject: Reply with quote

I can confirm that there's some sort of server issue... The page links to an ftp server; I can login anonymously and go to the file directory, but can't keep a link up to retrieve the file. Guess I was just lucky the first couple times. Maybe it will get better....

Can't comment on the epstool utility yet; it looked interesting to me also and I thought I'd try to help Russ out a bit for leading me to it... The zip file contains source as well as a binary, and a copy of a GPL. This version (3.0Cool appears to have been built in 2005.
_________________
- RAS
Back to top
View user's profile Send private message
raswaim



Joined: 06 Jan 2005
Posts: 69
Location: Houston, TX

PostPosted: Fri Jan 15, 2010 9:11 pm    Post subject: Reply with quote

Hmmm - I was going for "3.08" in the last post; not sure where the smiley face came from....
_________________
- RAS
Back to top
View user's profile Send private message
jsc



Joined: 02 Dec 2005
Posts: 222

PostPosted: Fri Jan 15, 2010 9:17 pm    Post subject: Reply with quote

Here's a mirror in Switzerland (?) that worked:

ftp://mirror.switch.ch/pool/1/mirror/ghost/ghostgum/epstool-3.08-win32.zip
Back to top
View user's profile Send private message
DPlotAdmin
Site Admin


Joined: 24 Jun 2003
Posts: 2311
Location: Vicksburg, Mississippi

PostPosted: Fri Jan 15, 2010 11:05 pm    Post subject: Reply with quote

Thanks Richard and Jon. Got it.

Unless I badly misunderstand something, though, this doesn't do what I had hoped for. Perhaps russurquhart1 can chime in here and straighten me out.

The Shell command
C:\Program Files\epstool\bin\epstool.exe --copy -bbox VAR_AVAR_B_old.eps VAR_AVAR_B.eps

seems to rely on the existence of a previously saved eps file (the _old suffix), which has not been produced by any of the previous commands in the macro. So I'm not sure what this is all about. If I save an EPS file by printing to a file with an EPS printer driver, then go to the command line and use

epstool.exe --copy -bbox oldfile.eps newfile.eps

I get "oldfile.eps is not EPSF" and no newfile.eps produced. So I'm not sure what the purpose of this stuff is. Any clues would be appreciated. Again, it would be a boon to DPlot users to be able to produce EPS files that don't include the whole printed page of white space, as you get by "printing" to an EPS file.
_________________
Visualize Your Data
support@dplot.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
raswaim



Joined: 06 Jan 2005
Posts: 69
Location: Houston, TX

PostPosted: Sat Jan 16, 2010 11:32 am    Post subject: Reply with quote

David - my system wasn't all setup to use this, but when I downloaded a recent copy of gswin32c.exe and put it where the epstool could find it, I got it to run. It gave me several complaints about the eps file I fed it, but in the end it generated a file with what looks like an "appropriate" bounding box (at least it looks right in GSview). I'll send samples to your e-mail. -Richard
_________________
- RAS
Back to top
View user's profile Send private message
DPlotAdmin
Site Admin


Joined: 24 Jun 2003
Posts: 2311
Location: Vicksburg, Mississippi

PostPosted: Sat Jan 16, 2010 12:20 pm    Post subject: Reply with quote

Got your files, Richard. Thanks very much. This is exactly what I was hoping it would do. I don't have it working yet - so far all of my attempts at getting packages for Win32 containing gswin32c.exe have resulted in "not a valid Win32 application". What is it with *nix people? Smile
_________________
Visualize Your Data
support@dplot.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
DPlotAdmin
Site Admin


Joined: 24 Jun 2003
Posts: 2311
Location: Vicksburg, Mississippi

PostPosted: Sun Jan 17, 2010 3:42 pm    Post subject: Reply with quote

Mostly for russurquhart1:
I'm not ready to release the full version, but there's no reason to wait for the fixed macro gizmo. Download http://www.dplot.com/macros/dpmac.exe to <dplot folder>\macros, replacing the existing version.
_________________
Visualize Your Data
support@dplot.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
russurquhart1



Joined: 18 Nov 2009
Posts: 14

PostPosted: Mon Jan 18, 2010 9:43 am    Post subject: Reply with quote

Thanks David, i'll give that a try.

What we do, or will do, is that the PS output of a Dplot graph, run that through Ghostscript to generate the EPS file. Now, for us, for some reason, the bounding box generated in that step is incorrect, to i take the new eps file and use epstool, to copy the EPS file on through, but put in a new bounding box. This seems to work.

Thanks


Russ
Back to top
View user's profile Send private message
russurquhart1



Joined: 18 Nov 2009
Posts: 14

PostPosted: Mon Jan 18, 2010 1:01 pm    Post subject: Reply with quote

Getting further:

I have the following:

Shell(""cmd /k C:\Progra~1\epstool\bin\epstool.exe" --copy --bbox VAR_AVAR_B_old.eps VAR_AVAR_B.eps", 3)

Which i think should work, but i get a file not found error.

When i have:

Shell("cmd /k C:\Progra~1\epstool\bin\epstool.exe --copy --bbox VAR_AVAR_B_old.eps VAR_AVAR_B.eps", 3)

it blows up because the path spec has a C:\Program Files, and the epstool command line thinks i am trying to pass C:\Program.

How should i quote this to get the full expansion, which IS working, to be processed by the command line?

Thanks,


Russ
Back to top
View user's profile Send private message
DPlotAdmin
Site Admin


Joined: 24 Jun 2003
Posts: 2311
Location: Vicksburg, Mississippi

PostPosted: Mon Jan 18, 2010 1:24 pm    Post subject: Reply with quote

I've had very little luck with EPSTOOL yet. Richard provided a link to other files that I need, but I haven't had time to check those yet. But off the top of my head and w/o testing this, this:

Shell("cmd /k "C:\Program Files\epstool\bin\epstool.exe" --copy --bbox VAR_AVAR_B_old.eps VAR_AVAR_B.eps", 3)

should work. Or at least give you a different error message Smile. Sorry I can't give a more definitive reply, yet.

If the path returned by VAR_A=Request("path") or VAR_B=Request("fname") contains spaces, then you might need something like:

Shell("cmd /k "C:\Program Files\epstool\bin\epstool.exe" --copy --bbox "VAR_AVAR_B_old.eps" "VAR_AVAR_B.eps"", 3)

but I can't swear to that. So far all I've gotten is error messages related to missing DLL's and whatnot, not an error related to the filenames.
_________________
Visualize Your Data
support@dplot.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
russurquhart1



Joined: 18 Nov 2009
Posts: 14

PostPosted: Mon Jan 18, 2010 2:14 pm    Post subject: Reply with quote

Well here are the two lines i tried:

Shell("cmd /k "C:\Program Files\epstool\bin\epstool.exe" --copy --bbox "VAR_AVAR_B_old.eps" "VAR_AVAR_B.eps"", 3)


Shell("cmd /k "C:\epstool.exe" --copy --bbox "VAR_AVAR_B_old.eps" "VAR_AVAR_B.eps"", 3)

The first line gives an error because it thinks C:\Program is an executable it can't find.

The second line gives an error just saying the file/pathspec/volume label is not right.

I think there still is an issue with what type of quotes need to go around the var expansion.

When i try without any qoutes around the vars, it errors because the path spec has a space.

any help is appreciated!

Thanks,


Russ
Back to top
View user's profile Send private message
DPlotAdmin
Site Admin


Joined: 24 Jun 2003
Posts: 2311
Location: Vicksburg, Mississippi

PostPosted: Mon Jan 18, 2010 2:47 pm    Post subject: Reply with quote

This is of course no help for the general public, but if you move the epstool files to a folder whose name does NOT contain spaces, and do the same for the input/output eps files, what happens then? My guess is it will work.

I'll make an effort to spend some time on this in the next few days, once I get all of the epstool-associated files I need.
_________________
Visualize Your Data
support@dplot.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
russurquhart1



Joined: 18 Nov 2009
Posts: 14

PostPosted: Tue Jan 19, 2010 11:27 am    Post subject: Reply with quote

Some more info, hopefully this will help.

The Dplot file i am working on, G001_LOS600.grf is located on my desktop, C:\Documents and Settings\x0047930\Desktop\G001_LOS600.grf.

I want to tell epstools, from the dplot macro editor the equivalent of the following, which works from the command line to epstools:

c:\Program Files\epstool\bin>epstool --copy --bbox "C:\Documents and Settings\x0047930\Desktop\G001_LOS600_old.eps" "C:\Documents and Settings\x0047930\Desktop\G001_LOS600.eps"

When VAR_A and VAR_B, which have the path name and filename, respectively, are expanded, regardless of how i quote them, don't seem to retain the quotes needed for filenames that contain a space. I think we need someway to escape a double quotes so that that is put into the string that is sent to the shell.

Or just my opinion.

Hope this helps!


Russ
Back to top
View user's profile Send private message
russurquhart1



Joined: 18 Nov 2009
Posts: 14

PostPosted: Fri Feb 05, 2010 4:51 pm    Post subject: Reply with quote

Finally solved my problems by having the dplot macro call the .bat file from a directory that did NOT have any spaces in it. And then calling a Perl script to do the rest of the processing.

As someone asked, we are generating .ps files first. Using GS' ps2epsi.bat file to generate a .eps file, then using epstool to fix the bounding box properly on the .eps file. It all kind of goes like this:

.ps (from Print to file in Dplot)

ps2epsi.bat infile.ps outfile_old.eps
epstool --copy --bbox outfile_old.eps outfile.eps

Hope this helps!

Russ
Back to top
View user's profile Send private message
DPlotAdmin
Site Admin


Joined: 24 Jun 2003
Posts: 2311
Location: Vicksburg, Mississippi

PostPosted: Fri Feb 05, 2010 5:39 pm    Post subject: Reply with quote

Thanks very much for posting. I'll definitely look into this. I think this might be of real interest to LaTeX users.
_________________
Visualize Your Data
support@dplot.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    DPlot Forum Index -> Suggestions/Questions All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group