Add Spotlight Comment from file?

As I understand the way the *Add Spotlight Comments* works, the input is the file (or set of files) to be modified, and the added comments can either come statically from the workflow, or as user input if the workflow permits *Show Action When Run*.
I have a moderately ugly shell script that downloads and examines a succession of files and builds a description (just a few dozen words) that I want to add automatically to those comments. At the end of my script, I've downloaded the file, and stored the comments I want in a separate temp file.
As far as I can see, Automator can't do this: I can't specify a file as the incoming source of those new Spotlight Comments, can I?
Assuming the answer is negative, two quick non-Automator followups:
1) Is there any shell-script level Unix command that can manipulate the comments (without trying to hack into the .DS_Store files, that is).
2) Can Applescript do this? And, crucially, where's the best current help for Applescript for someone that hasn't touched it in many years?

Automator can do it, although some of the actions may not be obvious. Text (for example, the results of your ugly shell script) can be placed into a variable for later use, but you can also get it from a file. If your description/comment is in a plain text file, you can use the Combine Text Files action to get the text, then place it in a variable that can be used with the Set Spotlight Comments for Finder Items action.
Example:
1) Get Specified Finder Items (add your description file) (ignore input)
2) Combine Text Files
3) Set Value of Variable {Variable: whatever}
4) Get Specified Finder Items (add the file you want to comment) (ignore input)
5) Set Spotlight Comments for Finder Items {drag variable whatever to the text field, Append to existing comments}

Similar Messages

  • Need help modifying Applescript to copy "Spotlight Comments" into file

    Hello all,
    I have a very large batch of images of Leonardo da Vinci's notebooks. I used the "Spotlight Comments" field of each file to save information about the notebook page depicted in each image:
    Well, I had to modify each image in Photoshop and when I saved the files, Photoshop of course didn't retain the Spotlight Comments. Now, before I modified the images, I duplicated the directory, so I have a copy of all of the images that retain their Spotlight Comments field with each image's information. What I want to do is copy the text from the Spotlight Comments field of the original files and either paste this text into the Spotlight Comments field of the modified files (which are in a different directory, but retain the same filenames as the originals), or at least copy the text from the Spotlight Comments field of the original files and paste each block of text into a txt file with a couple of blank lines in between each entry, so that I can manually copy/paste the citations into the modified image's Spotlight Comments fields.
    I successfully used this Applescript:  https://discussions.apple.com/message/6741062#6741062
    to get the Spotlight Comments from the original files, but it displays them one by one in pop-up dialog boxes and because I have almost a thousand images it is extraordinarily wearisome to copy the text from each pop-up, paste it into a text file, make two blank lines, click "OK" in the pop-up to get the next one...
    Can anyone suggest how I can modify the code I have to tell the Finder to copy the contents of each pop-up and paste them into a single text file with a couple of blank lines between each entry?
    I have the barest, most rudimentary knowledge of Applescript, which is why I'm asking if one of the wizards here can help me modify or write an Applescript to do what I need to do.
    Thank you so much!
    BTW, here is the code from the aforementioned discussion that gets the Spotlight Comments from files. I made into an Applescript application using Automator:
    tell application "Finder"
    repeat with tItem in input
    set (comment of tItem) to (text returned) of (display dialog "Spotlight Comment: " default answer (comment of tItem as string))
    end repeat
    end tell

    Hi,
    Evan Izer wrote:
    Now, before I modified the images, I duplicated the directory, so I have a copy of all of the images that retain their Spotlight Comments field with each image's information. What I want to do is copy the text from the Spotlight Comments field of the original files and either paste this text into the Spotlight Comments field of the modified files (which are in a different directory, but retain the same filenames as the originals)
    This script does exactly that:
    set sFolder to (choose folder "Select folder wich contains original images.") as string
    set dFolder to choose folder "Select folder wich contains modified images."
    tell application "Finder"
          repeat with tItem in (get document files of dFolder)
                set origFile to sFolder & (get name of tItem)
                if file origFile exists then
                      set origComment to comment of file origFile
                      set comment of tItem to origComment
                end if
          end repeat
    end tell

  • How to add spotlight comment on more than one file simultaneously?

    Hi
    how can I add spotlight comment on some files in mountain lion ?
    it's very useful and necessary specially when I want to add some comments on many files or photos that newly importet.
    is there any way in OS X  for that?
    Thank you!
    Safa

    Automator workflow of the month: Add Spotlight comments

  • Problem with add Spotlight Comments script.

    Hello,
    I am trying to add Spotlight Comments to some files using Automator. I have made an very simple script in Automator that add Spotlight Comments to the files that I have selected in Finder. I save this script as an app and it work great. I also save the same script but not as an app but as a service. The problem here is that when I run the service it add the same Spotlight Comment two times. For example, if I add "@Webshots" with the app the Spotlight Comments of the files is "@Webshots" but when I do it with the service the Spotlight Comments of the files is "@Webshots" "@Webshots". Can anybody help me with this? I will appreciate it a lot any help that you could give me. Thanks

    I suspect your workflow includes 'get select finder items' as the first action. get rid of it. it's redundant in a service that accepts files and folder in finder. that's why everything happens twice.

  • PoswerShell - Compare 2 x CSV files, only if data matches in column 1 add all data from file 2 to file 1 or output collated results

    OK, 1st the background...
    I have been provided a list of users of a particular group.
    We needed to know what computers (or IP's) the users are connected to...
    So, using Shared Folders, I have exported a list of all users connected to H drives (everyone on the domain) and I need to match their computernames (or IP) to the specific list of users I have...
    That gives me 2 x CSV files. 1 x master list of users, I list of all users PC or IP names.
    I need to be able to match the usernames on the master list (File1) with the usernames on File2 and append the computernames and connected times to File1 omitting the usernames that are not required...
    This is to determine what PC's the user is logged into and what site their computers are at.
    I also need to capture if they are logged into more than one computer (info is contained in File2)
    File1 Example:
    User
    FirstName
    LastName
    ADSite
    HDriveLocation
    HDriveLocationTS
    Office2010FAT
    XY123456
    BOB
    BUILDER
    LONDON 
    \\SERVER\%USERNAME%
    \\SERVER\USERNAME
    TRUE
    ABC09876
    JIM
    INYCRICKET 
    CHICAGO 
    \\SERVER\USERNAME
    \\SERVER\USERNAME
    TRUE
    ADD11223 
    SALLY
    METLARRY
    TOKYO
    \\SERVER\USERNAME
    \\SERVER\USERNAME
    FALSE
    File2 Example:
    User
    Computer
     Connected
    Idle
    XY123456 
    192.168.1.216 
    3 days 06:13:18
    0:00:03
    XY123456
    192.168.1.254 
    1 day 01:21:30
    23:08:39
    WXY46810 
    PCNAMEXYZ  
    6:44:19
    0:00:05
    I have found a PS script which "might" do what I need it to, but I haven't been able to "tweak" it right - it's omitting the details from File2 - http://powergui.org/thread.jspa?threadID=19522
    Also I can't figure out how to collect multiple computernames (that users are logged into) from File 2 and add this to File1
    Working with Powershell, but happy to consider any other options (EG: Excel, Macros, VBS, etc)
    Here's what I have got so far: (PS)
    $File1 = Import-Csv "C:\Users.csv"
    $File2 = Import-Csv "C:\Shares.csv"
    $Output = @()
    ForEach ($Item in $File1)
    { $Result = $File2 | Where { $Item.User -eq $_.User }
    $Output += New-Object PSObject -Property @{
    USER = $Item.User
    FirstName = $Item.FirstName
    LastName = $Item.LastName
    ADSite = $Item.ADSite
    Computer = $_.Computer
    Connected = $_.Connected
    Idle = $_.Idle
    Office2010FAT = $Item.Office2010FAT
    HDriveLocation = $Item.Connected
    HDriveLocationTS = $Item.Idle
    $Output | Select User,FirstName,LastName,ADSite,Computer,Connected,Idle,Office2010FAT,HDriveLocation,HDriveLocationTS | Export-Csv C:\Users\a1033965\Desktop\result.csv -NoTypeInformation
    However, the output I'm getting is missing the results from File2 and I NEED multiple computers listed if a user is logged into them:
    Current Output:
    USER
    FirstName
    LastName
    ADSite
    Computer
    Connected
     Idle 
    Office2010FAT
     HDriveLocation
     HDriveLocationTS
    XY123456
    BOB
    BUILDER
    LONDON
    TRUE
    ABC09876
    JIM
    INYCRICKET
    CHICAGO
    TRUE
    ADD11223 
    SALLY
    METLARRY
    TOKYO
    TRUE
    (TRUE is actually in the right column, under Office2010FAT as it should be - just doesn't look like it as I post this)
    Any help with this would be much appreciated. Cheers

    Please verify that your files look exactly like this:
    #file1 format
    User,FirstName,LastName,ADSite,HDriveLocation,HDriveLocationTS,Office2010FAT
    XY123456,BOB,BUILDER,LONDON,\\SERVER\%USERNAME%,\\SERVER\USERNAME,TRUE
    ABC09876,JIM,INYCRICKET,CHICAGO,\\SERVER\USERNAME,\\SERVER\USERNAME,TRUE
    ADD11223,SALLY,METLARRY,TOKYO,\\SERVER\USERNAME,\\SERVER\USERNAME,FALSE
    #file2 format
    User,Computer,Connected,Idle
    XY123456,192.168.1.216,3 days 06:13:18,0:00:03
    XY123456,192.168.1.254,1 day 01:21:30,23:08:39
    WXY46810,PCNAMEXYZ,6:44:19,0:00:05
    ¯\_(ツ)_/¯

  • Automator 2-Add Spotlight Comments still dead?

    After the latest update, I was hoping that this Action would have been fixed. When creating a Workflow, adding Spotlight Comments works fine. However, save as a plugin or application and its dead.
    Is it me, or is this still a bug after the latest update?

    I use this more than any other Action because my entire Archive is rooted in the Spotlight reference process.
    I was given a possibility in another post to not use "Get Selected Finder Items" and then it would work. Which, to me, is counter to proper usage, especially in regard to how it worked in Automator 1. So I am considering this a "bug" in Automator until they fix it.

  • Add column comments from excel spreadsheet

    Is there a way to add descriptions that are captured in excel spreadsheets into a relational model's tables and columns? Would it need to be a transformation script or is there another way? Does anyone have a sample of how to do this?

    I use excel all the time to do this since it's easy for me. basically what I do is get everything I need down. Then I use excel to build the sql. I'll add a column with comment on column and other column with the table name with a period. I assume I've got the column name in one excel column and the comment in another. So I'll put a column between the column name and the comment and put in is'. Then after the comment I'll put in ';. Once that's done I load it into a text editor drop all the unnecessary spaces save it and run it.
    Do this with a lot of things. Dump the stuff I need out of the data dictionary or where ever. save it in excel and then do the same trick

  • Batch Process: Add Alpha Mask From File

    I did a search for this, but couldn't find anything.  If there is something, please feel free to send me in that direction.
    I use Photoshop a lot for my 3D work.  Usually, when I render an image sequence out, I have the mask saved in the alpha channel.  Unfortunately, ZBrush doesn't allow me to do that, and instead saves the mask out as a separate image.  I need to add the alpha mask to the color plate file.  Is there any way to do this with batch processing?
    --Andrew

    AndrewRaz wrote:
    Thank you for your response.  I guess for now, I'll just add the masks by hand, since I don't know scripting at all.
    It would be worth asking in the Scripting forum. There may be something available, in which case you just copy the file into the appropriate folder in PS and it's there on the menu to use.
    Scripting forum.

  • Spotlight Comments for All Users

    Hello.
    I have been trying to allow users to add spolight comments to files on a server. It seems that only the owner of a file can add spolight comments, which is of no use to us whatsoever. Is there any way of allowing all users to add spotlight comments to files on a server, without having to make everyone access the share as "admin"?
    Thanks,
    Tom

    I fixed this problem in the end, but the solution is not ideal. I set up a new user, and added short names reflecting the names of the users, so as far as they are concerned, they are still logging in as themselves.
    I did wonder if any user with their "primary group" set to the access group in the POSIX settings would be allowed to add file comments, but I try it in the end, though it might work.

  • How to copy a files name and spotlight comments to a text file for an entire folder

    I have movie covers saved as a jpeg for every movie my family and I own. There is about 700 and they each have a comment of the main actors, release dates, and descriptions. This makes it easy to find what to watch. I want my parents to have all of this info but they have a windows laptop so the comments don't transfer with the file and can't be searched like you can on a mac. Is there an applescript, automator, program I can download,  or program code supported in xcode that will do at least one of the following things?
    1)Take the name of the picture file and spotlight comment, copy and paste it into a text document like word that looks like this...
    File Name1- Spotlight Comment for file 1
    File Name 2- Spotlight Comment for file 2
    . for all 700 files in a folder
    2) It would be equally helpful if there was something that would take the name of the picture file and spotlight comment, copy and paste it to a movie file's comments with the same name but obviously has different extention. For an example
    In a Pictures folder
    Name: Dark Knight, The.jpeg       Comment: (2008) Genre: Action...             <- copy comment
    In a Movie Folder
    Name: Dark Knight, The.m4v       Comment:                                               <- paste 
    and do this for all 700 files
    3) Is there a free photo program that works on mac and windows that I can put all my movie pictures in and have a description like I did with the comments? It would also need a place that to search the description for keywords. So Basically an itunes for pictures that works on both mac and windows. If so I still need a way to get the spotlight comments to the description.
    4) I feel like this would make things more difficult, but if not I can put all of the .m4v files in itunes so instead of pasting all the comments back into a file in finder paste them in a description in itunes
    5) At the very least a code that I can run one by one for every file that will paste the comments into the same document
    Note: When I say spotlight comments I mean the comment box that is available when you click on get info of a file. The pictures are in the pictures section of finder in a folder called Movie Pictures. The movie files are on an external hard-drive in a file called Movies. Also I am slightly familiar with applescript and automater in that I have used both to create keyboard shortcuts and simple voice commands. I have programmed in c++ and C too. So If you give me a code for applescript I do know what to do with it.
    Thanks to anyone who takes the time to read all of this and extra thanks to anyone who tries to help.

    Clendenen02 wrote:
    2) It would be equally helpful if there was something that would take the name of the picture file and spotlight comment, copy and paste it to a movie file's comments with the same name but obviously has different extention. For an example
    In a Pictures folder
    Name: Dark Knight, The.jpeg       Comment: (2008) Genre: Action...             <- copy comment
    In a Movie Folder
    Name: Dark Knight, The.m4v       Comment:                                               <- paste 
    and do this for all 700 files
    This Bash script will do it.
    Edit "PicDir" and "MovDir" to the location of your Folders
    (Note: The comment is written to the m4v file using xattr, so the Spotlight comment field appears blank in Finder, but the comment metadata is still indexed by Spotlight (If you add a Spotlight comment from Finder, it is stored both as an extended attribute and in a .DS_Store file)
    #!/bin/bash
    PicDir=$HOME/Desktop/Pictures
    MovDir=$HOME/Desktop/Movies
    for f in $PicDir/*
    do
         if [ ! -d "$f" -a "${f##*.}" == "jpeg" ]; then
              comment=$(mdls -raw -name kMDItemFinderComment "$f")
              if [[ $comment != "(null)" ]]; then
                   picname=${f##*/}
                   movname=${picname%.*}.m4v
                   if [ -e "$MovDir"/$movname ]; then
                         xattr -w com.apple.metadata:kMDItemFinderComment "\"$comment\"" "$MovDir"/$movname
                   fi
              fi
         fi
    done

  • File Info window and Spotlight comments

    I typed somme comments in File Info Window, box titled Spotlight comments.
    All these comments are gone after System restart (Snow Leopard 10.6.8) and I am unable to read them again. But STRANGE... when I do a Spotlight research with one word I typed in Spotlight comments, the file name is displayed and I can open its Info Window, but no luck the Spotlight comments are still empty.
    The chain I typed are still there in the file info but hidden to my eyes, is there a mean to retrieve these comments?
    Best regards and thanks, please excuse me language as I'm wrting from France.
    JfS

    I typed somme comments in File Info Window, box titled Spotlight comments.
    All these comments are gone after System restart (Snow Leopard 10.6.8) and I am unable to read them again. But STRANGE... when I do a Spotlight research with one word I typed in Spotlight comments, the file name is displayed and I can open its Info Window, but no luck the Spotlight comments are still empty.
    The chain I typed are still there in the file info but hidden to my eyes, is there a mean to retrieve these comments?
    Best regards and thanks, please excuse me language as I'm wrting from France.
    JfS

  • Collections in finder, quick add to spotlight comments

    I'm wanting to optimize the way I'm using spotlight, and know that there's a field for spotlight comments when you select and item in finder and command-i... I'm wondering if there's a keyboard shortcut that can let me add spotlight comments directly, or is there a Quicksilver plug-in that might let me do that?
    Also, within spotlight is there a way to configure it so that the first (or only) items to come up are the ones that I've added the relevant spotlight comments to?
    Basically what I'm wanting to do is to add the metadata that would effectively make collections like in Yojimbo or Notemind... I love Yojimbo's idea, but I don't want a separate database for all my yojimbo collections... I don't want to be bound to Yojimbo and don't want it always running in the background... the finder is already a fabulous database, and between QS and spotlight you can do a million more things than Yojimbo can let me do... so I would love to get this "collections" effect inside finder without making a million aliases for my files...
    Any suggestions?

    Let me start with the "easy" question first: the .DS_Store files are where "Finder information" is stored. Windows users find these things a pain in neck, and usually insist they be deleted. Most of time this isn't a problem, the Mac users just get annoyed when their folder doesn't open the way it was when last closed--the principle information stored there is the view the folder was told to keep, the size of the icons and their arrangement, and so on. Every time you open a folder a .DS_Store file created if one does not already exist, and if one does the file will be updated if you change your settings for the folder, for instance switch it to List view, tell it to always open in List view, with columns for Date Modified, Size, but not Kind or Date Created. And it also keeps the information entered in Spotlight Comments. Just how Finder preserves this information if a file is moved, in Mac OS, to another folder, I don't know. But it does.
    What we REALLY need is a nice little program to write to the metadata of the file. For instance, Spotlight will index keywords, which are stored in the file itself, as part of the file's metadata. I mainly work with graphics, and Photoshop allows you to add keywords to the file's metadata. Apple's iPhoto and Aperture will also add keywords, but they are not written to a file's metadata until you export them. PDFs can also have keywords assigned, you can even do it with Preview. Text documents can also have keywords added using some (most?) text editors, including TextEdit (provided the file is in RTF format). The nice thing about keyword metadata is that it goes with the file, and be accessed in any OS that allows a metadata search.
    Unfortunately I don't know of any program that would allow you to select a batch of miscellaneous files and add the same keyword to all of them. It would certainly be handy though.
    Francine
    Francine
    Schwieder

  • How-to: add spotlight tags when printing to PDF

    Hello,
    I have an extensive knowledge base of articles that I store in one central folder. I would like to have the option of adding (predefined) spotlight tags in the process of doing this, so as to be able to use smartfolders in my knowlegde base to sort information.
    Any ideas ?
    Thanks,
    Serge

    The system automatically indexes the contents of the files for Spotlight use. The Spotlight comments you add are just extra info that wouldn't necessarily be found within the document. You can already use smart folders.
    If you really want to add Spotlight comments using Automator, you can make use of the Finder action "Add Spotlight Comments to Finder Items".
    If you want to find all actions in Automator having to do with Spotlight, just start typing "Spotlight" in the search field above Automator's actions. You may have to show the toolbar to see the search field, either with the View menu or using the button in the upper right corner of an Automator window.
    MacBook 2.0 GHz Intel Core Duo   Mac OS X (10.4.8)   512 MB RAM

  • Cross-Platform Spotlight Comments?

    Hi there, we have a massive database with oodles of images on it. Some images have the product name in the title, others do not. We'd like a quick and easy way to do a search for say...Potatoes, and have all of the images associated with potatoes show up. I know you can add Spotlight Comments to each individual photo, but I'm having trouble getting any results from my search.
    Also, will a PC running Windows be able to do any kind of a search of these items? Or is there a way to label the images with keywords so both a PC and a MAC can do searches for them? We're trying to avoid making duplicate images that are then moved into an actual photo called Potatoes which will no only bog down our server with more images, but could cause confusion if any images are changed and not move into the exact same folders again.
    Thanks for any input.

    Start with a search for *search server, search share, shared search*, or variants. There are many recent posts on the subject about hosed searches w/10.5.6. Whether or not there are solutions for your issue, I haven't a clue since everything I have is Apple—I don't do windoze.

  • Spotlight search ignores spotlight comments

    Using the Commenteer utility I've modified hundreds of spotlight comments for files. But spotlight search doesn't find them. Why? mdimport doesn't seem to be running. Why?

    I figured out what is going on, but don't understand it. Commenteer lets me add spotlight comments in batch mode even when the files are locked. (All my photos are locked so I don't accidentally delete any.) The comments are really there--I checked. But if the files are locked when I change the comments, spotlight will not index the files. If I unlocked the files before using Commenteer to make a batch change to the comments, then spotlight will index the files. So my workaround for now is to unlock all the files before changing the comments. Spotlight doesn't "see" that a file has been updated, if it is locked. If I unlock it, change the comments, and then lock it again, Spotlight notices that and indexes the file. Kind of annoying.

Maybe you are looking for

  • Bogus errors using -U option?

    http://snowy.arsc.alaska.edu/cstephen/bug.tar.gz When using the -U compiler option, the linked code produces the following errors. Is this a bug? % make f95 -c -u -U mod_kinds.f90 f95 -c -u -U mod_param.f90 f95 -c -u -U foo.f90 MODULE mod_grid ^ "foo

  • Lync 2010 Client unable to verify certificate - External access

    we have recently setup Lync 2013 and it is working fine internally.  I am now trying to setup external access. We only require the remote users to be able to use their client externally without VPN.   I have setup the edge server with 1 NAT'd public

  • Next Check Number changed

    Hello Experts! The customer Next Check Number suddly changed means. it was suppose to be '60321' but now it is '60323' and if we check the there is two cheks 60321-60322 for erlier dates (01/07/10 and 24/02/10) Your help please! Thank You!

  • How to Download Whats App

    i want to download whatsapp on this mobile please Moderator's note: The subject was edited as we moved the topic to the correct board so others can easily search on the same topic.

  • Desktop S/W Won't Recognise Bold 9700

    I'm new to this forum and have a new BB Bold 9700 - great phone!   But I want to use the Bluetooth Sync capability.  I have loaded all the latest S/W for the notebook and the device (eg., DTS/W 6). The phone is now paired and connects reliably with m