Home   Archive   Permalink



Can't understand this...

I want to send an email to each address in a text file and this is the code -
    
owners: read/lines %test.txt
emails: copy []
msg: "Dear accommodation owner..."
foreach address owners [append emails to-word address]
foreach address emails [send/subject to-email msg "Your accommodation added to search site"]
    
I tested this in the console and it worked fine, but the exact same code generated an error when it was run from a script:
    
** Script Error: Out of range or past end
** Where: to-word
** Near: to word! :value
    
This is probably something obvious, but I can't see why I'm getting the error, can anyone help?
Thanks,
Mike
    
                                                                    
                                                                                    


posted by:   Mike     12-May-2011/15:48:30-7:00



Ok, I figured it out. There was a text file of the same name in the directory where the script was, but it didn't have the same data.
    


posted by:   Mike     12-May-2011/16:06:21-7:00