viewpoint-particle

Author Topic: How do I use the ExtractAttachedFile command?  (Read 224 times)

pguild

  • Jr. Member
  • **
  • Posts: 88
  • The dog is always right!
    • MasteryLearning
How do I use the ExtractAttachedFile command?
« on: August 04, 2023, 02:17:58 pm »
I am wondering how to properly use the ExtractAttachedFile command.
I have compiled my Winbatch script to an .exe with the skip extraction option in settings.
Thanks to Winbatch Techsupport I found that this code works great:

if ! fileexist("prompts.txt")
   pause("Support files need to be extracted","Press OK to continue.")

   ;Extract other files if they don't already exist
   rc = 0
   files[0] = "prompts.txt"
   files[1] = "BigArticle.txt"
   files[2] = "Determined.txt"
   files[3] = "Editor.txt"
   files[4] = "Encouraging.txt"
   files[5] = "Fitness-enhancing.txt"
   files[6] = "Inspirational.txt"
   files[7] = "MakePrompt.txt"
   files[8] = "Oneliners.txt"
   files[9] = "people.txt"

   foreach file in files
      if ! FileExist(file)
         rc = ExtractAttachedFile(file, file)
      endif
   next

   if rc
      pause("Yes","The support files have been extracted!")
   else
      pause("Oops","Support files not extracted.")
   endif
endif


td

  • Tech Support
  • *****
  • Posts: 4382
    • WinBatch
Re: How do I use the ExtractAttachedFile command?
« Reply #1 on: August 06, 2023, 09:41:35 am »
A generalized example:

Code: Winbatch
; Extenders.
list =  ExtractAttachedFile("", 1)
files = Arrayize(list, @tab)
foreach file in files
   ; Could version check instead of
   ; just checking for existence here.
   if FileExist(file) then continue
   ExtractAttachedFile(file, file)
next

; Other files.
list =  ExtractAttachedFile("", 2)
files = Arrayize(list, @tab)
foreach file in files
   if FileExist(file) then continue
   ExtractAttachedFile(file, file)
next

exit
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade