Help, I'm having problems with "/" forward slash

Hi,

I have a script which decodes abbreviations. It works except when the code includes a “/” forward slash…

To test this I just copy a code from the property rosterCode list to the clipboard and then run the script. It all lines up and works except for the 3 instances of codes with a “/” in them.

The error is

Any ideas?

Thanks

Kev

property rosterCode : {"1I", "2I", "1R", "AC", "AD", "ABA", "ABB", "ABT", "AI", "AK", "AL", "AM", "AP", "APT", "ARB", "ASC", "AT", "AX", "B1", "B2", "BK", "BR", "BU", "C1", "C2", "C3", "C4", "C5", "C6", "C8", "C9", "CA", "CC", "CCD", "CD", "CG", "CI", "CT", "CU", "CH", "CJ", "CK", "CL", "CM", "CN", "COP", "CPF", "CPS", "CQ", "CQM", "CQP", "CRD", "CRM", "CTM", "CTR", "CV", "CW", "D8", "DB", "DL", "DOM", "EE", "EF", "EL", "ELT", "EN", "EO", "EQ", "ER", "ET", "EU", "EXB", "EXM", "EXQ", "EZ", "F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "FA", "FB", "FC", "FDC", "FF", "FI", "FIN", "FLI", "FLF", "FLN", "FOT", "FAE", "FLC", "FRL", "FTI", "FTC", "FTF", "FHT", "F/FL", "FMS", "FMT", "FQ", "FS", "FSM", "FT", "FTM", "FU", "FV", "FX", "G", "GF", "GS", "GS0", "GS3", "GS7", "GS8", "GSB", "GSC", "GSE", "GSM", "GT", "GTF", "GTM", "H", "HFM", "HS", "HV", "I1", "I2", "I3", "I4", "I5", "I6", "I7", "I8", "IB", "IC", "IE", "IF", "IN", "IND", "INT", "IK", "IOP", "IR", "IS", "IPT", "IQ", "ITV", "JA", "JC", "JL", "JPC", "JQ", "K8", "KA", "KC", "L", "L1", "L2", "L3", "L4", "L8", "LAW", "LC", "LD", "LG", "LH", "LJ", "LK", "LM", "LO", "LOS", "LP", "LQ", "LR", "LS", "LSL", "LT", "LU", "LV", "LW", "LX", "LZ", "MB", "MC", "M1", "MJ", "M2", "MK", "M3", "M4", "M5", "M6", "MCQ", "MD", "MED", "ML", "MIN", "MTC", "MTF", "MTG", "MS", "MSD", "MW", "MX", "N1", "N2", "NB", "O", "O7", "O8", "OA", "OAM", "OB", "OC", "OD", "ODA", "ODB", "ODF", "ODL", "ODM", "ODP", "ODT", "ODZ", "OF", "OG", "OI", "OL", "OM", "ON", "OP", "OPD", "OQ", "OR", "OS", "OT", "OU", "P1", "P2", "P3", "P4", "P5", "P6", "PB", "PC", "PCA", "PER", "PK", "PL", "PR", "PRD", "PS", "PT", "PX", "Q2", "Q8", "QL", "QM", "QP", "QQ", "QZ", "R2", "R3", "RD", "RE", "REQ", "RF", "RG", "RH", "RL", "RN", "RP", "RQ", "RX", "RR", "RT", "RY", "RZ", "S5", "SA", "SAF", "SC", "SD", "SDI", "SDK", "SE", "SI", "SIF", "SJ", "SK", "SL", "SLC", "SLS", "SM", "SN", "SP", "SQ", "SR", "STI", "SU", "T1", "T2", "T3", "T4", "T5", "TA", "TC", "TCW", "TD", "TEM", "TF", "TG", "TM", "TOA", "TQ", "TR", "T/TL", "TU", "TW", "TZ", "U", "U8", "UC", "ULV", "UR", "US", "USV", "VCQ", "VP", "VT", "WDD", "X5", "X/XL", "XR", "XT", "ZL"}

property rosterDecode : {"Transition IPT 1", "Transition IPT 2", "Recurrent Training 1 2R Recurrent Training 2 3R Recurrent Training 3 4R Recurrent Training 4 5R Recurrent Training 5 6R Recurrent Training 6 1X Transition Simulator 1 2X Transition Simulator 2 3X Transition Simulator 3 4X Transition Simulator 4 A Available Day", "Specially arranged check (Non-operate)", "Specially arranged check (Operate)", "Airbus Emergency Procedure Training + ARB", "B744 Emergency Procedure Training + ARB", "B777 Emergency Procedure Training + ARB", "Authorized Examiner Instructor / FTC Facilitator", "TRE/IRE Approved Person Issue /Renewal", "Annual Line Check", "Additional Training and Modular Assessment", "Additional Training & Proficiency Assessment", "3-Bar/4-Bar Appointment", "Annual Route Briefing", "Air Safety Committee Meeting", "Supplementary simulator training", "Authorized Examiners Course in Simulator - report at 0800L on Day 1 and the rest will be as per the course plan B Crew on temporary basing / base swap", "Normal Procedures Briefing", "Non Normal Procedures Briefing", "CAD Approved Person Issue", "LFUS for 3 month recency", "Observe/Conduct RT simulator session under supervision", "Command LOFT 1 in Simulator", "Command LOFT 2 in Simulator", "Command LOFT 3 in Simulator", "Command LOFT 4 in Simulator", "Command LOFT 5 in Simulator", "Command LOFT 6 in Simulator", "747-8 Differences IPT 1", "747-8 Differences IPT 2", "Command Assessment Line Check", "Check Duty ( non-operate )", "Corporate Communication Duty", "Check Duty", "BTC Simulator / Aircraft Base Training ", "Aircraft Base Training Under Supervision", "Line Check Training Captain", "Line Check Training Captain", "Check Duty in Simulator", "Command Development Training", "Conduct SI Approved Person Check", "Final Command Check", "Command upgrade ground school / training simulator session", "Commander", "Course in Outport", "Local Pilot Forum Monthly Meeting", "CRM Presenter Training Workshop", "CCQ PC in Simulator", "CQP Meeting â€" report at Simulator Instructors Conference Room 1FL, FTC at 0900L ", "Office day for CQP development", "Company CRM Induction", "Crew Resources Management Introduction Course ( Details to be advised )", "Check & Training Meeting â€" 6/F., FTC start time 0930L", "CRM/TEM Refresher Course (Room 2.8, 2/F FTC)+Fleet Forum at 1620L (Fleet Office)", "Captain, F/O, S/O conversion ground school / training simulator session", "Crew-up Duty in Simulator", "747-8 Distance Learning", "De-briefing After Simulator Training - report at 1100L, Student Rest Area, 4/F, FTC ", "Distance Learning", "Duty Operations Manager", "Additional Standardisation Line Check Right Seat Sectors Other Type", "B744 1 Engine Inoperative Ferry Training as First Officer in Simulator", "Additional Line Check Sectors Other Type ", "English Language Test (Details to be advised)", "Route Endorsement", "A340 / B744 1 Engine Inoperative Ferry Training as Captain in Simulator", "Additional Standardisation Line Check Sectors Other Type", "Line Flying Under Supervision for 3 Months Recency", "Extended Sector Under Observation / Command Consolidation", "Extended Line Flying Under Supervision", "Extended Break", "Hong Kong CAD Examination (as advised by Flight Crew Recruiting)", "CCQ Examination", "Line Flying Under Supervision under zero flight time Conversion ( No Base Training )", "Conversion - Simulator Normal Procedures 1", "Conversion - Simulator Normal Procedures 2", "Conversion - Simulator Normal Procedures 3", "Conversion - Simulator Normal Procedures 4", "Conversion - Simulator Non-Normal Procedures 1", "Conversion - Simulator Non-Normal Procedures 2", "Conversion - Simulator Non-Normal Procedures 3", "Conversion - Simulator Non-Normal Procedures 4", "Conversion - Simulator Non-Normal Procedures 5", "Final Assessment for Training Captain Appointment", "Final Assessment for Training First Officer Appointment", "Flight Consolidation with Check or Training Captain", "Freighter Differences Course", "Fleet Forum (Report to Fleet Office)", "F/O induction ground school / training simulator session", "Flight Training Workshop ( Induction Package ) - Report at Flying Training Classroom, FTC, 1/F at 0830L", "Induction Line Training Workshop - Report at Flying Training Classroom, FTC, 1/F at 0830L", "Line Training Workshop Fleet - Report at Flying Training Classroom, FTC, 1/F at 0830L", "Line Training Workshop - Report at Flying Training Classroom, FTC, 1/F at 0830L", "Flight Training Workshop ( Command Orientation ) - Report at Flying Training Classroom, FTC, 1/F at 0830L", "Flight Training Workshop ( Authorized Examiner ) - Report at Flying Training Classroom, FTC, 1/F at 0830L", "Flight Training Workshop ( Line Check ) - Report at Flying Training Classroom, FTC, 1/F at 0830L", "Flight Training Workshop (Relief Pilot In Charge) - Report at Flying Training Classroom, FTC, 1/F at 0830L", "Flight Training Workshop (Training Officer) - Report at Flying Training Classroom, FTC, 1/F at 0830L", "Flight Training Workshop ( Training Captain ) - Report at Flying Training Classroom, FTC, 1/F at 0830L", "Flight Training Workshop ( Training Captain ) Final Day - Report at Flying Training Classroom, FTC, 1/F at 0900L", "HF Train the Trainer Course", "First Officer Critical Take-off & Landing Recency", "FMS Ground School Training (details to be advised)", "FMS Test", "Conversion - Simulator Non-Normal Procedures 4 Engine Aircraft ", "Conversion - Simulator Additional", "Fleet Standardization Meeting", "Sector Under Observation / Command Consolidation", "FTM Workshop - report at FTC, 1/F at 0930L ( finishing at 1230L )", "Conduct Second Officer LFUS under Supervision", "JF/O upgrade ground school / training simulator session", "Conversion - Simulator Non-Normal Procedures X (only for 2x like qualified crew) ", "Guaranteed Day Off", "Group Training Footprint (with sim)", "TTS Ground School ( Details to be advised )", "A340 Ground School ( Details to be advised )", "A330 Ground School ( Details to be advised )", "B777 Ground School ( Details to be advised )", "747-8 Differences Ground School", "B744 Ground School - report at FTC at time as per course plan", "TTS Ground School ( 0830-1600 )", "Ground School before EXM / EXQ - report at FTC at 0830 L", "Ground School for A340 / A330 Cross Crew Qualification", "Supplementary flying training", "Group Training Footprint - CX & KA Project", "Group Training Footprint Meeting", "Hong Kong Based Roster (for freighter crew)", "Human Factors Meeting", "Handling Simulator Session", "Training handover / Safety Pilot", "Conversion - IPT Normal Procedures 1", "Conversion - IPT Normal Procedures 2", "Conversion - IPT Normal Procedures 3", "Conversion - IPT Normal Procedures 4", "Conversion - IPT Non-Normal Procedures 1", "Conversion - IPT Non-Normal Procedures 2", "Conversion - IPT Non-Normal Procedures 3", "Initial DCA 528 Simulator Session", "Initial Briefing for Conversion Course / Initial Simulator Brief", "Conduct Conversion", "Conversion - IPT Additional", "Induction LOFT", "General Simulator Instructor Duty", "Flight Crew Recruiting Induction Day", "Conduct Interview", "Simulator Base Training TRE/IRE Issue under the supervision of a CAD FOI", "Interview / Cadet Visit / Duty in Outport", "Initial Proficiency Check", "Ground Instructor Duty", "Integrated Procedures Trainer; Reports at 1/F, FTC (2 hours reporting time for B744)", "P1 Base Training Simulator", "Interview (Please contact the Fleet Office for details)", "Simulator Assessment", "Flight Consolidation for Junior First Officer", "Jury Leave", "Junior Pilot Club Function", "JFO Upgrade Initial Base Training", "Observe/Conduct I8 session under supervision", "Line Flying with KA Observation", "Dragonair Simulator Duty", "Leave", "Line Operational Simulator 1", "Line Operational Simulator 2", "Line Operational Simulator 3", "Line Operational Simulator 4", "747-8 Familiarization Sector ", "CAD Law Exam", "Aircraft Conversion Line Check", "AHK Wet Lease", "Landings to First Officer Training in Simulator", "To operate in Left Seat with CAD personnel", "Long Joker GDO Request", "Intermediate Command Check", "Conversion Course (Initial LWMO session) ", "LOFT #11", "LOSA Project", "Line Flying Under Supervision + Safety Pilot", "CCQ Line Check", "Landing Recency", "Left Seat Familiarization", "Long Service Leave", "Line Orientated Flight Training", "Line Flying Under Supervision", "Second Officer Line Flying under Supervision", "Initial LWMO training", "Left Seat LWMO Training", "Line Flying Under Supervision for JFO Upgrade Training + Safety Pilot", "Management Briefing for STC, TCC and TCL appointment (please contact secretary of relevant Fleet Office)", "Management check (Non-operate); conducted by Management Check Captain", "Module One", "Module J", "Module Two", "Module K", "Module 3 Second Officer Proficiency Check", "Module Four", "Module Five", "Module 6 Second Officer Proficiency Check", "Medical Clearance Requirement", "Management check (Operate); conducted by Management Check Captain ", "Medical Appointment as advised", "Maternity Leave", "Flight Training Workshop ( Induction Package )", "Flight Training Workshop ( Training Captain )", "Flying Training Forum", "Meeting", "Second Officer Supplementary Module ", "Study Day after Maternity Leave", "Crew-up for Command LOFT in Simulator", "Non-Scheduled MX Module", "Simulator 5", "Simulator 5", "Not a Legal Break", "Day off", "747-8 Familiarization Sector", "Observe Initial DCA 528 Simulator Session", "Observe Aircraft Base Training", "Meeting Between Operations and HKAOA", "Observer / Route Familiarization", "Observe Conversion Training", "Office Duty", "Office Duty in Amsterdam", "Office Duty in Brisbane", "Office Duty in Frankfurt", "Office Duty in London", "Office Duty in Manchester", "Office Duty in Paris", "Office Day for Training Development ", "Office Duty in Los Angeles", "Observe Standardisation Check", "Observe RG Simulator", "Observe IR", "Observe LWMO Training", "Observe / Conduct SO Module", "Observe/Conduct Simulator 5", "Observe PC Simulator Session ", "Course / Duty in Outport", "Observe Simulator Base Training", "Observe RT", "Observe Initial Simulator Briefing", "Observe CST/CMD Loft", "Observe/Conduct PC Under Supervision", "Proficiency Check 1", "Proficiency Check 2", "Proficiency Check 3", "Proficiency Check 4", "Proficiency Check 5", "Proficiency Check 6", "Pre-briefing Before Simulator Training - report at 1100L, Student Rest Area, 4/F., FTC", "AR, IR, IAL, LWMO and Emergency Manoeuvres", "Pre-Command Operational Knowledge Assessment (details to be advised) ", "Performance Transport", "Progress Check", "Probationary Line Check", "Progress Review", "Preparation day for instructor duty", "Paid Reserve", "Crew Positioning with a ticket", "Crew Positioning without a ticket", "P2X Qualification Base Training Simulator", "CCQ Base Training Simulator For Captain & First Officer", "JFO Assessment Line Check", "Current Type Command Base Training Simulator", "Simulator session for CQP development (2 hours briefing & 2 hours debriefing time)", "P1 Qualification Base Training Simulator / Flight", "Zero Flight Time Simulator Base Training", "Schedule 11 revalidation", "MFF 3 month recency simulator", "Relief Pilot in Charge and Check Duty", "CAD personnel to operate in Right Seat with Checker & Trainer", "Request", "Observer / Route Familiarization", "Relief Pilot in Charge Simulator Qualification", "To operate in the Right Seat with CAD personnel", "Relief Pilot In Charge & Annual Line Check", "Relief Pilot in Charge and Training Duty", "Relief Pilot", "Relief Qualified", "CCQ Training in Simulator", "Recurrent Training for 35 Days Recency", "Pilot Recurrent Training", "3 month recency simulator", "RQ and 747-8 Familiarization Sector", "Second Officer P2X 528 and Instrument Rating", "Second Officer Aircraft Line Check", "Flight Safety Briefing - report to Corporate Safety Department, 1st Floor, Central Tower, Cathay City 0900L until 1200L", "Second Officer Progress Check", "Standardisation check duty (non-operate)", "Simulator Development for Simulator Instructor", "Simulator Development for Simulator Instructor (Mandatory)", "Standardisation Line Check Right Seat Sectors", "S/O induction ground school / training simulator session", "Simulator Instructor Forum", "Short Joker GDO Request", "Conduct SI Standardisation Check", "Second Officer Annual Line Check", "Special Leave Converted", "Special Leave Scheme", "Simulator Change or Addition Request Session (SCAR)", "Standardisation check duty (operate)", "Safety Pilot", "Standardisation Check and Annual Line Check", "Simulator Instructor Training - Technical Briefing", "Second Officer Technical Interview (Details as per letter) ", "Suspension", "Command Skills Training Module 1", "Command Skills Training Module 2", "Command Skills Training Module 3", "Command Skills Training Module 4", "Command Skills Training Module 5", "Training Capt / Training First Officer", "Training Duty ( non-operate )", "Training Captain Workshop", "Training Duty", "Threat and Error Management - report at room 2.8, FTC, at 0900L (for courses in outport, details to be advised)", "Pre-test Flight Exercise in Simulator", "Right Seat Training", "Training Module - supplementary training as required", "Technical & Operational Assessment", "Training Captain re-qualification line check", "LFUS for 3 month recency", "Self Critical Take-off & Landing Recency", "Training Captain / First Officer Training", "TCAS + LWMO", "Training duty for CCQ LUFS, trainee to carry out 2 take-offs and landings", "Unfit", "Conduct Initial DCA 528 Simulator Session under Supervision", "Conduct Conversion Under Supervision", "Unpaid Leave", "Conduct RT Simulator Session Under Supervision", "Under Supervision", "USA Visa Application", "Visa Clearance Requirement", "VIP session (with Sim)", "Voluntary Training", "Wet Ditching Drill - report at Safety Training School, FTC at 1330L ( Swimming Gear required )", "Second Officer CCQ 528", "Both Captain & First Officer Critical Take-off & Landing Recency", "LFUS for 60 day Recency", "Recurrent Training for 60 Days Recency", "Self Critical Take-off & Landing Recency"}

set clipboardText to the clipboard
set code to word 1 of clipboardText as string
set loopCount to 1
repeat until item loopCount of rosterCode = code
	set loopCount to loopCount + 1
end repeat
set code to item loopCount of rosterDecode


display dialog code

“word of” is the culprit. It takes punctuation into account. That includes slashes, so those 3 codes are seen as two words. There’s also quite a bit of redundancy. Replace the first two lines of actual code with this:

set code to the clipboard

Thanks alastor933,

You’ve helped me again…

Any hints on how to solve this? Should I use “text item 1” instead?

cheers

Kev

Feeling stoopid now…

Thank you so much.

Been there, done that :slight_smile: