Bug in IfFileExists... If-Else logic

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
Waldo
Junior Coder
Posts: 20
Joined: Fri Oct 29, 2004 4:22 am

Bug in IfFileExists... If-Else logic

Post by Waldo » Mon Jan 31, 2005 4:09 pm

Here is another bug involving IF-ELSE-ENDIF ... this one related to the
IfFileExists statement. Try using the Debugger to step through this code:
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
label>FindStatus
IfFileExists>c:\testfile.txt
Let>FileStat=File Exists
else
Let>FileStat=File Doesn't Exist
endif

label>Loop
let>x=1
if>x=1,FindStatus,Loop
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

You'll see that program executes correctly during the FIRST pass only.
On subsequent passes, the IfFileExists statement behaves as
a SubRoutine call.... and doesn't execute the IF-ELSE logic at all.

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Mon Jan 31, 2005 4:31 pm

Hi,

The problem is due to the mix of old and new IF syntax. This version works:

/////////////////////
label>FindStatus
IfFileExists>c:\testfile.txt
Let>FileStat=File Exists
else
Let>FileStat=File Doesn't Exist
endif

label>Loop
let>x=1
if>x=1
Goto>FindStatus
else
Goto>Loop
EndIf
/////////////////////

I'll look into either whether we can ensure old and new syntax works better together, or failing that at least make the documentation clear that it is best to use either one or the other.
MJT Net Support
[email protected]

Waldo
Junior Coder
Posts: 20
Joined: Fri Oct 29, 2004 4:22 am

Mixing Old and New?

Post by Waldo » Tue Feb 01, 2005 3:30 am

The example I posted represents two completely different IF statements.

In my actual program, the similar statements were separated by nearly two hundred lines of code... they weren't "mixed" at all.

Additionally, the behavior of the IfFileExists logic varies.... when the file actually does exist, program flow is as it should be. The variant
behavior occurs when the file doesn't exist..... resulting in a
"return from subroutine" behavior..... that skips both the TRUE and FALSE
logic of the IF-ELSE-ENDIF structure.

Blessings,
Waldo

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Tue Feb 01, 2005 8:31 am

I've tested the above script with both an existing and non-existing file and it worked correctly.
MJT Net Support
[email protected]

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Thu Feb 03, 2005 5:50 pm

Just to let you know we have found the cause of this problem (see first post above) and have fixed it. The fix will be in 7.3.08 which should hopefully be available later today.
MJT Net Support
[email protected]

Waldo
Junior Coder
Posts: 20
Joined: Fri Oct 29, 2004 4:22 am

Thanks...

Post by Waldo » Fri Feb 04, 2005 9:27 am

Thanks again for a great product and, more importantly, to your commitment toward continual improvement.

Regards,

Waldo

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts