Extract archive with XAD plugin

Find quick help here to get you started with Hollywood
Flinx
Posts: 188
Joined: Sun Feb 14, 2021 9:54 am
Location: Germany

Re: Extract archive with XAD plugin

Post by Flinx »

You are not precise enough.
What operating system? What error? What is the statement of the error line? Does it extract a part of this archive?
I made a quick test in Windows with the last example script and it did work.
papiosaur
Posts: 161
Joined: Fri Mar 31, 2023 1:34 pm

Re: Extract archive with XAD plugin

Post by papiosaur »

Bizarre, i've put a ChangeDirectory() command just before xad.ExtractFile(1, k, file$) to extract archive to a different path.

All archives worked for the moment...

I've put change directory at the begining of your script and now it work for this new archive...
plouf
Posts: 467
Joined: Sun Feb 04, 2018 11:51 pm
Location: Athens,Greece

Re: Extract archive with XAD plugin

Post by plouf »

Tou have to think slower
Do all tests, create full rest results in a sheet, compare results and all this info will lead you to the solution

Creating a small minimun working code. And experiment what going wrong will help you identify the problem.

In this case you have discover that using ChangeDirectory help.

Have you try to think whats going on ?
Have you create an output (debugprint) of active directory
Before changedirectory /after and etc ?
Christos
Flinx
Posts: 188
Joined: Sun Feb 14, 2021 9:54 am
Location: Germany

Re: Extract archive with XAD plugin

Post by Flinx »

papiosaur wrote: Mon May 29, 2023 3:24 pm Bizarre, i've put a ChangeDirectory() command just before xad.ExtractFile(1, k, file$) to extract archive to a different path.
You should really try to understand what the script does to be able to make meaningful changes.
Look at this part:

Code: Select all

If xad.GetFileAttributes(1, k).Type = #DOSTYPE_DIRECTORY
	If Exists(file$)
		If Not IsDirectory(file$) Then Error("Cannot make the directory "..file$.." because a file with this name already exists.")
	EndIf
	MakeDirectory(file$)
Else
	xad.ExtractFile(1, k, file$)
EndIf
The first If statement looks if the current entry of the archive is a directory or a file. Then, in case it is a directory, it checks if there is already a file that prevents making a directory with this name. Then it makes the directory.
If the entry is a file, it extract this file.
Now, if you put a ChangeDirectory() before the xad.ExtractFile() then the script may have created directories in another path until the first file has to be extracted. Then it changes (with you inserted command) the directory and the following directories and files should extracted in this new location.
This cannot work and there is nothing bizzare.
papiosaur
Posts: 161
Joined: Fri Mar 31, 2023 1:34 pm

Re: Extract archive with XAD plugin

Post by papiosaur »

Thanks plouf and Flinx for your explainations.

Sorry, i would like to do quickly... i must read more the documentations but without examples it's difficult for me, i didn't have do studies in programmation.
User avatar
Juan Carlos
Posts: 887
Joined: Mon Sep 06, 2010 1:02 pm

Re: Extract archive with XAD plugin

Post by Juan Carlos »

papiosaur wrote: Tue May 30, 2023 10:38 pm Thanks plouf and Flinx for your explainations.

Sorry, i would like to do quickly... i must read more the documentations but without examples it's difficult for me, i didn't have do studies in programmation.
You don't worry do haven't programming studies, I hace It and for me also is difficult programming without examples, it is like to have a car and to know about mechannic but you don't know the driving signals, and how driving.
papiosaur
Posts: 161
Joined: Fri Mar 31, 2023 1:34 pm

Re: Extract archive with XAD plugin

Post by papiosaur »

Hello,

i have an XAD error message when i want to update a software already launched.

Seems executable file is write protected and i have this error message.

Is it possible to force extraction and relaunch the software please?
plouf
Posts: 467
Joined: Sun Feb 04, 2018 11:51 pm
Location: Athens,Greece

Re: Extract archive with XAD plugin

Post by plouf »

Nope a file locked by OS ..
The correct waY is to ask user to close it and retryyou can also kill it by command line "taskkill /IM "process name" /F"

But realy you should ask user
Christos
User avatar
jPV
Posts: 603
Joined: Sat Mar 26, 2016 10:44 am
Location: RNO
Contact:

Re: Extract archive with XAD plugin

Post by jPV »

Yeah, you can catch the error in your script and then open a requester to tell the user to close the application. Make your program to try again after that.
papiosaur
Posts: 161
Joined: Fri Mar 31, 2023 1:34 pm

Re: Extract archive with XAD plugin

Post by papiosaur »

Thanks a lot for your reply!

The problem here: the application to kill is the application who realize the extraction, is it always possible?

Sorry if forgot to say it.
Post Reply