Author Topic: Listing Attached Files  (Read 639 times)

cssyphus

  • Jr. Member
  • **
  • Posts: 69
  • Let's go Brandon
Listing Attached Files
« 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!
Is this a pandemic... or an IQ test? newz.icu

td

  • Tech Support
  • *****
  • Posts: 4044
    • WinBatch
Re: Listing Attached Files
« Reply #1 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
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

  • Jr. Member
  • **
  • Posts: 69
  • Let's go Brandon
Re: Listing Attached Files
« Reply #2 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:
Code: [Select]
_EAF1 = ExtractAttachedFile(``, 1) ;EXTENDER DLLs
_EAF2 = ExtractAttachedFile(``, 2) ;OTHER FILES
filePut(`c:\EAF_Extdrs.txt`, _EAF1)
filePut(`c:\EAF_Other.txt`, _EAF2)
Is this a pandemic... or an IQ test? newz.icu

td

  • Tech Support
  • *****
  • Posts: 4044
    • WinBatch
Re: Listing Attached Files
« Reply #3 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
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade