Quantcast
Channel: Hot Weekly Questions - Web Applications Stack Exchange
Viewing all articles
Browse latest Browse all 9844

Need gmail script to reply to selected message, change subject, and send. Then change label

$
0
0

So I'm a recent convert of Outlook+Exchange to Gmail (company forced). I approve a lot of requisitions and such in email for automated processing by other applications. To do this, I simply review the message and if I approve it, reply and add "Approved" to the end of the subject. In Outlook, I created the VBA macro that would take the selected message and do the this task automatically: reply; modify the subject; send; and move the original message. This made for 2 click process... 1 to select the message and review it, one to respond with approval and archive the original message.

I'm an old hand with VBA but completely green with google script. From what I've seen, it looks intuitive but I need some help getting started. I'd appreciate some pointers. I've included a snippet of the VBA code below:

Dim obj As ObjectDim msg As Outlook.MailItemDim msgReply As Outlook.MailItem

Set obj = GetCurrentItem 'grabs the currently selected item.If TypeName(obj) = "MailItem" Then 'make sure the item is a mailitem    Set msg = obj 'msg is now the mail item to work on    If msg.Parent = "AP Invoices" Then 'need to make sure the msg is in the AP Invoices folder         Set msgReply = msg.ReplyAll 'this initiates a reply all to the msg        msgReply.Subject = msgReply.Subject & "Approved" 'adds "Approved" to end existing subject        msgReply.Display 'displays the message        msgReply.Send 'sends the message        msg.UnRead = False 'marks the original msg as read        msg.Move olProcessedFolder 'moves the original msg to a different folder    end ifend if

In Outlook, I used rules to get the email into the "AP Invoices" folder and I have gmail doing the same for a label using a filter.

Question: Once I have a script, how do I manually initiate it? On Outlook, I added a command button on the toolbar that launched the VBA macro... not sure if that is possible in Gmail.

Appreciate any assistance.


Viewing all articles
Browse latest Browse all 9844

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>