Take the 2-minute tour ×
Android Enthusiasts Stack Exchange is a question and answer site for enthusiasts and power users of the Android operating system. It's 100% free, no registration required.

What I mostly want to do, is quickly alter settings, add alarms etc.

It is perhaps called something else?

This is from a Windows PC. Language is not important, but I know Python and UNIX scripting.

How would this usually be done?

share|improve this question
    
You said, "script my phone", are you talking about running scripts from your phone or on your Windows PC to interact with your phone? –  Jared Burrows Dec 28 '12 at 20:43
    
The idea is to write them on my PC, to run them on my phone. –  Olav Dec 28 '12 at 20:50
add comment

4 Answers

you can install Qpython to code python apps and make what you want: https://play.google.com/store/apps/details?id=com.hipipal.qpyplus

or you can try to tweak with tasker: https://play.google.com/store/apps/details?id=net.dinglisch.android.taskerm

share|improve this answer
add comment

One thing I haven't seen mentioned yet is SL4A, the Scripting Layer for Android. This allows you run various types of scripts on your phone, Python scripts being one of them. Since SL4A isn't directly in the Play store, you may want something like QPython instead (which incorporates SL4A). Tasker, also mentioned by Izzy, has the ability to launch SL4A scripts.

share|improve this answer
    
SL4A isn't in the Play Store as the developers are concerned over the amount of permissions it requires, where QPython are not. Installing SL4A is trivial though. –  Carl Smith Sep 24 '13 at 16:00
add comment

As you write you know Unix scripting, you might want to take a look at apps like SH Script Runner, Script Manager, Script Kitty, and similar. They all allow you to run shell scripts on your Android device.

Also, you could utilize Tasker: create a task to run a script, and then create a shortcut to that task on your homescreen. So you have easy access to your scripts directly from there.

share|improve this answer
    
They seem to be for running scripts, not writing them. –  Olav Dec 28 '12 at 21:53
    
That's right. You wrote, I quote: The idea is to write them on my PC, to run them on my phone. –  Izzy Dec 28 '12 at 22:00
    
The scripts I am thinking of needs to interact with the phone, executing scripts should be quite trivial? Except perhaps getting root privileges? –  Olav Dec 29 '12 at 7:52
    
You could say so. Basic script execution should be easy. But it will get a little tricky when it comes to stuff like alter settings, add alarms. For this you need to know the corresponding APIs (if there are any accessible from the command line), or you will need appropriate "plugins" which make such APIs available. So you will most likely be unable to test them on your PC (unless using them in an emulator). –  Izzy Dec 29 '12 at 13:21
    
Maybe your approach ("scripting") is not the best for your goal ("quickly alter settings, etc"). As described above, automation tools like Tasker (and add some plugins to it, like e.g. Secure Settings) would be more suitable. Here you can have your settings automatically adjusted at given conditions (such as turning WiFi on when reaching the office/coming home, silence the phone when in night-dock...). Plus you can create shortcuts to execute tasks manually from your homescreen. –  Izzy Dec 29 '12 at 13:26
add comment

Alright, well you said you are running Windows, which supports Microsoft's "batch" scripting. This is not available on your Android device because the Android operating system runs in a Linux environment. So you will need to learn "shell" scripting.

First, you need to check to see if you can run shell scripts from your phone.

use the ADB(Android Debug Shell) to open the console to your phone.

The program, "sh" should be available to you. Simple test(list files):

sh -c "ls"

Have you ever used the Android Terminal application before?

Take a look: https://play.google.com/store/apps/details?id=jackpal.androidterm

Have you ever written shell scripts before?

Take a look: http://tldp.org/LDP/abs/html/

Once you have written your scripts, you need to run them using "sh". Some applications can run scripts for you or you can do it manually using ADB.

Take a look: https://play.google.com/store/apps/details?id=os.tools.scriptmanager

I hope this is helpful, let me know if you need anymore help.

share|improve this answer
    
I guess writing and executing scripts is not difficult. Say I want to turn on my GPS i would have to figure out the call, check the syntax, transfer it to my phone, run/debug it... –  Olav Dec 28 '12 at 21:14
    
Yeah, but most of the time you would probably want to just use adb to do that. Whats the main reason? –  Jared Burrows Dec 28 '12 at 21:16
    
My main reason is to change setting like GPS. –  Olav Dec 28 '12 at 21:54
1  
@Olav - What you're looking for was answered by Izzy. Apps like Tasker and On{x} put a GUI over xml to accomplish actions, like turning GPS on and off under specific conditions. –  Mr. Buster Dec 29 '12 at 1:33
1  
SL4A has an Android API wrapper that makes it easy to do stuff like toggle GPS. –  Carl Smith Sep 24 '13 at 16:02
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.