• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: tabs to spaces
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: tabs to spaces


  • Subject: Re: tabs to spaces
  • From: Michelle Steiner <email@hidden>
  • Date: Sun, 30 Nov 2008 17:35:48 -0700

On Nov 30, 2008, at 3:04 PM, Scott Haneda wrote:

Can anyone help me get started.

Here is an Applescript solution:

set theString to "abc" & tab & "defgh" & tab & "123456" & tab & "QT"
set text item delimiters to tab
set wordList to text items of theString
set text item delimiters to ""
set x to 0
repeat with thisItem in the wordList
if length of contents of thisItem is greater than x then set x to length of contents of thisItem
end repeat
set filler to space
repeat 71 times
set filler to filler & space
end repeat
set NewWordList to {}
display dialog "Do you want the words to be left justified or right justified?" & return & ¬
"How many spaces between words?" default answer ¬
"" buttons {"Left justified", "Right Justified", "Cancel"} default button "Cancel"
set {justificate, spacing} to {button returned, text returned} of the result
repeat with thisWord in wordList
if justificate is "right justified" then
set the NewWordList to the NewWordList & text -(x + spacing) through -1 of (filler & thisWord)
else
set the NewWordList to the NewWordList & text 1 through (x + spacing) of (thisWord & filler)
end if
end repeat
NewWordList as text

-- 
The reason that so few people think outside the box is that all the pay and benefits are inside the box.

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

References: 
 >tabs to spaces (From: Scott Haneda <email@hidden>)

  • Prev by Date: Re: tabs to spaces
  • Next by Date: Re: tabs to spaces
  • Previous by thread: Re: tabs to spaces
  • Next by thread: Re: tabs to spaces
  • Index(es):
    • Date
    • Thread