close panel without user interaction???

I have a situation where my app sends a script to the terminal and i have a custom modal panel open so that the user can’t do anything to the app while the process is running in the terminal…i have a loop set up to determine when the terminal process has ended, and at that point i want to have the panel automatically close letting the user know that it’s ok to do something else. here’s what my code looks like…

on showStatus()
	if statusPanel is equal to missing value then
		set statusPanel to window "statusWindow"
		set indeterminate of progress indicator "progressBar" of window "statusWindow" to true
		tell progress indicator "progressBar" of window "statusWindow" to start
	end if
	
	display statusPanel
	
	set n to 0
	delay 1
	repeat until n > 0
		set x to do shell script "ps cax | awk '/extract-xiso/{print $5}'"
		if not x = "extract-xiso" then
			set n to 1
		end if
	end repeat
	
	close panel statusPanel
end showStatus

the problem I’m having is, the panel won’t close! how do i get the panel to automatically close on its own at the end of that function? thanks in advance!

Does this work?

Jon


[This script was automatically tagged for color coded syntax by Convert Script to Markup Code]

nope :cry: didn’t work…panel still stays open! stubborn thing!
it works just fine if i display the panel attached to the main window…but once i display it as a modal panel…it doesn’t close.

maybe by treating the modal as attached ?

close panel window “statusWindow” of window “main”

btw does the progress indicator stop right ?

no…the progress indicator doesn’t stop…strange

did you try this ?

tell progress indicator “progressBar” of window “statusWindow” of window “main” to stop
close panel window “statusWindow” of window “main”

:? that didn’t work either!

I have played arround similar problems but when I succeed to close the modal panel, my application was still in modal state.

Can’t you disable a button “OK” and enable it once done and let the user close it?

Eventually add a text job report in the panel once the job is done to make the user happy and think he didn’t lost his time ;-).