Page 1 of 1

ForFilesIn macro error

Posted: Sun Jul 14, 2019 2:14 pm
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?

Posted: Mon Jul 15, 2019 11:31 am
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()

Posted: Tue Jul 16, 2019 10:16 am
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!

Posted: Tue Jul 16, 2019 11:00 am
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?