CF_RESULT issue

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
Gossie
Newbie
Posts: 4
Joined: Wed Feb 29, 2012 10:18 am

CF_RESULT issue

Post by Gossie » Wed Feb 29, 2012 10:27 am

Hi
Having an issue with getting CF_RESULT to work; so would appreciate any advice!

The following script works perfectly and copies the database. It
is running as domain admin account. However, it returns a CF_RESULT value of FALSE?

//Set IGNORESPACES to 1 to force script interpreter to ignore spaces.
//If using IGNORESPACES quote strings in {" ... "}
//Let>IGNORESPACES=1
//Script to take a copy of the database and put it on the SHARE for the RECOVERY team to access
Let>filename=\\vrbhimagetest\c$\Recovery Databases\dbRecovery.mdb
Let>newfilename=\\vrbhimagetest\c$\Recovery Databases\Users\SuperUsers\dbRecovery.mdb
Let>CF_OVERWRITE=1
CopyFile>%filename%,%newfilename%
Wait>4
MSG>CF_RESULT
GetDate>date
GetTime>time
'MSG>CF_RESULT
'IF>CF_RESULT=TRUE
'WriteLn>\\vrbhimagetest\c$\Recovery Databases\RecoveryDatabaseReplication.txt,result,%date% %time% - Database copied to SuperUserShare
'Else
' WriteLn>\\vrbhimagetest\c$\Recovery Databases\RecoveryDatabaseReplication.txt,result,%date% %time% - Database NOT COPIED to SuperUserShare
'EndIF

bnc1
Pro Scripter
Posts: 127
Joined: Sun Jul 31, 2005 5:10 pm

Post by bnc1 » Wed Feb 29, 2012 12:27 pm

I also get a FALSE value for CF_RESULT even though the file copied OK. I am using MS v13.1.2 with Win 7 x64.

Code: Select all

let>CF_OVERWRITE=1
copyfile>C:\test.txt,G:\test.txt
mdl>CF_RESULT
exit>0

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

Post by Marcus Tettmar » Wed Feb 29, 2012 1:07 pm

Doh! Looks like we've got things arse-about (in the help file, or software whichever way you look at it)

CF_RESULT gets its value from the operations "fAnyOperationsAborted" value.

So FALSE means it did NOT abort/cancel.

TRUE doesn't necessarily mean it was successful though. It just means the operation wasn't aborted or cancelled.

So look also at CF_RESULT_CODE which gives you any error code or zero if successful.

See the Windows docs for the function this is derived from:
http://msdn.microsoft.com/en-us/library ... s.85).aspx

So, if CF_RESULT is FALSE (it didn't abort/wasn't cancelled) and CF_RESULT_CODE is zero, things should be fine.

Now, the question is whether we update the help file or reverse the result of CF_RESULT. Given its name it makes sense it should return TRUE if NOT aborted. But that could be awkward for backward compat. reasons (although this facility hasn't existed long).
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

Gossie
Newbie
Posts: 4
Joined: Wed Feb 29, 2012 10:18 am

Perfect. Thank you!!

Post by Gossie » Thu Mar 01, 2012 5:55 pm

thank you. that works a treat

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

Post by Marcus Tettmar » Thu Mar 01, 2012 7:33 pm

It turns out this got accidentally reversed in the last build. It has been fixed in 13.1.03.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

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