Alternate to PREFETCH command (SOLVED)

I am using a script with several steps, it will only need to download a file if it reaches a certain step in the process. While debugging I find it downloads the prefetch at the start of the action. How can I specify to download only once it reaches a certain step?


You can use a prefetch block to only download something if relevance statements are satisfied. This might do what you need, but it might not.

Otherwise, I think you need the download now command or the old download command.

Not all of the options will use the relays to do the downloads depending on how they are used.

Actions in general only want to start when their downloads have already completed which is why except for the “download now” command (where the CLIENT actually downloads the file) you will always download the file before the action starts no matter what form of the download command you use.

1 Like


A colleague of mine made the following code and we use this:

begin prefetch block
	if {not exists file "C:\Apps\Sources\2.0.5\x.msi"}
		add prefetch item name=7BB3FBA7E8752FB6CEF8AF33C806B9F43A6E670E sha1=7bb3fba7e8752fb6cef8af33c806b9f43a6e670e size=19722512 url=SWDProtocol://x/Uploads/7BB3FBA7E8752FB6CEF8AF33C806B9F43A6E670E/x.msi.bfswd sha256=cffddb44c16b3e75ec3afe1620e8a8713caa25ceb95ac281b2c7d9c74c064e45
end prefetch block

This will only download the file if it’s not there yet…

Maybe you can try something with that?

Thanks for the reply. It does look like a Prefetch Block is the solution.

1 Like

Just be aware that the prefetch block will be evaluated before any of the actionscript executes. If this works for your use case, then this is the method you should use because it will still be able to download ahead of time using the relay infrastructure, but only download which ones are needed. This is nice because you won’t have a download somewhere in the middle of the actionscript execution that would hold up all action execution for the duration of the download.

In short, you should always use either a prefetch or a prefetch block. If you have a need that requires something more, then you should be certain it is the only option.