Progress Panel as sheet

You can display any window as a sheet, so it’s just a matter of building your own window.

@shane,
Would it be too much to ask you for an example?

It’s not code – you create a new window in Xcode. Add whatever buttons you want, and connect them to handlers that close the sheet. Then have your main window call beginSheet:completionHandler:, passing an outlet to the sheet window and missing value.

@shane,
I try this but not working:

script AppDelegate
	property parent : class "NSObject"
	
	-- IBOutlets
	property theWindow : missing value
    property Window : missing value ---outlet for the new window
	
	on applicationWillFinishLaunching_(aNotification)
		-- Insert code here to initialize your application before any files are opened 
	end applicationWillFinishLaunching_
	
	on applicationShouldTerminate_(sender)
		-- Insert code here to do any housekeeping before your application quits 
		return current application's NSTerminateNow
	end applicationShouldTerminate_
    
    on openSheet:sender
        tell class "NSApplication" of current application
            its sharedApplication's beginSheet_modalForWindow_modalDelegate_didEndSelector_contextInfo_(Window, theWindow, me, missing value, missing value)
          end tell
        end openSheet:
    end script[/AppleScript]
button "Open" is create in the mainWindow aka theWindow.

Perhaps you should try what I posted.

on openSheet:sender
        theWindow's beginSheet:Window completionHandler:(missing value)
  end openSheet:

I’m sorry, I’m slow to understand but I get there.
thanks, again!

Could you tell me how I do the same using:

runModal ()

I tried:

stopModal ()

but to no avail here.

Try:

current application's NSApp's stopModal()

Hey @Shane,

Unfortunately it didn’t work for me.
I am currently displaying an Sheet Alert
as follows:

set alert to current application's NSAlert's alloc's init()
        tell alert
            its setAccessoryView:customView
            its setMessageText:"blahblahblah"
            its setInformativeText:"blahblahblah"
            its setAlertStyle:1
            its addButtonWithTitle:false
            its setShowsSuppressionButton:false
            its beginSheetModalForWindow:theWindow completionHandler:(missing value)
        end tell

and to close automatically after the processes are completed I’m using what you suggested to me:

theWindow's endSheet:(theWindow's attachedSheet())

Worked very well until Catalina 10.15.6
but it looks like everything has changed in Big Sur, so
my desire to use

runModal ()

.

Go here:

https://macosxautomation.com/applescript/apps/helpers.html

and add the alert stuff to your project.