RobotStudio event

Move to home position

Hello, I'm trying to move the robot at home in AUTO. I want to compare the last position in auto with the position if someone moves the robot in manual mode.
To save in manual mode I use this:
IF OpMode()=OP_MAN_PROG AND MechUnitNotMoving=1 THEN
pTemp:=CJointT();

How can I save the position in AUTO before they switch to manual mode? I don't want to save the last position in auto if they only switch to auto and robot doesn't move.
I have multitasking option.
Does someone knew a better idea to move at home in a safe way?
Thank you!