I rewrote a big part of my script tonight. In fact all the complexity/difficulty/errors i encoutered was due to the adb communication.
So now, I simply copy a big part of the script on the phone, then call it from the computer. That means simpler code and probably an executable script from your phone's terminal if you can't use adb.
I think i'll have finished all of that by friday
The problem here is that I don't have an XPeria anymore to test this so… if someone feels like a beta-tester, just tell me
(promise i'll do a safe-beta :P )