I was just about to V when/so/but…: 려던 참에

V + 려던 참에 (or 려는 참에) can be placed between clauses to show that you were about to do something when/so/but’:

나가려던 참에 너는 사무실에 왔어요.
I was about to leave when you came to the office.

수영장에 가려던 참에 친구가 월요일에는 문을 닫는다고 말했어요.
I was about to go to the swimming pool when my friend told me it’s closed on Mondays.

책을 사려던 참에 저는 돈이 없는 걸 알았어요.
I was about to buy the book when I realised I didn’t have any money.

메시지를 촬영 하려던 참이었는데 카메라가 고장 난 것 같았어요.
I was about to record (film) a message but it seemed that my camera broke.

홍콩에 이사하려던 참에 먼저 소포를 많이 보내고 있어요.
I’m about to move to Hong Kong so I’m sending a lot of parcels beforehand.