diff --git a/netbeans-wrapper.applescript b/netbeans-wrapper.applescript index d5ae26d..c2fa4c5 100644 --- a/netbeans-wrapper.applescript +++ b/netbeans-wrapper.applescript @@ -1,6 +1,15 @@ +use AppleScript version "2.4" +use scripting additions +use framework "Foundation" +use framework "AppKit" -- for NSEvent + +property NSEvent : a reference to current application's NSEvent +property NSAlternateKeyMask : a reference to 524288 + property netBeansBinary : null on run + if my optionKeyIsDown() then set netBeansBinary to null if netBeansBinary is null then set nbApp to choose file ¬ with prompt "Please locate the file “netbeans” in your “netbeans11/bin” directory" ¬ @@ -22,6 +31,15 @@ runNetBeans(commandString) end open +on optionKeyIsDown() + set theFlag to NSEvent's modifierFlags() as integer + if ((theFlag div NSAlternateKeyMask) mod 2) = 0 then + return false + else + return true + end if +end optionKeyIsDown + on runNetBeans(commandString) set commandString to commandString & " >/dev/null 2>&1 &" do shell script commandString