Type an abbreviation for the text conversion option you want, e.g. Hold ⌘Space or use your shortcut for Instant Send (I use a single Option tap) Whenever you have a text item selected in LaunchBar, you can press ⇧↩ to paste that text in the frontmost application.Įven better, if you have a text item selected and send that to a text processing action (by using Instant Send as you suggested or Send To by pressing ⇥), that ⇧↩ executes that action first, then pastes the result in the frontmost application. In addition to what Nigel wrote before, there’s another way you could speed this up. Thanks to Nigel to point out Instant Send and the other tips! (newPBItem's setData:theData forType:aType)įirst off: I’m one of the developers of LaunchBar. Set theData to (anItem's dataForType:aType)'s mutableCopy() for each type, get the corresponding data and store it all in the new pasteboard item get the types of data stored on the pasteboard item Set newPBItem to current application's NSPasteboardItem's alloc()'s init() make a new pasteboard item to store existing item's stuff Repeat with anItem in thePasteboard's pasteboardItems() Set thePasteboard to current application's NSPasteboard's generalPasteboard() get the pasteboard and then its pasteboard items Set aMutableArray to current application's NSMutableArray's array() - used to store contents Tell application "System Events" to keystroke "c" using ĭelay 1 - Without this, may restore clipboard before pasting. I ended up giving up on services entirely and used GUI scripting and the clipboard to get and set the selected text: my process("/Users/mjt/Library/Application Support/BBEdit/Text Filters/titlecase.py") However, GUI scripting the menu bar doesn’t seem to work in MarsEdit, one of the apps where I would use the scripts most frequently. Set _menuItem to menu item _serviceName of _servicesMenu Set _servicesMenu to menu 1 of menu item "Services" of _appMenu Set _frontApp to first application process whose frontmost is true I wrote a script to use GUI scripting to invoke my service from the Services menu: my runServiceNamed("Title Case") How about using FastScripts to assign keyboard shortcuts and run the scripts? Unfortunately, most applications are not scriptable enough to access the selected text. This is fine for occasionally used scripts, where keyboard shortcuts would not be practical, but not for ones I use many times per day. However, this takes multiple steps: long Command-Space to load the text, Tab, type the name of the script/service, Command-Shift-C to copy the result text and paste it back. My first thought was to use LaunchBar, which I knew could get and replace the selected text (either using a script or a service). The Keyboard preferences pane is awkward to use, so that it takes a long time to go through the list checking and unchecking the appropriate boxes. This makes the Services contextual menu unwieldy. It also forgets which services I’ve enabled and disabled, hiding my favorite scripts and bringing back dozens of commands that I never use. They still show up in System Preferences, but they usually don’t work. Over the last few months, keyboard shortcuts for system services (and PDF services) have become unreliable. Then I would assign keyboard shortcuts in System Preferences and have easy access to the scripts from any app. I’ve long used ThisService to create system services out of shell scripts that sort lines, smarten quotes, and apply title case. It seems like it should be easy to run the selected text in any app through a shell script, but I’ve run into a surprising number of issues doing this.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |