Convert text to key presses
Python 2, 338 337 335 331 325 bytes



x=y=s=0
for c in input():p='`1234567890-=`&#9;qwertyuiop[]|`asdfghjkl;\'\n```zxcvbnm,./``````` ~!@#$%^&amp;*()_+~~QWERTYUIOP{}\\~ASDFGHJKL:"\n~~~ZXCVBNM&lt;&gt;?~~~~~~~ '.find(c);S=[p&gt;61,s][c in' \n'];p%=62;Y=p/14;X=[max(x,12),min(max(x,5),10),p%14]['\n '.find(c)];print'sS'[S]*(s^S)+'LR'[X&gt;x]*abs(X-x)+'UD'[Y&gt;y]*abs(Y-y)+'Pp';x,y,s=X,Y,S


Try it online!



Moves directly from each character to the next.

Explanation:


S=[c in K,s][c in' \n'], checks if the next character should be Upper- or lowercase. If c is a space or newline, the case remains the same.
X=[max(x,12),min(max(x,5),10),p%15]['\n '.find(c)]. If c is a space or newline, the closest x-coordinate to the current is chosen(as the keys span multiple columns)
print'sS'[S]*(s!=S)+'LR'[X&gt;x]*abs(X-x)+'UD'[Y&gt;y]*abs(Y-y)+'Pp', prints the case switch, the number of x-coordinate moves, the number of y-coordinate moves, and finally Pp, for each character




Shorter version, if the shortest path is not required:

Python 2, 294 293 291 287 281 bytes



x=y=s=0
for c in input():p='`1234567890-=`&#9;qwertyuiop[]|`asdfghjkl;\'\n```zxcvbnm,./``````` ~!@#$%^&amp;*()_+~~QWERTYUIOP{}\\~ASDFGHJKL:"\n~~~ZXCVBNM&lt;&gt;?~~~~~~~ '.find(c);S=[p&gt;61,s][c in' \n'];p%=62;X,Y=p%14,p/14;print'sS'[S]*(s^S)+'LR'[X&gt;x]*abs(X-x)+'UD'[Y&gt;y]*abs(Y-y)+'Pp';x,y,s=X,Y,S


Try it online!