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: