On May 21, 2014, at 09:43, David Weinberger <[email protected]> wrote:
> But, in a perfect world, I'd have a script in BBedit that lets me automate
> that further, possibly as follows:
______________________________________________________________________
Hey David,
You realize Keyboard Maestro can do multi-text-field user-input - yes? You
HAVE to read the relevant section of the manual to discover all the options
though - they are NOT all evident in the editor.
I'm currently rewriting my old rename script for the Finder and using such a
thing:
What you want to do is dead simple with KM and a bit of AppleScript.
-------------------------------------------------------------------------------------------
# This script is not turnkey, but it should get you close.
-------------------------------------------------------------------------------------------
# Your Keyboard Maestro macro needs two text input fields named d1 & d2.
-------------------------------------------------------------------------------------------
tell application "Keyboard Maestro Engine"
set d1 to value of variable "d1"
set d2 to value of variable "d2"
end tell
set d1 to "[^" & d1 & "]"
set d2 to d1 & d2 & ")"
tell application "BBEdit"
tell front text window
set selection to d1
set bbrep to replace "\\s*\\Z" using ("\\n\\n" & d2 & "\\n\\n") options
{search mode:grep, starting at top:true}
end tell
end tell
-------------------------------------------------------------------------------------------
You can of course put default values in the variables in KM, and you might even
be able to place the cursor in the text-input-field at a specified location
within the default text (I can't remember for certain at the moment).
--
Best Regards,
Chris
--
This is the BBEdit Talk public discussion group. If you have a
feature request or would like to report a problem, please email
"[email protected]" rather than posting to the group.
Follow @bbedit on Twitter: <http://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].