1 Reply Latest reply: Jan 11, 2013 12:55 PM by Jeff Shenk
zachfromcupertino Level 1 Level 1 (0 points)

I have just started working with applescript instead of automator. I tried to make a program which added a column in a spreadsheet after a, then filled the top ten rows of that collumn with the word name. Why does the following code not work?:

 

set thisCSVFile to choose file

if (thisCSVFile as string) ends with ".csv" then

tell application "Numbers"

open thisCSVFile

tell front document

tell table 1 of sheet 1

add column after column "A"

repeat with a from 1 to 10

set value of cell a of column "B" to "name"

end repeat

end tell

end tell

end tell


iMac, Mac OS X (10.7)
  • 1. Re: Applescript iWork error
    Jeff Shenk Level 4 Level 4 (2,115 points)

    As presented above, your script is missing the final "end if" but you should get an error message telling you that when you try to compile it.

     

    I added that final end statement and ran it with a csv file I had and, as far as I could tell, it did what it was supposed to do. What doesn't work for you?