Hi,
I am trying to parse out a text file (.ics actually) to input the result into iCal.
I have a subroutine in my script which handles any “ALL Day” events. These all day events are indicated in my text file (clipboardText) as either “A” or “G” or “L” or “LJ” or “EXB” or “O” or “U”.
Currently, I use independent If-Then statements to identify the string.
if word 3 of clipboardText is "A" then
AllDayEvents(clipboardText)
else
if word 3 of clipboardText is "G" then
AllDayEvents(clipboardText)
else
if word 3 of clipboardText is "L" then
AllDayEvents(clipboardText)
else
if word 3 of clipboardText is "LJ" then
AllDayEvents(clipboardText)
else
if word 3 of clipboardText is "EXB" then
AllDayEvents(clipboardText)
else
if word 3 of clipboardText is "O" then
AllDayEvents(clipboardText)
else
if word 3 of clipboardText is "U" then
AllDayEvents(clipboardText)
Is there a way to assign a variable to all the “AllDayEvents” string values and combine the If-Then statements into one?
I also have a situation where I need to question 2 string values in the same If-Then statement:
if word 12 of clipboardText is "PX" and word 28 of clipboardText is "PX" then MultiplePXDutyFlights(clipboardText)
My problem is that the string “PX” above could be “PX” or “AL” or “RQ” or “RP” etc. When I attempt to include all the variables in the If-Then statement by saying “or” it errors. To reduce the amount of If-Then statements I have to make and to clean up my script, is there a way to assign a variable to all of the aforementioned string values and combine them into a single If-Then statement?
Regards,
Kevin
Model: iMac
AppleScript: Version 2.4 (128)
Browser: Safari 534.48.3
Operating System: Mac OS X (10.7)