ForFilesIn macro error

Beta releases, announcements and anything else that doesn't fit below. Please read the <B>Welcome</B> topic.
Post Reply
mikeb
Posts: 36
Joined: Wed Aug 18, 2004 5:23 pm

ForFilesIn macro error

Post by mikeb »

I have a wscript calling a macro that is returning the following error from a ForFilesIn loop when it tries to process a file without Title2.
NULL result for replaceable parameter |TITLE2| in FileSaveAs
.

Once I hit OK, the following box pops up.
Negative acknowledgement received from server
.

I press ok here and still have to open DPLOT (which has been running the macro while hidden) to close the file in question. This will then allow the wscript calling this to continue.

I put ErrorMessages(0) in macro, but it only eliminated the "NULL result..." message. I still got the "negative acknowledgement..." response. I still have to open the hidden DPLOT and close the open .grf file to allow my wscript to continue.

Is there another way to trap this "NULL result" error in macro?
mikeb
Posts: 36
Joined: Wed Aug 18, 2004 5:23 pm

Post by mikeb »

This is the macro I am using. I am using # as a separator character to make file name parsing easier in wscript.
The commented out FileSaveAs line doesn't give an error, but generates a bitmap with filename only - no title2 or xaxistitle.

Code: Select all

'ImageConvert
'When calling from command line use:
' evimage.exe /d "c:\default directory" /m ImageConvert /show 0
' This macro:
'  1) opens each file matching *.grf from default dir
'  2) Saves as bmp using filename with title2 and xaxislabel appended,
'  3) closes each file
'
ErrorMessages(0)
'Directory("C:\evscans")
ForFilesIn("*.grf")
	VAR_A=Request("Title2")
	VAR_B=Request("XAxisLabel")
	VAR_C=Request("fname")
	FileSaveAs("BMP Picture","VAR_C#|TITLE2|#VAR_B#.bmp")
'	FileSaveAs("BMP Picture","VAR_C#VAR_A#VAR_B#.bmp")'This generates bitmap of name only - no title or xaxis label
	FileClose()
NextFile
FileExit()
User avatar
DPlotAdmin
Posts: 2312
Joined: Tue Jun 24, 2003 9:34 pm
Location: Vicksburg, Mississippi
Contact:

Post by DPlotAdmin »

Mike,
There's no way to circumvent the behavior once an error has occurred. And within the macro there's no way to branch if some condition isn't met, like

if len(VAR_A) > 0 then
' do your normal thing
else
' do something else
endif

So... sorry!
Visualize Your Data
support@dplot.com
mikeb
Posts: 36
Joined: Wed Aug 18, 2004 5:23 pm

Post by mikeb »

Any idea why

Code: Select all

FileSaveAs("BMP Picture","VAR_C#VAR_A#VAR_B#.bmp")
doesn't appear to return values for VAR_A or VAR_B - only VAR_C?
Post Reply