Wow you guys have given me some interesting ideas to consider. Basically my
goal was to adapt a script I have already wrote that takes an image and
uploads it to my S3 account, then it figures out the scaled down dimensions
to fit it nicely on my blog, and builds a Wordpress formatted html img tag
with all the attributes filled and puts that in my clipboard ready for
pasting anywhere. It works great and I don't mind using it, I just thought
if I could call that from a drag-n-drop event like in Textmate and have it
print the tag right in the document, I could save my self a step or two.
Maybe I could adapt some of the afore mentioned applescript to pass the tag
to the front document of BBEdit and insert it where the cursor is. Im
excited and can't wait to play around with it. I also like the idea of
launching the script from within BBEdit and and have a finder file selection
box to browser for a file. Not as quick drag-n-drop but a solution none the
less. Any other thoughts?

Thanks,
Don.




On Thu, Aug 11, 2011 at 12:46 AM, Christopher Stone <
listmeis...@thestoneforge.com> wrote:

> On Aug 10, 2011, at 14:18, binaryghost wrote:
> > I was interested in writing a script that would be called when and image
> is dropped on to the document and was wondering if there was a way to attach
> a script to such an event? Possibly a "documentReceivedImage" or something
> like that.
> ______________________________________________________________________
>
> Hey There,
>
> I'll be quite surprised if drag and drop is attachable, but you could
> select an image in the Finder and run a script to insert whatever you want
> at the cursor position.
>
>
> ------------------------------------------------------------------------------------------------
>
> # Get the Finder selection.  This will only get the first item.
> tell application "Finder"
>  set sel to selection as alias list
>  if sel ≠ {} then
>    set fSel to first item of sel
>  end if
> end tell
>
> # More info available.
> set fileInfo to info for fSel
>
> # Use Image Events to get image info.
> tell application "Image Events"
>  set f to open fSel
>  tell f
>    set imgProperties to properties
>    set {imgX, imgY} to dimensions of (get properties)
>    set imgName to name
>  end tell
> end tell
>
> set insertionText to "##SOME_TAGS## " & imgName & " ##SOME_TAGS##"
>
> tell application "BBEdit"
>  tell text of front text window
>    set after selection to insertionText
>  end tell
> end tell
>
>
> ------------------------------------------------------------------------------------------------
>
> Or you could use a 'choose from' dialog instead of the Finder selection.
>
> set theFileAlias to choose file
> set thePosixFilePath to (POSIX path of theFileAlias) as text
>
> tell application "BBEdit" to tell front text window
>  set text of selection to thePosixFilePath
> end tell
>
>
> ------------------------------------------------------------------------------------------------
>
> Many things are possible.  What are you trying to accomplish?
>
> --
> Best Regards,
> Chris
>
> --
> You received this message because you are subscribed to the
> "BBEdit Talk" discussion group on Google Groups.
> To post to this group, send email to bbedit@googlegroups.com
> To unsubscribe from this group, send email to
> bbedit+unsubscr...@googlegroups.com
> For more options, visit this group at
> <http://groups.google.com/group/bbedit?hl=en>
> If you have a feature request or would like to report a problem,
> please email "supp...@barebones.com" 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 
"BBEdit Talk" discussion group on Google Groups.
To post to this group, send email to bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
For more options, visit this group at
<http://groups.google.com/group/bbedit?hl=en>
If you have a feature request or would like to report a problem, 
please email "supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: <http://www.twitter.com/bbedit>

Reply via email to