On 02/07/2019, at 13:46, Tom Schulte <[email protected]> wrote:Is there a way to have the program accept the copy command data generated from another app and insert it into a txt file? Hey Tom, Do I understand correctly that you want to save the Clipboard from another app to this BBEdit “PasteBoard” file? If so then yes. But you need to be able to run an AppleScript from a the global context in macOS. I recommend FastScripts. FastScripts' free/demo mode allows unlimited scripts but only 10 assignable app-specific and global keyboard shortcuts. The free version is often enough for people with modest macro needs. The full version costs $9.95 U.S. and unlocks unlimited app-specific and global keyboard shortcuts. I've used it since 2003. ** Those wanting more a more powerful and flexible automation utility should see Keyboard Maestro. Install the appended compiled AppleScript file in this folder: ~/Library/Scripts/ Fire up FastScripts, open its menu (in the menu bar), and select the script file with the Cmd-key depressed. You'll get a dialog allowing you to set a keyboard shortcut for the script. Now all you have to do is hit Cmd-C and then your keyboard shortcut to copy to your BBEdit pasteboard. Let me know if you have problems or questions. -- Best Regards, Chris This is the BBEdit Talk public discussion group. If you have a feature request or need technical support, please email "[email protected]" rather than posting to the group. Follow @bbedit on Twitter: <https://www.twitter.com/bbedit> --- You received this message because you are subscribed to the Google Groups "BBEdit Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/bbedit. |
<<attachment: Send_the_Clipboard_to_document____BBEditPasteBoardFile.txt____in_BBEdit.scptd.zip>>
---------------------------------------------------------------- # Auth: Christopher Stone # dCre: 2019/02/07 14:31 # dMod: 2019/02/07 14:44 # Appl: BBEdit # Task: Send the Clipboard to document ‘BBEditPasteBoardFile.txt’ in BBEdit. # Libs: None # Osax: None # Tags: @Applescript, @Script, @BBEdit, @Save, @Send, @Clipboard ---------------------------------------------------------------- --» USER SETTING -- Pasteboard file location and name. ---------------------------------------------------------------- set myPasteBoardFile to "~/Desktop/BBEditPasteBoardFile.txt" ---------------------------------------------------------------- try if myPasteBoardFile starts with "~" then set myPasteBoardFile to expandTilde(myPasteBoardFile) set pasteboardFileName to last item of splitStr(myPasteBoardFile, "/") of me set LF to linefeed set sepLine to "----------------------------------------------------------------" if not itemExistsAtPath(myPasteBoardFile) then do shell script "touch " & quoted form of myPasteBoardFile end if set textFromClipboard to the clipboard tell application "BBEdit" open myPasteBoardFile tell text document pasteboardFileName set end of its text to textFromClipboard & LF & LF & sepLine & LF & LF tell it to save end tell end tell on error e number n set e to e & return & return & "Num: " & n if n ≠ -128 then try tell application (path to frontmost application as text) to set ddButton to button returned of ¬ (display dialog e with title "ERROR!" buttons {"Copy Error Message", "Cancel", "OK"} ¬ default button "OK" giving up after 30) if ddButton = "Copy Error Message" then set the clipboard to e end try end if end try ---------------------------------------------------------------- --» HANDLERS ---------------------------------------------------------------- on expandTilde(pathStr) if pathStr is "~" or pathStr is "~/" then set pathStr to POSIX path of (path to home folder as text) else if pathStr starts with "~/" then set pathStr to (POSIX path of (path to home folder as text)) & text 3 thru -1 of pathStr else error "Bad path string!" end if end expandTilde ---------------------------------------------------------------- on itemExistsAtPath(pathStr) try if pathStr is "~" or pathStr is "~/" then set pathStr to (POSIX path of (path to home folder as text)) else if pathStr starts with "~/" then set pathStr to (POSIX path of (path to home folder as text)) & text 3 thru -1 of pathStr end if if pathStr starts with "/" then alias POSIX file pathStr else alias pathStr end if return true on error return false end try end itemExistsAtPath ---------------------------------------------------------------- on splitStr(_str, _delim) set {oldTIDS, AppleScript's text item delimiters} to {AppleScript's text item delimiters, _delim} set newList to text items of _str set AppleScript's text item delimiters to oldTIDS return newList end splitStr ---------------------------------------------------------------- This is the BBEdit Talk public discussion group. If you have a feature request or need technical support, please email "[email protected]" rather than posting to the group. Follow @bbedit on Twitter: <https://www.twitter.com/bbedit> --- You received this message because you are subscribed to the Google Groups "BBEdit Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/bbedit. |
