every item of all page items whose label is "MySlugFrame"
It doesn't work, I get en error message saying, Can't get every item of all page items whose label = "MySlugFrame"
I've tried to remove "all" from the code to see if it would work but to no avail.
I found the doc and the example script ScriptLabel, though, I'll have a look at it and try to figure it out. In the mean time, if you have a solution for me, please feel free to help:-)
does your script have a "tell document 1" statement? You need that (maybe you omitted it for brevity).
I'm still struggling with lists and how to use them properly. I've haven't touch scripting for a while and I'm just trying to migrate my CS4 script to CS5 but that change in page item structure messed up that script really bad. I found that I could do a if.. then statement like this...
if label of page item i of myPage is "MySlugFrame" then
but I can't get to my cell in my table after that. Conditional statements are another beast I have to master.
The thing is, once I identify MySlugFrame, all there is in the frame is a table, then some cells, of which, 2 of them have also labels I could point to. I just have no clue of how to do it. What worked before doesn't anymore, or have just been lucky all along;-)
It was missing "of document 1".
ok, so I feel SOOOOO stupid right now... I was wondering where to put that "of document 1" and I finally found it. So for anybody interested, here's the script.
set theDay to make_two_digit(day of (current date))
set theMonth to make_two_digit(month of (current date) as number)
set theYear to year of (current date)
set theDate to theYear & "-" & theMonth & "-" & theDay as string
tell application "Adobe InDesign CS5"
--this line is to make it work on the active layer only
tell document 1
set myLayer to active layer of layout window 1
set myPage to active spread of layout window 1
set mySlugframe_list to text frame 1 whose label is "MySlugFrame"
repeat with j from 1 to count of mySlugframe_list
set mySlugframe to item j of mySlugframe_list
set mynumber to (((text of cells "6:2" thru "6:2" of table 1 of mySlugframe) as string) as number)
set mynumberText to (mynumber + 1) as string
--remove the if statement if you need it to be on all layers
if mySlugframe's item layer = myLayer then
set text of cells "6:2" thru "6:2" of table 1 of mySlugframe to mynumberText
set text of cell id 16 of table 1 of mySlugframe to theDate
if the_number is less than 10 then
set the_result to "0" & the_number as string
set the_result to the_number as string
I'm gonna try to make a call to the cell by label also, just to see if I can figure this one out:-)