iView home page
iView Multimedia Forum Index

FAQ FAQ     SearchSearch     MemberlistMemberlist     UsergroupsUsergroups    RegisterRegister  
ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

trouble writing to custom field

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    iView Multimedia Forum Index -> AppleScript
View previous topic :: View next topic  
Author Message
jackinva



Joined: 19 May 2005
Posts: 3
Location: Charlottesville, VA

PostPosted: Tue Feb 20, 2007 6:25 pm    Post subject: trouble writing to custom field Reply with quote

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
View user's profile Send private message Send e-mail
jackinva



Joined: 19 May 2005
Posts: 3
Location: Charlottesville, VA

PostPosted: Thu Mar 01, 2007 8:50 pm    Post subject: solution Reply with quote

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
View user's profile Send private message Send e-mail
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    iView Multimedia Forum Index -> AppleScript All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



  © iView Multimedia Ltd. | All Rights Reserved Privacy Policy | Copyright | Site Map