It works! Thank you

The problem was "file name" <=> "path"?! D'OH!

@Mailplane users: this script can send an email every time you drop a file 
in a directory (using Folder Actions).

Il giorno giovedì 25 febbraio 2016 23:14:31 UTC+1, Mailplane Support ha 
scritto:
>
> Hi Lorenzo,
>
> Would you might giving the script below a try?
>
> Best regards,
> Lars
>
> *on* *adding folder items to* my_folder after receiving the_files
>
> *repeat* *with* each_file *in* the_files
>
> *tell* *application* "Mailplane 3"
>
> *set* m *to* *make* new *outgoing message* with properties {directlySend:
> *false*, optimizeAttachments:*true*}
>
> *tell* m
>
> *set* sender *to* "[email protected] <javascript:>"
>
> *set* r *to* *make* new *to recipient* at *end*
>
> *tell* r
>
> *set* address *to* "[email protected] <javascript:>"
>
> *set* name *to* "Ruben"
>
> *end* *tell*
>
> *set* subject *to* "This is a test!"
>
> *set* content *to* "This is the body text!"
>
> *make* new *mail attachment* with properties {path:each_file}
>
> *end* *tell*
>
> *compose* m
>
> *end* *tell*
>
> *end* *repeat*
>
> *end* *adding folder items to*
>
> On Thu, Feb 25, 2016 at 11:08 AM, FooLab <[email protected] <javascript:>> 
> wrote:
>
>> Wait! I spoke to soon! :-(
>>
>> I’m trying to send an email with attachment for every file I put in a 
>> directory with Mailplane 3.
>> This is the script, when I add files it runs but nothing happens:
>>  
>>
>>
>> *on* *adding folder items to* thefolder after receiving theAddedItems
>>
>> *repeat* *with* eachitem *in* theAddedItems
>>
>> *tell* *application* "Mailplane 3"
>>
>> *set* m *to* *make* new *outgoing message* with properties {directlySend:
>> *false*, optimizeAttachments:*true*}
>>
>> *tell* m
>>
>> *set* sender *to* “[email protected] <javascript:>”
>>
>> *set* r *to* *make* new *to recipient* at *end*
>>
>> *tell* r
>>
>> *set* address *to* “[email protected] <javascript:>”
>>
>> *set* name *to* "Ruben"
>>
>> *end* *tell*
>>
>> *set* r *to* *make* new *cc recipient* at *end*
>>
>> *tell* r
>>
>> *set* address *to* “[email protected] <javascript:>"
>>
>> *set* name *to* "Lars"
>>
>> *end* *tell*
>>
>> *set* subject *to* “This is a test!“
>>
>> *set* content *to* “This is the body text!"
>>
>> #the next commented line works:
>>
>> #make new mail attachment with properties {path:”Macintosh 
>> SSD:Users:myuser:Desktop:file.pdf"} at after the last paragraph
>>
>> #this active line doesn’t… if I comment this line too the script works 
>> (without attachments of course)
>>
>> *make* new *attachment* with properties {file name:eachitem *as* *alias*} 
>> at *after* *the* *last* *paragraph*
>>
>> *end* *tell*
>>
>> *compose* m
>>
>> *end* *tell*
>>
>> *end* *repeat*
>>
>> *end* *adding folder items to*
>>
>>
>>
>>
>> Lorenzo G.
>> FooLab
>>
>> 2016-02-24 20:13 GMT+01:00 Mailplane Support <[email protected] 
>> <javascript:>>:
>>
>>> Awesome, glad you got it sorted out!
>>>
>>> Cheers!
>>>
>>> On Wed, Feb 24, 2016 at 1:25 PM, FooLab <[email protected] <javascript:>> 
>>> wrote:
>>>
>>>> Solved adding “as alias”!
>>>>
>>>> make new mail attachment with properties {path:”Macintosh 
>>>> SSD:Users:myuser:Desktop:image.jpg" *as alias*}
>>>>
>>>> Lorenzo G.
>>>> FooLab
>>>>
>>>> 2016-02-24 19:20 GMT+01:00 FooLab <[email protected] <javascript:>>:
>>>>
>>>>> Ok it works thank you Lars.
>>>>>
>>>>> Now I have another problem, I can’t attach a file to the mail. It give 
>>>>> me an error “0 bytes” like it can’t find the file when I’m sure the path 
>>>>> is 
>>>>> correct, example:
>>>>>
>>>>> *make new mail attachment with properties {path:"Macintosh 
>>>>> SSD:Users:myuser:Desktop:image.jpg"}*
>>>>>
>>>>> What’s wrong with that?
>>>>>
>>>>> If I try this it give me *YES* as return:
>>>>>
>>>>> *set* msg *to* "no"
>>>>>
>>>>> *tell* *application* "Finder"
>>>>>
>>>>> *if* *exists* *file* "*Macintosh SSD:Users:myuser:Desktop:image.jpg*" 
>>>>> *then*
>>>>>
>>>>> *set* msg *to* "yes"
>>>>>
>>>>> *end* *if*
>>>>>
>>>>> *end* *tell*
>>>>>
>>>>>
>>>>> *display dialog* msg
>>>>>
>>>>>
>>>>> p.s. I promise that when the script will works correctly I’m going to 
>>>>> share it with others Mailplane users. ;)
>>>>>
>>>>> Lorenzo Godio
>>>>> FooLab
>>>>>
>>>>> 2016-02-24 15:00 GMT+01:00 <[email protected] <javascript:>>:
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> Have you already tried to set the sender in AppleScript? (e.g. set 
>>>>>> sender to "[email protected] <javascript:>")
>>>>>>
>>>>>> Best regards,
>>>>>> Lars
>>>>>>
>>>>>> -- 
>>>>>> You received this message because you are subscribed to the Google 
>>>>>> Groups "mailplaneapp" group.
>>>>>> To unsubscribe from this group and stop receiving emails from it, 
>>>>>> send an email to [email protected] <javascript:>.
>>>>>> To post to this group, send email to [email protected] 
>>>>>> <javascript:>.
>>>>>> Visit this group at https://groups.google.com/group/mailplaneapp.
>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>
>>>>>
>>>>>
>>>> -- 
>>>> You received this message because you are subscribed to the Google 
>>>> Groups "mailplaneapp" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send 
>>>> an email to [email protected] <javascript:>.
>>>> To post to this group, send email to [email protected] 
>>>> <javascript:>.
>>>> Visit this group at https://groups.google.com/group/mailplaneapp.
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "mailplaneapp" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to [email protected] <javascript:>.
>>> To post to this group, send email to [email protected] 
>>> <javascript:>.
>>> Visit this group at https://groups.google.com/group/mailplaneapp.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "mailplaneapp" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>> To post to this group, send email to [email protected] 
>> <javascript:>.
>> Visit this group at https://groups.google.com/group/mailplaneapp.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"mailplaneapp" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/mailplaneapp.
For more options, visit https://groups.google.com/d/optout.

Reply via email to