New version appears to have changed IfFileexists

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
kpassaur
Automation Wizard
Posts: 696
Joined: Wed Jul 07, 2004 1:55 pm

New version appears to have changed IfFileexists

Post by kpassaur » Mon Jan 08, 2007 10:25 pm

In previous versions the command Iffileexists would allow a wildcard and the version 9 dosn't appear to. I tested the following script on Version 9 and it didn't work, but it did on 8. I have used this command in a lot of macros. I know I could get around it but it would be alot of changes. The script I tested is

IfFileExists>C:\LoanArchiveFiles\*.tif
MDL>Yes
Else
MDL>No
Endif

Version 8 returns yes Version 9 no

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Mon Jan 08, 2007 10:49 pm

Hi,

Odd. We haven't changed anything in regard to IfFileExists and intended and documented behaviour has always been that it does not support wildcards. The function that we call internally is not documented to support wildcards either.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Mon Jan 08, 2007 11:07 pm

IfFileExists with wildcard works for me in 9.0.029 beta. (But until I saw this I would not have thought to use it that way.)

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Mon Jan 08, 2007 11:32 pm

I will need to check but I am sure that I have used the same syntax over the past few years, many versions ...

IfFileExist>Drive:\path\*day.txt is used to make sure I am backing up to a drive named Monday, Tuesday, Wed......... etc.

If this fails, I skip the backup to that drive.

I don't recall trying that during version 9 Beta testing.

Sorry, I cannot confirm that for a few days.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

User avatar
JRL
Automation Wizard
Posts: 3532
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Tue Jan 09, 2007 3:36 am

Hi guys,

Like Me_again I've never used the wildcard "feature" in IfFileExists. I just tried the sample script in versions 7.3, 8.0 and 9.0.043. The wildcard worked in versions 7 and 8 but it did not work in 9. Tomorrow (if this isn't resolved by then) I can try earlier versions of 9 and maybe find in which version 9 build this change occurred.

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Tue Jan 09, 2007 9:28 am

I have just compared our source code from v8 and v9 branches and there is no difference in the code used. The documentation for the internal function we call says it requires a full filename.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Tue Jan 09, 2007 10:46 am

On further investigation it appears that the function we call internally for IfFileExists used to work with wildcards but was never meant to officially - hence the reason the documentation states not. Between v8 and v9 we upgraded to the new version of the Delphi compiler. So v9 is compiled with a newer version of Delphi and it turns out that the FileExists function is implemented differently to fix an issue and now no longer supports wildcards. While it was never meant to support wildcards, and was never documented as such, the fact is the old version did, and in turn previous versions of Macro Scheduler's IfFileExists function did also. I can therefore see that this could be an annoyance and break existing scripts. Therefore we will issue an update shortly with an alternative implementation of IfFileExists (and the FILE_EXISTS AND FILE_NOTEXISTS OnEvent functions).
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Tue Jan 09, 2007 11:54 am

Please note, this has now been addressed in build 047:
http://www.mjtnet.com/forum/viewtopic.php?t=3534
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

User avatar
jpuziano
Automation Wizard
Posts: 1085
Joined: Sat Oct 30, 2004 12:00 am

Post by jpuziano » Tue Jan 09, 2007 4:56 pm

Hi Marcus,

Thanks for addressing this quickly with a Maintenance Release so backwards compatibility with older scripts was not compromised.

I realize you have printed documentation and updates may take a while... but now that the wildcard ability of IfFileExists (and the OnEvent versions) has been made *official*, please make a note to update the Help File to this effect. Examples showing the proper use of the wildcard would be great.

Thanks again and keep up the great work
jpuziano

Note: If anyone else on the planet would find the following useful...
[Open] PlayWav command that plays from embedded script data
...then please add your thoughts/support at the above post - :-)

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Tue Jan 09, 2007 8:11 pm

Thanks Marcus.

That is just in time, I definitely had older scripts using the wild card.
Once again, top support with a sensitivity to backwards compatibility.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

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