GitBucket
4.21.2
Toggle navigation
Snippets
Sign in
Files
Branches
1
Releases
Issues
Pull requests
Labels
Priorities
Milestones
Wiki
Forks
nigel.stanger
/
netbeans-wrapper
Browse code
Added option key detection to reset path
master
1 parent
d122e0d
commit
d70e588a4d52901b30e057d26d069e40f296de95
Nigel Stanger
authored
on 25 Jul 2019
Patch
Showing
1 changed file
netbeans-wrapper.applescript
Ignore Space
Show notes
View
netbeans-wrapper.applescript
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" ¬ default location "/Applications" of type ("public.unix-executable") set netBeansBinary to POSIX path of nbApp end if runNetBeans(netBeansBinary) end run on open theItems set commandString to netBeansBinary & " " repeat with thisItem in theItems tell application "System Events" set itemProperties to thisItem's properties set itemPath to POSIX path of itemProperties end tell set commandString to commandString & quoted form of itemPath & " " end repeat 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 end runNetBeans
property netBeansBinary : null on run if netBeansBinary is null then set nbApp to choose file ¬ with prompt "Please locate the file “netbeans” in your “netbeans11/bin” directory" ¬ default location "/Applications" of type ("public.unix-executable") set netBeansBinary to POSIX path of nbApp end if runNetBeans(netBeansBinary) end run on open theItems set commandString to netBeansBinary & " " repeat with thisItem in theItems tell application "System Events" set itemProperties to thisItem's properties set itemPath to POSIX path of itemProperties end tell set commandString to commandString & quoted form of itemPath & " " end repeat runNetBeans(commandString) end open on runNetBeans(commandString) set commandString to commandString & " >/dev/null 2>&1 &" do shell script commandString end runNetBeans
Show line notes below