View previous topic :: View next topic |
Author |
Message |
jackinva
Joined: 19 May 2005 Posts: 3 Location: Charlottesville, VA
|
Posted: Tue Feb 20, 2007 6:25 pm Post subject: trouble writing to custom field |
|
|
We have a script that was working with Iview 2.x and is not working with Iview 3.x. The code originally looked like this:
Code: | repeat with i from 1 to count of proj's vals
set keynam to item i of proj's keys
set val to item i of proj's vals
repeat with mi in every media item of catalog 1
tell mi to set custom field keynam to val
end repeat
end repeat
|
I've looked on this site and seen other posts with working custom field sample code. So I modified our script to look like this:
Code: | repeat with i from 1 to count of proj's vals
set keynam to item i of proj's keys
set val to (item i of proj's vals) as text
display dialog "" & keynam & ":" & val
repeat with mi in every media item of catalog 1
--tell mi to set custom field keynam to val
set custom field keynam of mi to val
end repeat
end repeat
|
I added a dialog display to confirm that the outer loop is working correctly and has the desired custom fields and values.
Elsewhere in our code the custom fields are created, which is working. We just don't get the values to get populated on each media item.
Any suggestions on what might be wrong? FYI, we're using Iview MediaPro 3.1.1 in our environment.
Thanks,
Jack |
|
Back to top |
|
 |
jackinva
Joined: 19 May 2005 Posts: 3 Location: Charlottesville, VA
|
Posted: Thu Mar 01, 2007 8:50 pm Post subject: solution |
|
|
I discovered the problem. The "repeat with mi in every media item of catalog 1" loop was never being entered. I modified the code to get a count of the media items and then do a repeat/tell loop for the media items:
Code: | set nitems to count of media items of catalog 1
repeat with i from 1 to count of proj's vals
set keynam to item i of proj's keys
set val to (item i of proj's vals) as text
repeat with j from 1 to nitems
tell media item j of catalog 1
set custom field keynam to val
end tell
end repeat
end repeat
|
|
|
Back to top |
|
 |
|