| Index > Scribe > Scripting bug: multiple conditions in IF statement | |
|---|---|
| Author/Date | Scripting bug: multiple conditions in IF statement |
| Scott 07/11/2019 10:40pm | When I include multiple conditions in an IF statement, I get the following error: "Error: Can't alloc register, Regs=0xff"
Here's the offending code: if ((Mail.Subject.Find("Villa") >= 0 ) || (Mail.Subject.Find("Italy") >= 0 )) {
Fd = GetFolder(foldName + "/Italy");
} else if (Mail.Subject.Find("Villa") >= 0 ) {
Fd = GetFolder(foldName + "/Italy");
} else if (Mail.Subject.Find("Italy") >= 0 ) {
Fd = GetFolder(foldName + "/Italy");
}
If I remove the first IF statement, then the error goes away. |
| fret 08/11/2019 11:00am | I'll have a look at this. But I expect you could probably work around the limitation in the short term by pulling those values into local variables before testing them:
Villa = Mail.Subject.Find("Villa");
Italy = Mail.Subject.Find("Italy");
if ((Villa >= 0 ) || (Italy >= 0 )) {
Fd = GetFolder(foldName + "/Italy");
} else if (Villa >= 0 ) {
Fd = GetFolder(foldName + "/Italy");
} else if (Italy >= 0 ) {
Fd = GetFolder(foldName + "/Italy");
} |
| Scott 09/11/2019 11:49pm | Unfortunately, the workaround has the same issue. |
| Scott 09/03/2020 12:53am | It looks like the underlying problem is the '||' operator.
Using this assumption, leads to the following workaround (which works well): if (Mail.Subject.Find("villa").Lower() + Mail.Subject.Find("Italy") > -2 )
{
Fd = GetFolder(foldName + "/Italy");
} |
| Reply | |