Re: Technical reference for Automator input to scripts
Re: Technical reference for Automator input to scripts
- Subject: Re: Technical reference for Automator input to scripts
- From: Jean-Christophe Helary <email@hidden>
- Date: Thu, 13 Apr 2017 07:49:56 +0900
> On Apr 13, 2017, at 5:09, Chip Wathey <email@hidden> wrote:
>
> If the service will process a specific type of data, such as text, files, or images, select the appropriate type. Otherwise, select “no input.”
> If the service will be available within the context of a specific app only, select the appropriate app. Otherwise, select “any application.”
> If the service will replace selected text with processed text, select the “Output replaces selected text” checkbox.
Thank you Chip.
Do you confirm that all that input will be "almost always" a list ?
Jean-Christophe
> https://developer.apple.com/library/content/documentation/LanguagesUtilities/Conceptual/MacAutomationScriptingGuide/MakeaSystem-WideService.html
>
>> On Apr 12, 2017, at 10:31 AM, Jean-Christophe Helary <email@hidden> wrote:
>>
>>>
>>> On Apr 13, 2017, at 0:05, Chip Wathey <email@hidden> wrote:
>>>
>>> Its almost always going to be a list because of the input declaration and the assumption that you will be sending a list of items. What I was pointing out in my screenshot is that you can setup your automator workflow and then confirm the class in the AppleScript script.
>>>
>>> If you are thinking about object oriented scripting, I would suggest working directly in the Script Editor.
>>>
>>> Why not just tell us what issue you are solving for?
>>
>> When I put a "Run Applescript" action at the top of the workflow to create a service, I can select what can of input I get.
>> The options are "Service receives selected" + dropdown menu where you have a Text category, a File and Folders category, and an Other category, all received from either any application of from a specified application.
>>
>> This input is passed to the Applescript on run handler as "input", but nowhere is it said that the input is *almost always* a list and that's the information I was looking for.
>>
>> So I was struggling with some "text" input that I thought was a string when it was in fact a list. That was very confusing. I ended up checking class of input, which brought the "list" class, but it took me a while to figure out that I had an issue here.
>>
>> Hence the question, though badly worded.
>>
>> Now, if you could tell the cases when it is *not* a list that would be extra nice.
>>
>> Also, I can't work directly into SE because I want to work with the Automator input, which I can't really simulate in SE.
>>
>> Jean-Christophe
>>
>>>
>>>
>>>> On Apr 12, 2017, at 10:00 AM, Jean-Christophe Helary <email@hidden> wrote:
>>>>
>>>> Yes I can see that, but what about the input that the script gets from Automator itself, like text from any application or Files etc...
>>>>
>>>> I actually checked on the developer site and found the following:
>>>>
>>>> https://developer.apple.com/library/content/documentation/AppleApplications/Conceptual/AutomatorConcepts/Articles/ImplementScriptAction.html#//apple_ref/doc/uid/TP40001512-CJBJEJBE
>>>>
>>>> "The input parameter contains (in most instances) the output of the previous action in the workflow; it is almost always in the form of a list."
>>>>
>>>> "almost always"
>>>>
>>>>
>>>> I don't know what can be the cases where the input is not a list but that will do for now. :)
>>>>
>>>> Jean-Christophe
>>>>
>>>>> On Apr 12, 2017, at 23:30, Chip Wathey <email@hidden> wrote:
>>>>>
>>>>> This is easily solved by just asking for the class inside the script.
>>>>>
>>>>> <PastedGraphic-1.png>
>>>>>
>>>>>> On Apr 12, 2017, at 7:06 AM, Jean-Christophe Helary <email@hidden> wrote:
>>>>>>
>>>>>> I'm wondering if there is some kind of reference on what Automator sends as input to things like "Run Applescript" actions.
>>>>>>
>>>>>> I'm specifically looking for what kind of classes are sent so that I can properly process the data in the AS.
>>>>>>
>>>>>>
>>>>>> Jean-Christophe Helary
>>>>>> _______________________________________________
>>>>>> Do not post admin requests to the list. They will be ignored.
>>>>>> Automator-users mailing list (email@hidden)
>>>>>> Help/Unsubscribe/Update your Subscription:
>>>>>>
>>>>>> This email sent to email@hidden
>>>>>
>>>>
>>>> _______________________________________________
>>>> Do not post admin requests to the list. They will be ignored.
>>>> Automator-users mailing list (email@hidden)
>>>> Help/Unsubscribe/Update your Subscription:
>>>>
>>>> This email sent to email@hidden
>>>
>>
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Automator-users mailing list (email@hidden)
>> Help/Unsubscribe/Update your Subscription:
>>
>> This email sent to email@hidden
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Automator-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden