Listing Attached Files

Started by cssyphus, September 03, 2019, 01:28:05 PM

Previous topic - Next topic

cssyphus

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!

td

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.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

cssyphus

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)

td

For future reads, it's in the Consolidated Help File and online documentation:

https://docs.winbatch.com/mergedProjects/WinBatch/WINBATCH_E__003.htm
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade