Macos 单击applescripts xcode项目中的按钮时如何最小化xib窗口
我创建了一个苹果脚本xcode。其中main.xib是一个带有两个按钮的窗口。单击一个按钮时,我正在运行一个shell脚本,单击另一个按钮时,我正在运行另一个shell脚本,我在Appdelegate.applescript中添加的所有这部分代码。我想在这里做的是,当我单击按钮时,main.xib窗口仍保持在屏幕上。我想关闭它。请有人帮助我如何通过在Appdelegate.applescript上添加代码来实现这一点Macos 单击applescripts xcode项目中的按钮时如何最小化xib窗口,macos,xcode7,applescript-objc,Macos,Xcode7,Applescript Objc,我创建了一个苹果脚本xcode。其中main.xib是一个带有两个按钮的窗口。单击一个按钮时,我正在运行一个shell脚本,单击另一个按钮时,我正在运行另一个shell脚本,我在Appdelegate.applescript中添加的所有这部分代码。我想在这里做的是,当我单击按钮时,main.xib窗口仍保持在屏幕上。我想关闭它。请有人帮助我如何通过在Appdelegate.applescript上添加代码来实现这一点 script AppDelegate property parent
script AppDelegate
property parent : class "NSObject"
-- IBOutlets
property theWindow : missing value
on button1Clicked_(sender)
do shell script " sudo example.sh" with administrator privileges
end button1Clicked_
on button2Clicked_(sender)
do shell script " sudo exapmle1.sh " with administrator privileges
end button2Clicked_
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_
end script
请有人帮助我了解在applicationShouldTerminate和applicationwillfinishlaunching下可以添加什么类型的代码
我不熟悉这一点,请帮助我在哪里可以获得有关此的更多信息如果要在执行脚本后立即关闭窗口,可以在每个按钮的处理程序末尾添加以下内容:
窗口的性能关闭:me
您还可以创建一个按钮,其处理程序仅包含该代码,以便该按钮将关闭窗口