PDA

View Full Version : action to decompress file.


holmes
10-04-2006, 07:40 AM
Is it possible to decompress a certain file in a determinated folder and this folder be created by automedia ?

If yes, pls inform which action should I use.

Thnks in advance.

bule
10-04-2006, 08:36 AM
Try these two actions:

Folder.Create();

Zip.Extract();

holmes
10-04-2006, 10:33 PM
Thnks a lot Bule. That I've tried already. The problem is that folder can be created, but nothing happens when action to decompress is set.

Even if I manualy decompress the file to a folder and want to copy that folder, using copy file action, again nothing is copyed.

Pls help again.

Sorry, but newbie here

Roboblue
10-05-2006, 01:53 AM
Is the folder you created in the project directory (AutoPlay\Docs\ZipFolder etc.)?
Tip:
Go to the AMS Edit-Preferences window. Check the Debug window. Then preview the project. When the unworking action is done, check to see if the copy file action has an error of "cannot find folder or file". If this is the case and you are sure that you have the folder/file, then the project is confused on where the path is.
If they are in the project directory, then you'll need to set the path with a Global variable.
EX: _SourceFolder.. "\\AutoPlay\\Docs\\ZipFolder
Another thing, if you can, export the project (.apz) and post it with your question. This will help us help you.

holmes
10-05-2006, 02:51 AM
Folder.Create("C:\\programas\\spyware doc");
File.Copy("AutoPlay\\Docs\\PORTABLE SPYWARE DOCTOR", "C:\\progranas\\spyware doc\\", true, true, false, true, nil);


Debug window shows nothing. Above are the actions I'm using. without success.

Why canīt the folder PORTABLE SPYWARE DOCTOR be copied to C:\\progranas\\spyware doc\ ?

Thnks again for your help.

Roboblue
10-05-2006, 02:59 AM
Instead of
File.Copy("AutoPlay\\Docs\\PORTABLE SPYWARE DOCTOR", "C:\\progranas\\spyware doc\\", true, true, false, true, nil);
use
File.Copy(_SourceFolder.. "\\AutoPlay\\Docs\\PORTABLE SPYWARE DOCTOR", "C:\\progranas\\spyware doc\\", true, true, false, true, nil);
and see if that helps.

JimS
10-05-2006, 03:42 AM
One other thingI noticed is a type-o in your path
you spell it
progranas

& you spell it
programas

Another thing you might look at is the fact that Lua code runs very fast, it is possible that the code is running faster than your computer can create the folder.

You might try something like this:

Folder.Create("C:\\programas\\spyware doc");
-- wait a moment
Application.Sleep(1000);

File.Copy("AutoPlay\\Docs\\PORTABLE SPYWARE DOCTOR", "C:\\programas\\spyware doc\\", true, true, false, true, nil);

HTH

holmes
10-05-2006, 06:15 AM
Thnks all for your kind replies.

I've tried all your sugestions but still cannot copy the folder.

Best Rgds

Roboblue
10-05-2006, 06:47 AM
Again, we can't help much without an .apz example of what you are doing.
Along with the above mentioned things, I also see that you are trying to copy a folder with File.Copy action. It should be Folder.Copy
Another thing is that the file in the PORTABLE SPYWARE DOCTOR folder still being used by AMS (file is opened) In a zip function, the file is being manipulated in a temp directory until the action is complete. It may not be closing the file before trying to copy it.
Several more things come to mind, but it would be quicker for you to export the apz than for me to guess and type.
If you are afraid someone may "steal" your code, then create a project that just does this one thing and post it.
Other than that, I can't help you.

holmes
10-05-2006, 12:22 PM
Hi Roboblue. Seems that attaching files is now disabled in this board. I'll try later, BTW Folder copy doesn't exist in action options.

Thnks for your help

Roboblue
10-05-2006, 01:12 PM
:o You're right it doesn't.

Ok, Are you trying to create a zip file from all the files in the the PORTABLE SPYWARE DOCTOR folder into the C:\\programas\\spyware doc folder? if so, try this.
Folder.Create("C:\\programas\\spyware doc");
Zip.Add("C:\\programas\\spyware doc\\Myzip.Zip", _SourceFolder.. "\\AutoPlay\\Docs\\PORTABLE SPYWARE DOCTOR\\*.*, true, "", 5, nil, true);
OR
Have you already created a zip file in the PORTABLE SPYWARE DOCTOR folder and want to extract the zip to the C:\\programas\\spyware doc folder? If so, try this
Folder.Create("C:\\programas\\spyware doc");
Zip.Extract(_SourceFolder.. "\\AutoPlay\\Docs\\PORTABLE SPYWARE DOCTOR\\MyZip.zip", {"*.*"}, "C:\\programas\\spyware doc", true, true, "", ZIP_OVERWRITE_ALWAYS, nil);
is this the same code as what you are using?