Applescript: how can I align tab columns?

Discussion in 'Mac Programming' started by gunpowda, Oct 14, 2007.

  1. gunpowda macrumors member

    Joined:
    Oct 31, 2004
    #1
    Hi,

    I'm trying to write some song information from iTunes to a text file. I currently have:

    set combination to var_artist & tab & var_name & tab & var_album & return

    This produces something like:

    Code:
    Bob Dylan   Idiot Wind        Blood on the Tracks
    Bob Dylan   Shelter From The Storm    Blood On The Tracks
    Bob Dylan   Subterranean Homesick Blues       Bringing It All Back Home
    
    [MacRumors won't let me post tabs, it seems, so I've tried to illustrate the point with spaces.]



    I'd like it to align in columns, so it's easier to read, like this:

    Code:
    Bob Dylan   Idiot Wind                        Blood on the Tracks
    Bob Dylan   Shelter From The Storm            Blood On The Tracks
    Bob Dylan   Subterranean Homesick Blues       Bringing It All Back Home
    
    Am I looking for something other than the tab character? How can I get this to work?
     
  2. Mekanik561 macrumors newbie

    Joined:
    Feb 10, 2007
    #2
    I believe tab alignment is handled by the app viewing the text file. A tab is just a character. It's up to TextEdit, Word, or whatever to change and display the tab value.

    Or you may be able to fake it by counting the characters of the column and adding extra tabs, but there are a lot of gotchas involved. Better to apply formatting/styling in the viewing app.
     
  3. WildPalms macrumors 6502a

    WildPalms

    Joined:
    Jan 4, 2006
    Location:
    Honolulu, HI

Share This Page