Rustywinger Posted June 26, 2009 Report Share Posted June 26, 2009 I have a TSV text file that contains about 2000 lines of serial numbers that should be excluded from a larger production process if they match the active search string. So I load this text file into VAR_A and then during every production loop I test to see if VAR_A contains VAR_B, which is the active serial number being handled. The result is always false and it is driving me nuts. I put both variables into a dialog box at various stages of this process just so I could see that they are set properly and they are. Here is the abridged code in question: <VARIABLE SET STRING Option="\x03" Destination="%ExclusionNums%" Filename="ExclusionNums.txt"/> <IF VARIABLE Variable="%ExclusionFileTrue%" Condition="\x00" Value="True" IgnoreCase="TRUE"/> <IF VARIABLE Variable="%ExclusionNums%" Condition="\x07" Value="%ActiveNum%" IgnoreCase="TRUE"/> <VARIABLE SET STRING Option="\x00" Destination="%StatusUpdate%" Value="%RecordStatus%"/> <END IF/> <END IF/> As I mentioned, VAR_A is going to contain about 2000 lines with a single serial number on each line. The argument above checks to see whether the file as a whole contains a unique 10-digit string and when I take both into a text file in windows and run a search on the active number, it works every time. But the macro search never returns true. I have been working on this seemingly ridicuously simple task for a day and at my wit's end!!! Thanks for any help! Quote Link to comment Share on other sites More sharing options...
paul Posted June 26, 2009 Report Share Posted June 26, 2009 I wrote a macro to create ExclusionNums.txt to contain 2000 random numbers between 1023663 and 90221448233, each terminated with char(13) and char(10). I then ran your macro (modified to remove unnecessary commands), and it worked perfectly! All I can suggest is that you check that the variables you are using are of the expected type, and that the variable %ExclusionFileTrue% is equal to True. I believe I may have read of a bug regarding boolean variables - that might be worth searching for. Variable Set to ASCII Char 13 to %crlf% Variable Set to ASCII Char 10 to %x% Variable Set String %crlf% to "%crlf%%x%" Repeat Start (Repeat 2000 times) Variable Set Integer %num% to a random value between 1023663 and 90221448233 Variable Set String %output% to "%output%%num%%crlf%" End Repeat Variable Modify String: Save %output% to "d:\exclusionnums.txt" Variable Set String set %ExclusionNums% to the contents of d:\ExclusionNums.txt Variable Set Integer %ActiveNum% to 17220828 If Variable %ExclusionNums% Does not Contain "%ActiveNum%" Text Box Display: Else Text Box Display: End If <VARIABLE SET STRING Option="\x03" Destination="%ExclusionNums%" Filename="d:\\ExclusionNums.txt" Strip="FALSE"/> <VARIABLE SET INTEGER Option="\x00" Destination="%ActiveNum%" Value="17220828"/> <IF VARIABLE Variable="%ExclusionNums%" Condition="\x07" Value="%ActiveNum%" IgnoreCase="TRUE"/> <TEXT BOX DISPLAY Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\lang3081\\f0\\fs16 %ActiveNum% not found\\lang1033\\f1 \r\n\\par }\r\n" Left="Center" Top="Center" Width="278" Height="200" Monitor="1" OnTop="FALSE" Keep_Focus="TRUE" Mode="\x00" Delay="0"/> <ELSE/> <TEXT BOX DISPLAY Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\lang3081\\f0\\fs16 %ActiveNum% found\\lang1033\\f1 \r\n\\par }\r\n" Left="Center" Top="Center" Width="278" Height="200" Monitor="1" OnTop="FALSE" Keep_Focus="TRUE" Mode="\x00" Delay="0"/> <END IF/> Quote Link to comment Share on other sites More sharing options...
Cory Posted June 29, 2009 Report Share Posted June 29, 2009 Rusty often the prime suspect is not the perpetrator. Don't' focus on the "contains" but look at your %ExclusionNums% = True. As I have written up before the default case for any boolean is False so your other part that sets the condition to True might be the cause. Try F8'ing thru and see if it actually gets to the inner condition. Or enable the debug command to log all commands. Short of that give us a copy of your exclusion list to test your code with. Quote Link to comment Share on other sites More sharing options...
Rustywinger Posted June 30, 2009 Author Report Share Posted June 30, 2009 Well I found the issue last week, it was a number of factors combining into one nice little mess that made this simple little thing into a big headache. I can't even remember the specifics but it was so far removed from the thread issue it's not worth reporting on. So everything works and the macro is happily discriminating against the exclusion files with absolute prejudice! Thanks for the replies, Paul and Cory! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.