Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- tell application "System Events"
- try
- set callingEditor to 1st process whose name is "TextWrangler" or name is "BBEdit"
- on error
- tell me to quit
- end try
- set appName to the name of callingEditor
- end tell
- set tmpFile to ""
- tell application appName
- using terms from application "BBEdit"
- set numdocs to the number of every text document
- end using terms from
- end tell
- if numdocs > 0 then
- tell application appName
- using terms from application "BBEdit"
- set myText to get text of active document of window 1
- end using terms from
- end tell
- set randomNumber to random number from 1 to 1000
- set tmpFile to "/tmp/relnote-" & randomNumber & ".mdown"
- set theFileReference to open for access tmpFile with write permission
- write myText to theFileReference
- close access theFileReference
- set home to do shell script "echo $HOME"
- set relnote to do shell script "source " & (the quoted form of POSIX path of home) & "/.profile && which relnote"
- set cmd to relnote & " " & (the quoted form of POSIX path of tmpFile)
- do shell script cmd
- end if
Add Comment
Please, Sign In to add comment