I'm new to the forum, new to AHK, and new to scripting. Looked to see if this question was answered elsewhere but couldn't find anything.
I'm trying to loop through an array and send input, adding a string before the last item of the array. Right now, a three item array would appear as "item1 item2 item3" but I am hoping to have it appear as "item1 item2 and item3"
The code below pulls a list of Required Attendees from an Outlook Calendar Appointment, then uses strsplit to make each Required Attendee an item of the "Fullnames" array. Since the first Required Attendee of the calendar appointment is the creator of the appointment, I send input from the variable "Attendee List" which skips the first item of the "Fullnames" array.
Code: Select all
objOL := ComObjActive("Outlook.Application").ActiveInspector.CurrentItem
ReqAttendees := objOL.requiredattendees
Fullnames := StrSplit(ReqAttendees, ";")
Loop % Fullnames.MaxIndex()
{
AttendeeList := Fullnames[A_Index +1]
SendInput, %AttendeeList%
}
If the Required Attendees list were
John Anthony; Susan O'Brien; Douglas McLean
I'd see "John Anthony Susan O'Brien Douglas McLean" but I want to see an "and" before the last required attendee: "John Anthony Susan O'Brien and Douglas McLean"
Any help is much appreciated!! Thank you all in advance