Progress Bar while compressing files

I was wondering if it’s possible to show a progress bar in AppleScript Studio while compressing a file?

I’ve created my app with a spinner progress bar that I start before the compressing starts, and then I stop it when it’s done. But I’ve been having random lock-ups while running this app, so I don’t know if it’s compressing a file, or if it’s locked up, and of course the spinner just keeps going.

I’m using a shell script:

set theResult to do shell script "/usr/bin/ditto -c -k -rsrc --keepParent " & (quoted form of (POSIX path of stuffFolder)) & " " & (quoted form of (POSIX path of (stuffFolder & ".zip")))

To perform the compressing, that way I don’t have progress bars popping up outside of my app. But I’m considering using something like this:

tell process "Finder" to click (first menu item of menu 1 of menu bar item "File" of menu bar 1 whose name begins with "Create Archive")

So that I will see a “real” progress bar in the finder, but I would really prefer to have a “real” progress bar in my app, so that the user will be able to see that the script is doing it’s job, and everything is moving along.

Any ideas would be greatly appreciated.

Thanks,
Brian

Use NSTask via Objective-C instead. :confused:

Hi Brian,

there is always a reason for any unexpected behavior.
I recommend to debug the code. Include an effective error handling or log certain variables to find out, why (and where) the app hangs

Thanks for the replies.

Stefan, I am working on finding the problem in my code. It’s just tough to track down because it’s intermittent. I’ve tried error trapping different sections of the code, but ultimately, I want to have a progress bar that will track the progress of the compression.

Thanks for the idea Bruce, now I’m off to try to figure out how to write something in Objective-C!

Thanks again
Brian