Jump to content

Qestion for the smart guys!


This topic is 6965 days old. Please don't post here. Open a new topic instead.

Recommended Posts

I am using the troi File Plug in to copy files from a disk, and then launch them, and then gather information from them but I am having some problems.

I will only be doing this with .zip and .sit files.

I copy down the file, and tr_Launch it, which is the same as double clicking on it, that then decompresses it, after that, I am going through the whole decompressed folder getting information about the files contained inside of it.

My problem, is that My script runs faster than a file can decompress, as such, when I try to read it, i get a -43 error meaning the directory doesn't exist yet. I need to be able to wait until the file is unzipped. However, I can't just use a Pause script step, because the file could take forever, or no time at all to unzip and this has to be fast.

My only other solution that I can see is to create a looping script that checks to see if the new folder is in that directory or not, then continueing when it finds it. Is there no other way to do this? Thanks for any help you can provide.

Link to comment
Share on other sites

Out of all of the plugins I've purchased over the time, the Troi File is certainly the most handy.

I use it to create zip files (using WinZip command line interface), then create self-extracting exe files. Kinda the opposite of what you are doing.

The looping idea of your might work, but maybe with these sugguestions -

If you only look for the directory(folder) being created, that doesn't mean that the file(s) are done decompressing. The directory is the first thing it decompresses, supposing there is one. Supposing that there are multiple files in the zip , you would have to know what the last file to be decompressed is to determine exactly when it's done.

Also, this might cause memory errors, or for it to simply fail if it takes too long, because if I'm not mistaken - when FM "senses" it's in an infinite loop, it'll exit out, or the computer will run out of free memory trying (not cool!). Certainly give it a try, and please post back here with the results. I would be interested.

Another idea I've got, but you may not like it - Break the script down into a two-step process. First script starts to unzip. Once you visually see it's completed, run step two.

Link to comment
Share on other sites

How about a Loop that checks for the file(s) over and over, using a counter, so that it gives up on that operation if you reach the counter before the file exists? You're pretty much stuck with waiting in intervals of 1 second (plus the millisecond to check if the file exists).

As far as other ways to do it, you could use AppleScript, which would tell the Finder to open the file (or use command line). Then use a "repeat" loop, with a "delay 1" (or less, 0.1), and an "if exists" test, with an "exit repeat". It would be pretty much the same thing though. I don't think it can "tell" if something's done except for checking over and over. It's not a FileMaker script (which, we take for granted, will finish one step before starting another).

set zipFile to "Macintosh HD:Users:fej:Desktop:mobile 7 doc bugs.zip"

set theFile to "Macintosh HD:Users:fej:Desktop:mobile 7 doc bugs"

tell application "Finder"

Link to comment
Share on other sites

I ended up just using the loop, and its working fine. A note to Bent however, It seems that Trio File reads a temp folder ".nameofzipfile.zip" until the file has finished unzipping. Making my job much easier. My loop is pretty simple. ListFolder ( -Folders

Substitute anything that starts with a "." and see if there is a folder there or not. Since I create the folder that the zip files go into for decompressing, that makes this work like a charm.

Fenton:

Applescript would make this so much easier, however, this needs to be a cross platform client application, making Applescript not possible.

Link to comment
Share on other sites

This topic is 6965 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.