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 

Select catalog items from Spreadsheet List

 
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
Colin_ColorBlindImages



Joined: 06 Jul 2006
Posts: 2

PostPosted: Thu Jul 06, 2006 11:52 pm    Post subject: Select catalog items from Spreadsheet List Reply with quote

Can anyone help with this?

I am trying to find and easy way to make a selection (or label items) in one of our catalogs from a list of filenames in an excel spreadsheet (or any simple text listing). I've seen a Visual Basic script in the forums that seems to accomplish this for windows users. Any savy scripters out there with a solution?
Back to top
View user's profile Send private message
algal



Joined: 07 Jan 2007
Posts: 2

PostPosted: Tue Feb 06, 2007 12:48 pm    Post subject: script for "Label if Path in..." Reply with quote

Hi,

If your Excel spreadsheet has the pathname, in MacOS format (colons instead of slashes), then this can help. First export the spreadsheet to plaintext -- e.g., as a .csv file.

The following applescript "Label if Path in..." will go through the selected items and label red all the items whose entire pathname appears somewhere in a given text file.
Code:
-- This command takes one or more catalog items, and then labels all the items whose pathnames appear in a designated text file.

-- by algal, on iView Media Forum

on run
   -- get the list of selected ID's in front window
   set itemsToProcess to GetSelection()
   
   -- show about
   AboutScript()
   
   -- get the text file listing files to be marked
   set tobemarkedFile to choose file with prompt "Choose a text file listing the pathnames of items to be labeled"
   if tobemarkedFile = "" then return
   
   -- read the contents of text file listing the files
   tell application "Finder"
      if exists file tobemarkedFile then
         set refNum to open for access tobemarkedFile without write permission
         if refNum is not 0 then
            set content to read refNum
            close access refNum
         end if
      end if
   end tell
   
   -- set the label of all items to 1
   repeat with theItem in itemsToProcess
      tell window 1 of application "iView MediaPro"
         -- check if filename appears in content
         set thePath to the path of theItem
         if (offset of thePath in content) > 0 then
            set theLabel to 1
            set the label index of theItem to theLabel
         end if
      end tell
   end repeat
end run

-- get the selected media items in an array
on GetSelection()
   set selectedItems to {}
   tell application "iView MediaPro"
      if catalog 1 exists then set selectedItems to the selection of catalog 1
   end tell
   if number of items in selectedItems is 0 then
      display dialog
         "You need to select at least one media item in the front catalog in order to use this script." buttons {"OK"} default button
         "OK" with icon note giving up after 10
      error number -128
   end if
   return selectedItems
end GetSelection

-- about this script
on AboutScript()
   display dialog
      "This command labels red all the selected items whose pathnames appear " &
      "in a chosen text file." & return
      buttons {"Cancel", "OK"} default button 2 with icon note
   
   set theAnswer to the button returned of the result
   return theAnswer
end AboutScript

Back to top
View user's profile Send private message
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