Yeah, I did that and all is well. Thanks Bill
-----Original Message----- From: Wepking, Bill W. [mailto:[EMAIL PROTECTED] Sent: Thursday, February 27, 2003 10:14 AM To: 'SmartCam Forum' Subject: RE: [mfg-smartcam] F_READ problem? Pete, It may be a quirk of the software, I'm not sure. My experience is to keep the F_OPEN outside of the loop. Bill Wepking Landis Gardner -----Original Message----- From: Pete Ruehle [mailto:[EMAIL PROTECTED] Sent: Thursday, February 27, 2003 9:06 AM To: Wepking, Bill W.; 'SmartCam Forum' Subject: RE: [mfg-smartcam] F_READ problem? Bill, That seems to make sense. However, with that in mind, you would think that F_READ would always grab the first entry in the txt file. But it doesn't read anything at all. I verified this by setting the variable to zero before the loop containing the F_READ. It was still zero after the loop. As if the F_READ was ignored. Thanks, Pete -----Original Message----- From: Wepking, Bill W. [mailto:[EMAIL PROTECTED] Sent: Thursday, February 27, 2003 8:00 AM To: 'Pete Ruehle'; 'SmartCam Forum' Subject: RE: [mfg-smartcam] F_READ problem? I have run into this problem. It is because each time the F_OPEN command is activated it resets to the beginning of the file so having it in the WHILE loop resets the F_READ or F_WRITE to the beginning of the file. Bill Wepking Landis Gardner -----Original Message----- From: Pete Ruehle [mailto:[EMAIL PROTECTED] Sent: Monday, February 24, 2003 11:29 AM To: 'SmartCam Forum' Subject: [mfg-smartcam] F_READ problem? Hey there everyone, I came across something strange (to me) with the F_READ command that I thought I would share. Of course it's probably not news to some of you, but whatever. The F_READ command in the following macro excerpt was doing nothing even though the txt file was written properly (one integer per line): INTEGER:#FIXGROUP WHILE(whatever) <a bunch of irrelevant commands> F_OPEN[FN="C:\\SM9\\DATA\\WORK\\-SPM\\MACROS\\GROUPCHK.TXT", TY="W"] GET_GRP[AR=0, GN=#RGRP] #FIXGROUP=GRP(0) NEW_GRP[] F_WRITE[FN="C:\\SM9\\DATA\\WORK\\-SPM\\MACROS\\GROUPCHK.TXT", FMT="%I~n", VR="FIXGROUP"] ENDW F_CLOSE[FN="C:\\SM9\\DATA\\WORK\\-SPM\\MACROS\\GROUPCHK.TXT"] And now, the attempt to read: F_OPEN[FN="C:\\SM9\\DATA\\WORK\\-SPM\\MACROS\\GROUPCHK.TXT", TY="R"] #COUNT=1 WHILE(#COUNT<=#NUMTOOLS) #RGRP=STRTMP("R%COUNT") GET_GRP[AR=0, GN=#RGRP] #INGRP=GRP(0) F_READ[FN="C:\\SM9\\DATA\\WORK\\-SPM\\MACROS\\GROUPCHK.TXT", FMT="%I", VR="FIXGROUP"] WHILE(#INGRP>#FIXGROUP) ELMT_GRP[AR=1, EL=GRP(#INGRP)] #INGRP=GRP(0) ENDW NAME_GRP[GN=#RGRP, RM=0] //group is restored NEW_GRP[] #COUNT=#COUNT+1 ENDW F_CLOSE[FN="C:\\SM9\\DATA\\WORK\\-SPM\\MACROS\\GROUPCHK.TXT"] The variable #fixgroup was not being read in at all. I verified this by setting it to zero before the F_READ and that's the value that it had after the F_READ. Anyway, after a few less hairs on my head, I noticed that the F_OPEN command before the F_WRITE was inside the WHILE loop. But I didn't pay any attention to that since the txt file appeared to be written properly. After all, it was the F_READ that was the problem. But, when I finally moved that first F_OPEN before the WHILE loop, the F_READ worked properly. Keep in mind the text file looked identical in both cases; one integer per line. Is there an explanation for this? Or is it just Rod Serling making another appearance? Regards, Pete Ruehle SPM Armonk, NY ====================================================================== To find out more about this mailing list including how to unsubscribe, send the message "info mfg-smartcam" to [EMAIL PROTECTED] ====================================================================== ====================================================================== To find out more about this mailing list including how to unsubscribe, send the message "info mfg-smartcam" to [EMAIL PROTECTED] ====================================================================== ====================================================================== To find out more about this mailing list including how to unsubscribe, send the message "info mfg-smartcam" to [EMAIL PROTECTED] ======================================================================
