Skip navigation

choosing which line to copy with AppleScript

597 Views 2 Replies Latest reply: Mar 30, 2011 7:35 AM by cthibos RSS
cthibos Calculating status...
Currently Being Moderated
Mar 30, 2011 6:38 AM
Hi guys,

I am having a simple problem making applescript choose which line from a textwrangler document to copy. It's very simple, all I want it to do is the following.

1)Check to see if line 22 is just a carriage return
2) If it is, copy line 13 to the clipboard
3) If it's not, copy line 22 to the clipboard

My current code is this:


tell application "TextWrangler"
     activate
     if contents of line 22 of window 1 is "\r" then <--this is really two backslashes before the r
               copy line 13 of window 1
     else
               copy line 22 of window 1
     end if
end tell

Any help would be appreciated.

Thanks!

Cameron
MacBookPro, Mac OS X (10.6.7)

Actions

More Like This

  • Retrieving data ...

Bookmarked By (0)

Legend

  • This solved my question - 10 points
  • This helped me - 5 points
This site contains user submitted content, comments and opinions and is for informational purposes only. Apple disclaims any and all liability for the acts, omissions and conduct of any third parties in connection with or related to your use of the site. All postings and use of the content on this site are subject to the Apple Support Communities Terms of Use.