Re: automator and Applescript
Re: automator and Applescript
- Subject: Re: automator and Applescript
- From: Christopher Nebel <email@hidden>
- Date: Fri, 07 Jun 2013 15:56:04 -0700
You mean, if you have a Run AppleScript action in your workflow, how does it get the action input from the workflow? There's a major clue when you add a Run AppleScript action to your workflow in the first place -- the source field is pre-filled with this:
on run {input, parameters}
(* Your script goes here *)
return input
end run
So, "input" is a list of all the data items being processed (in your case, probably a bunch of alias objects), and "parameters" is a record containing parameters for that action. Since Run AppleScript doesn't have any parameters aside from the source text, you can mostly ignore them, though there is a "|temporary items path|" item there which might be useful -- it's a path to a folder that will be destroyed when the action finishes, so it's good for temporary scratch files.
--Chris Nebel
AppleScript Engineering
On Jun 6, 2013, at 1:55 PM, Alex Hall <email@hidden> wrote:
> Hello all,
> This may be off-topic for this list, so let me know if it is. I'm looking to make a simple folder monitor to do something when a file is added. I know this is a folder action by itself, but I need to first check the file extension and only do the event if the file is of a certain type. I have a workflow set up, at least I think I do (from a Voiceover perspective, Automator is somewhat confusing) and all I need now is to add my script.
>
> The only trouble is that I don't know what the workflow will pass the script for arguments when it calls it. Since this is a folder action to fire when a file is added, I presume the file name and possibly other information will be passed, but I have no idea how to access it.
>
> So, bottom line: from an Applescript standpoint, what variables can i expect automator to give the script? I have googled this, but I got either visual tutorials (drag this here, click this) or XCode instructions from XCode 2.x, which is not at all what I am looking to do (plus is way out of date). Thanks in advance.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden