Can DoCommand(“CloseProject”) be run from a xojoscript and also dismiss any confirmation dialog?


DoCommand(“CloseProject”) behaves as if you selected the specific menu item. If this then requires a response to a dialog to confirm closing & saving it does not respond to that dialog.

I would like a way to close the project without an automated build script being interrupted.

DoCommand “SaveFile”
dim Count as Integer = WindowCount
dim x as Integer
for x = 0 to Count
DoCommand “CloseWindow”

Thanks, but I don’t want it to be saved. CloseProject causes a ‘Do you want to save’ dialog box, which I would like to automatically dismiss.

I usually open copies of projects for automated building and than call save always to be sure the dialog doesn’t show up.

I’ve found a solution

The xojoscript has this after the build process

  //Close Xojo
  result = DoShellCommand("osascript /Documents/CloseXojo.scpt")

CloseXojo.scpt contains

delay (1)
tell application "System Events"
	keystroke "d" using {command down}
end tell

Works a treat.