Force action to report as "Failed"

(imported topic written by sinucus)

I’m trying to write a fixlet where I can force the action to report “Failed” if the fixlet does not run how I want. I don’t want my relevance to have to detect if the right disk is in place because it might take 15-30 minutes for the computer to re-evaluate and I’m trying to copy content off multiple disks. Below is some example code. It seems to work, but I wonder if there is a more elegant solution.

if {following text of first “=” of (selects “VolumeName from win32_CDROMDrive” of wmi as string) = “Disk1” }

waithidden cmd.exe /C d:\ c:\import

else

waithidden thisexecutabledoesnotexistsoitthrowsanerror.exe

endif

(imported comment written by jeremylam)

How about putting relevance into the Success Criteria tab of the Take Action dialog that detects if the copy was successful?

(imported comment written by sinucus)

I need this action to be able to be executed with no customization. So adding something to the “Take Action” screen is out of the question. Like I stated in my prior post, if I try to execute a file that does not exist, then it will wait the ~60 or so to time out and then throw an error. I’d like to be able to throw a custom error, like “Wrong disk inserted”.

The task that I’m trying to accomplish is copying content off of multiple cds via a fixlet. So I have 3 fixlets, “Import disk 1”, disk2, disk3" They all have the same relevance, that way I don’t have to wait the 15-30 minutes for the client to detect that I changed disks.

(imported comment written by SystemAdmin)

You shouldn’t have to “force” the fixlet to return failed.

Since a fixlet is determined to have “Failed” if after executing the actions, the relevance clauses still resolve to TRUE.

You could have your ELSE clause do something that would cause the fixlet to still be relevant.

Tasks on the other hand base Success/Failure on executing all the lines of the action script.

(imported comment written by SystemAdmin)

Why not just add in your relevance: "not exists folder “C:\import\disk1”