1
我正在尝试使用无法关闭的applescript制作应用程序。不幸的是,用applescript'googling'保护窗口带来了'制作假病毒'和'制作密码保护应用程序'等结果。请帮忙!你如何在applescript中创建受保护的窗口?
我正在尝试使用无法关闭的applescript制作应用程序。不幸的是,用applescript'googling'保护窗口带来了'制作假病毒'和'制作密码保护应用程序'等结果。请帮忙!你如何在applescript中创建受保护的窗口?
您还没有真正了解AppleScript,Objective-c或applescriptObjc的知识。
但我会离开你这个:
use scripting additions
use framework "Foundation"
use framework "cocoa"
property aWindow : class "NSWindow"
property aWindow2 : class "NSWindow"
set height to 350
set width to 250
set winRect to current application's NSMakeRect(500, 500, width, height)
set aWindow to current application's NSWindow's alloc()'s initWithContentRect:winRect styleMask:1 backing:2 defer:false
set winRect to current application's NSMakeRect(751, 500, width, height)
--resizable window
set aWindow2 to current application's NSWindow's alloc()'s initWithContentRect:winRect styleMask:9 backing:2 defer:false
(* Thiese button is for when you test in SE, otherwise you will need to quit SE*)
set closeButtonFrame to current application's NSMakeRect(25, (height - 40), 200, 25)
set closeBtn1 to current application's NSButton's alloc's initWithFrame:closeButtonFrame
closeBtn1's setTitle:"close (for testing)"
set closeBtn1's bezelStyle to 12 --NSRoundedBezelStyle
closeBtn1's setButtonType:0 --NSMomentaryLightButton
closeBtn1's setTarget:me
closeBtn1's setAction:"closeWindow1:"
aWindow's contentView's addSubview:closeBtn1
set closeBtn to current application's NSButton's alloc's initWithFrame:closeButtonFrame
closeBtn's setTitle:"close (for testing)"
set closeBtn's bezelStyle to 12 --NSRoundedBezelStyle
closeBtn's setButtonType:0 --NSMomentaryLightButton
closeBtn's setTarget:me
closeBtn's setAction:"closeWindow:"
aWindow2's contentView's addSubview:closeBtn
aWindow2's makeKeyAndOrderFront:aWindow2
aWindow's makeKeyAndOrderFront:aWindow
on closeWindow1:sender
aWindow's orderOut:aWindow
end closeWindow1:
on closeWindow:sender
aWindow2's orderOut:aWindow2
end closeWindow: