WinBatch® Technical Support Forum

All Things WinBatch => WinBatch => Topic started by: cssyphus on September 03, 2019, 01:28:05 PM

Title: Listing Attached Files
Post by: cssyphus on September 03, 2019, 01:28:05 PM
Is there a command to List attached files?  (Using 2018B)

I am using ExtractAttachedFiles and getting an error on one file.  I double-checked the .cmp file and the file-in-question is listed there, and the "Count" under [Other Files] is accurate, but the script is crashing when asked to extract the file.

If there was such a command then I could "test" if the file is in the executable before attempting to extract.

Thanks!
Title: Re: Listing Attached Files
Post by: td on September 03, 2019, 01:45:00 PM
Since the function only generates minor errors it is simple enough to wrap in a simple error handler.

Code (winbatch) Select
nMode = ErrorMode(@OFF)
LastError()
ExtractAttachedFile('whatever','whatever')
ErrorMode(nMode)
if LastError()
   ;;; do something
endif


But it would seem better to just correct whatever is that is causing the file to either not be present or at least appear not to be present in the executable.
Title: Re: Listing Attached Files
Post by: cssyphus on December 29, 2021, 01:11:21 PM
For future readers...

It's part of the ExtractAttachedFiles command - just call it with the correct params: empty quotes for the first param, and the second parameter is an integer representing which type of files to list.

Code example:
_EAF1 = ExtractAttachedFile(``, 1) ;EXTENDER DLLs
_EAF2 = ExtractAttachedFile(``, 2) ;OTHER FILES
filePut(`c:\EAF_Extdrs.txt`, _EAF1)
filePut(`c:\EAF_Other.txt`, _EAF2)
Title: Re: Listing Attached Files
Post by: td on December 30, 2021, 04:59:27 PM
For future reads, it's in the Consolidated Help File and online documentation:

https://docs.winbatch.com/mergedProjects/WinBatch/WINBATCH_E__003.htm (https://docs.winbatch.com/mergedProjects/WinBatch/WINBATCH_E__003.htm)