Perl Variables, Accessing comments

Two questions. If I am using a perl script using the Run Shell Script action, is there any way to access multiple variables set in automator from the script.

Second, is there any way to get a file's spotlight comments with automator?

iMac (24in Aluminum), Mac OS X (10.5.4), 4 Gigs of RAM

Posted on Jul 11, 2008 3:38 PM

Reply
1 reply

Jul 11, 2008 6:11 PM in response to Chris W 84

1) You can use several Get Value of Variable actions to build a list to pass to your script or use the osascript shell script to get variables via AppleScript - for example:

osascript -e 'tell application "Automator" to return value of variable "New Storage" of front workflow'




2) The following Run AppleScript action will get the Spotlight comments from Finder Items, for example from a Get Finder Items action:

<pre style="
font-family: Monaco, 'Courier New', Courier, monospace;
font-size: 10px;
margin: 0px;
padding: 5px;
border: 1px solid #000000;
width: 720px;
color: #000000;
background-color: #FFDDFF;
overflow: auto;"
title="this text can be pasted into an Automator 'Run AppleScript' action">
on run {input, parameters}
(*
get Spotlight comments from Finder items
input: a list of Finder items (aliases)
output: a list of Spotlight comments
*)

set output to {}

repeat with AnItem in the input -- step through each item in the input
tell application "Finder" to set the end of the output to comment of (AnItem as alias)
end repeat

return the output -- pass the result(s) to the next action
end run
</pre>

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Perl Variables, Accessing comments

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.