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 

How can I make the filename a keyword?

 
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
dahveed



Joined: 11 Jan 2007
Posts: 4

PostPosted: Mon Feb 19, 2007 6:29 pm    Post subject: How can I make the filename a keyword? Reply with quote

I'd like to find a script or an easy way to make a file's filename a keyword. The reason for doing this is that I am assigning new names to files and I want to keep the old name as a keyword so I have the option to search on both.

Any ideas??
Back to top
View user's profile Send private message
Tim Plumb
iView staff
iView staff


Joined: 18 Mar 2004
Posts: 72

PostPosted: Thu May 10, 2007 12:44 am    Post subject: Reply with quote

Hi dahveed,
Below is a simple example of how you can do this. Things to watch out for are;

  • Line wraps in the post. Some lines have been split by the forum software
  • If you are using MediaPro (rather than Expression Media) then you'll need to change the app name in the script

I hope this helps.
Regards,
Tim.
Code:

--Set a keyword for the selected media item based on it's file name
--Written by Tim Plumb, 2007

on run
   -- get the list of selected ID's in front window
   set selectedItems to GetSelection()
   
   -- process each item
   tell window 1 of application "Expression Media"
   repeat with theItem in selectedItems
   set existingKWs to keywords of the annotations of theItem
   set the keywords of the annotations of theItem to existingKWs & (name of theItem)
   end repeat
   end tell
end run


-- get the selected media items in an array
on GetSelection()
   set selectedItems to {}
   tell application "Expression Media"
   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 1 giving up after 10
   error number -128
   end if
   return selectedItems
end GetSelection
Back to top
View user's profile Send private message Send e-mail Visit poster's website
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