I have made a little script similar to one of the previous answers, but using expect
instead of python
- because it is a bit simpler (expect
was invented for this).
#!/usr/bin/expect
set port [lindex $argv 0]
set lon [lindex $argv 1]
set lat [lindex $argv 2]
set timeout 1
spawn telnet localhost $port
expect_after eof { exit 0 }
## interact
expect OK
set fp [open "~/.emulator_console_auth_token" r]
if {[gets $fp line] != -1} {
send "auth $line\r"
}
send "geo fix $lon $lat\r"
expect OK
send "exit\r"
Exemple usage: sendloc 5554 2.35607 48.8263