Enhanced applet issue quiting

(marshall) #1

For some reason if I save my applet as enhanced it never really quits using:

my |quit|:sender 


if (name of current application) is not "Script Debugger" then
    tell current application
    end tell
end if

if I save it as a standard applet it quits normally.
The only reason I discovered the issue is I quit and re-opened it and the menus did not appear. When I resaved in script debugger it asked if I wanted to quit the applet and save.

Any idea why this is happening?

(marshall) #2

It is definately specific to Enhanced Applet. Related to another post: Continue quit not working in enhanced applet @ShaneStanley @alldritt Any suggestions how to work around this temporarily?

(marshall) #3

I did find 2 temporary workarounds

seemingly the safer way:

set theApp to quoted form of "quit app \"Your App Name Here\""
do shell script "osascript -e " & theApp


do shell script "killall FancyDroplet"

the downside to this is it will kill all FancyDroplets running. Is there a way to rename the fancydroplet? I tried to do and change in info.plist without success.

(Shane Stanley) #4

All you need is a simple:


(Please wrap your code here in lines containing just three back-ticks, so it formats correctly.)

(marshall) #5

Thank you for the response. Unfortunately it doesnt work with quit. I think it has to do with being a menubar app and setting Application is agent to true. Quit works as applet but not enhanced applet. I tried on a few menubar app samples I found online. Not sure why this works though:

set theApp to quoted form of “quit app “Your App Name Here””
do shell script "osascript -e " & theApp

(Shane Stanley) #6

Can you email me an example?

(Mark Alldritt) #7

I’m having trouble reproducing this problem here. I’ve tried a few things:

  1. Quitting from the on run handler:

    set shouldQuit to button returned of (display alert "Shall I quit" buttons {"OK", "Cancel"} default button "OK") = "OK"
    if shouldQuit then
    end if

    This works as expected, the applet quits.

  2. From an on idle handler:

    on idle
    	set shouldQuit to button returned of (display alert "Shall I quit" buttons {"OK", "Cancel"} default button "OK") = "OK"
    	if shouldQuit then
    	end if
    	return 10
    end idle

I also tried replacing the bare quit command with the code you cite. but there is no difference:

if (name of current application) is not "Script Debugger" then
    tell current application
    end tell
end if

(marshall) #9

I forwarded the example file to you.

(chris) #10

Sorry to reply here but I have the same issue
my app is quit perfectly when the process is Finnish but if I open the app and closed by the red button the app still open in the finder?

See image

(chris) #11

try this

tell application "Your app name"
end tell

(Ed Stockly) #12

If the enhanced app window is closed the app does not quit. There does not seem to be a way to react to the window being closed. If the user clicks close the window closes but reopens again if progress is used.

Also I’ve noticed sometimes the enhanced apps don’t act the same way standard apps do when finished executing. They remain open, with their icon in the dock, rather than quitting.

(Ed Stockly) #13

Here’s an example. Save this script as an enhanced app and as an Apple app.

In the enhanced version the quit menu halts the script. It doesn’t run, it can’t quit and must be forced quit. Clicking stop, or selecting Quit from the dock doesn’t work. Force quitting is the only thing that works. Adding a “tell me to quit” to the quit handler doesn’t help.

In the standard version the quit menu has no effect.

In the enhanced version clicking the close window button closes the window, but it opens again at the next Progress update.

In the standard app the close window button is inactive.

property progressRecord : {ProgressTotalSteps:-1, progressCompletedSteps:0, progressDescriptionText:"", progressAdditionalDescriptionText:""}

on run
   repeat with x from 1 to 20
      delay 1
      set ProgressTotalSteps of progressRecord to 20
      set progressCompletedSteps of progressRecord to x
      --set progressDescriptionText of progressRecord to ""
      --set progressAdditionalDescriptionText of progressRecord to ""
      my updateProgress()
   end repeat
end run
on quit
   continue quit
end quit
on updateProgress()
   -- {ProgressTotalSteps:-1, progressCompletedSteps:0, progressDescriptionText:"", progressAdditionalDescriptionText:""}
   tell progressRecord
      set totalSteps to its ProgressTotalSteps
      set completedSteps to its progressCompletedSteps
      set descriptionText to its progressDescriptionText
      set addDescriptionText to its progressAdditionalDescriptionText
   end tell
   set progress total steps to totalSteps
   set progress completed steps to completedSteps
   set progress description to descriptionText
   set progress additional description to addDescriptionText
end updateProgress