Retreiving the filename of current file and use in macro

Have a suggestion for improving DPlot or a question about existing features? Let us know

Moderator: DPlotAdmin

Post Reply
russurquhart1
Posts: 14
Joined: Wed Nov 18, 2009 2:32 pm

Retreiving the filename of current file and use in macro

Post by russurquhart1 »

Along the lines of the macro, i'm currently working on, I want to save the current file. Export it as a .gif file. Call the printer to print it as a .ps file. And then pass this file to a bat file that runs Ghostscript to convert it to a .eps file.

To test, I am doing the following:

FileSaveAs(1,".grf")
FileSaveAs("Graphics Interchange Format",".gif")
FilePrint("\\paper\lj1_tis2",".ps")
Shell("C:\Program Files\gs\gs8.64\lib\rups2epsi.bat C:\testout.ps C:\testout.eps", 3)
Pause

Is there anyway to grab the filename, in the first line, and use that to pass to the 3rd line and to the Shell command on the 4th line?

Thanks,


Russ
User avatar
DPlotAdmin
Posts: 2312
Joined: Tue Jun 24, 2003 9:34 pm
Location: Vicksburg, Mississippi
Contact:

Post by DPlotAdmin »

No, sorry. The Shell command is an odd duck that is handled entirely by the macro facility. That information is never passed to DPlot, in other words. And the macro gizmo is strictly one-way. It passes commands to DPlot, but there is no way to retrieve information from DPlot (like a filename). You could do all of this fairly easily using a real programming language rather than DPlot macros, but I'm guessing that isn't an option.

What's needed is the ability to request information from DPlot and assign the result to variables in the macro editor, then replace those variable names with their assignment in subsequent commands. I'll add this to my to-do list, but it won't happen overnight.
Visualize Your Data
support@dplot.com
User avatar
DPlotAdmin
Posts: 2312
Joined: Tue Jun 24, 2003 9:34 pm
Location: Vicksburg, Mississippi
Contact:

Post by DPlotAdmin »

What's needed is the ability to request information from DPlot and assign the result to variables in the macro editor, then replace those variable names with their assignment in subsequent commands.
Version 2.2.7.6 is now available and includes this change. You can, for example, do something like this:

Code: Select all

VAR_A=Request("ListPeaks")
TextNoteEx("VAR_A",0.5,0.5,6,5,8,0,0,-1)
to use the output of the List Peaks command as a note. Another example that I think is more along the lines of what you're trying to do is shown at http://www.dplot.com/help/index.htm?req ... nction.htm

For licensed users, mailing list mail with download instructions is being sent as I write this, or you can get the update using the "Check for Updates" command on the Help menu.
Visualize Your Data
support@dplot.com
Post Reply