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 

ForFilesIn macro error

 
Post new topic   Reply to topic    DPlot Forum Index -> General discussion
View previous topic :: View next topic  
Author Message
mikeb



Joined: 18 Aug 2004
Posts: 32

PostPosted: Sun Jul 14, 2019 2:14 pm    Post subject: ForFilesIn macro error Reply with quote

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.
Quote:
NULL result for replaceable parameter |TITLE2| in FileSaveAs
.

Once I hit OK, the following box pops up.
Quote:
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?
Back to top
View user's profile Send private message
mikeb



Joined: 18 Aug 2004
Posts: 32

PostPosted: Mon Jul 15, 2019 11:31 am    Post subject: Reply with quote

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:
'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()
Back to top
View user's profile Send private message
DPlotAdmin
Site Admin


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

PostPosted: Tue Jul 16, 2019 10:16 am    Post subject: Reply with quote

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!
_________________
David Hyde
support@dplot.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
mikeb



Joined: 18 Aug 2004
Posts: 32

PostPosted: Tue Jul 16, 2019 11:00 am    Post subject: Reply with quote

Any idea why
Code:
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?
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    DPlot Forum Index -> General discussion 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