Page 4 of 5
Re: Extract archive with XAD plugin
Posted: Mon May 29, 2023 11:03 am
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.
Re: Extract archive with XAD plugin
Posted: Mon May 29, 2023 3:24 pm
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...
Re: Extract archive with XAD plugin
Posted: Mon May 29, 2023 4:18 pm
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 ?
Re: Extract archive with XAD plugin
Posted: Mon May 29, 2023 5:51 pm
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.
Re: Extract archive with XAD plugin
Posted: Tue May 30, 2023 10:38 pm
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.
Re: Extract archive with XAD plugin
Posted: Wed May 31, 2023 9:19 am
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.
Re: Extract archive with XAD plugin
Posted: Wed Jun 21, 2023 7:52 pm
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?
Re: Extract archive with XAD plugin
Posted: Wed Jun 21, 2023 9:26 pm
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
Re: Extract archive with XAD plugin
Posted: Thu Jun 22, 2023 6:15 am
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.
Re: Extract archive with XAD plugin
Posted: Thu Jun 22, 2023 9:29 am
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.