The code,
// Create a simple dialog box
var app = Application.currentApplication();
app.includeStandardAdditions = true;
// Show a dialog box
var userResponse = app.displayDialog("Welcome to MyApp! Click OK to continue.", {
buttons: ["OK"],
defaultButton: "OK"
});
// Run your shell script if OK is clicked
if (userResponse.buttonReturned === "OK") {
try {
app.doShellScript("~/Desktop/MyApp.app/Contents/MacOS/MyApp");
app.displayDialog("MyApp executed successfully!", {
buttons: ["OK"],
defaultButton: "OK"
});
} catch (err) {
app.displayDialog("An error occurred: " + err.message, {
buttons: ["OK"],
defaultButton: "OK"
});
}
}
Script Editor returns with Error -1,752, can you fix my code? Using JS, you can give a AppleScript response. File extension is .app
A dialog box was what I was expecting, but returned with error 1752, I checked everything, nothing changed. This has gone on for 17 years [2007]