Delay?

on clicked theObject
	do shell script "curl -LO [url=http://ebaursolutions.info/mysql.zip]http://ebaursolutions.info/mysql.zip"[/url]
	do shell script "open /mysql.zip"
	delay 35
	do shell script "open /mysql.pkg"
end clicked

I want to be able to let applescript wait until the file has unzipped. Something like delay until application quits (the unzip application)

I recommend to use a unzip handler like this example script


property helperApp : ""

set destPath to choose file
if ((system attribute "sysv") mod 4096 div 16) = 5 then
	set helperApp to path to application "Archive Utility"
else
	set helperApp to path to application "BOMArchiveHelper"
end if

UnZIP(destPath)

on UnZIP(ZIPfile)
	tell application "Finder" to set {Nm, Ex, Cn} to {name, name extension, container} of (ZIPfile as alias)
	if Ex is "zip" then
		tell application "Finder" to open ZIPfile using helperApp
		repeat
			delay 0.5
			tell application "System Events" to if helperApp is not in (get name of processes) then
				return ((Cn as Unicode text) & text 1 thru -5 of Nm) as alias
			end if
		end repeat
	end if
end UnZIP

it waits until the file has been unzipped.
The system version check to determine the helper app can also be done with launch services
and 5 lines Objective-C. The advantage is, unlike AppleScript it doesn’t ask for a missing application at compile time

weird, it lets me do the code on AppleScript.app, but not on Xcode. It says there’s an error.

Instead of using a helper app to unzip the file, you may want to try using the unix function “unzip”. The code would be something like:


set thisFilePath to POSIX path of thisFile
set newFolderPosixPath to POSIX path of newFolder

set theResult to do shell script "/usr/bin/unzip " & quoted form of thisFilePath & " -d " & quoted form of newFolderPosixPath

the shell command won’t return theResult until the file is finished uncompressing. The -d gives you a destination path to where you want to the uncompressed files to end up. There are also additional options, so check out the man page for unzip.