How to write a script

sixstringsg

Retired Forum Moderator / Retired Recognized Devel
Apr 11, 2009
5,171
6,903
0
Dallas, TX
I am wanting to write a script to change my UV without using Voltage Control, but I have no idea how. Could someone point me to instructions, or possibly write it for me? Thanks in advance.
 

Dani897

Senior Member
Aug 16, 2010
3,613
670
0
I am wanting to write a script to change my UV without using Voltage Control, but I have no idea how. Could someone point me to instructions, or possibly write it for me? Thanks in advance.
voltage control will write the scrpit and put it in the /system/etc/init.d directory but you need to set that directory to read/write, i use root explorer for this. you can view the script in a text editor via root explorer and you will see what it is doing if you want to mimic it.
 
  • Like
Reactions: sixstringsg

sixstringsg

Retired Forum Moderator / Retired Recognized Devel
Apr 11, 2009
5,171
6,903
0
Dallas, TX
voltage control will write the scrpit and put it in the /system/etc/init.d directory but you need to set that directory to read/write, i use root explorer for this. you can view the script in a text editor via root explorer and you will see what it is doing if you want to mimic it.
But isn't that just the boot settings? Or are the apply now settings there too? I'm trying to change it with tasker.
 

Dani897

Senior Member
Aug 16, 2010
3,613
670
0
But isn't that just the boot settings? Or are the apply now settings there too? I'm trying to change it with tasker.
oh, mis understood. ok then what is wrong with using voltage control? :confused:

ill look into it. not sure off the top of my head,

edit: wait what am i saying i know this. the script is the same. putting it in init.d just is a place to make the phone run it on boot. you can copy that script anywhere and edit it for alternate setting and execute it yourself.
 
Last edited:

sixstringsg

Retired Forum Moderator / Retired Recognized Devel
Apr 11, 2009
5,171
6,903
0
Dallas, TX
oh, mis understood. ok then what is wrong with using voltage control? :confused:

ill look into it. not sure off the top of my head,

edit: wait what am i saying i know this. the script is the same. putting it in init.d just is a place to make the phone run it on boot. you can copy that script anywhere and edit it for alternate setting and execute it yourself.
Ok sweet. I want it in tasker because I cant UV as much when its plugged in without CD, so I then could lower the UV when it's plugged in, then raise when unplugged. Thank you!

Sent from my CM7 powered captivate
 

Dani897

Senior Member
Aug 16, 2010
3,613
670
0
there is or used to be an application called sl4a (scripting layer for android) i dont know where to get it but there is a market app called scripter that is essencially the same. if you put the script on the sd card and import it into scripter and it will give you the ability to shortcut to it, you can use taster to open the shortcut automatically under whatever situation you are changing settings or just put the shortcut on the desktop and open it like an application. you should be able to give scripter su permissions to run it. scripter is nice to have because it also adds a support for all file extensions to android. any file extension that doesnt run in another app will just be tagged as a scripter file so you can download any file type in the stock browser of send and recieve them in mms and email with the stock apps.

also i dont know much about scripting, im still learning. i understand the commands and this one is simple just echos some numbers into configuration files, but im not sure of what can be used within the script. it may be possible to add an su command at the start of the script or start each command "sudo". not sure though, if this doesn't work then scripter is definately the way to go.

after years of windows i am more comfortable with a gui that a terminal window, but i get by.
 
Last edited:

Dani897

Senior Member
Aug 16, 2010
3,613
670
0
oh sorry i was mistaken. you can do it in launcher pro activities i thought it shows in shortcuts but i was wrong. im not sure if tasker can use launcher pro activities. let me see if there is an alternate way. did you try putting su in the script and see if that works?
 
Last edited:

sixstringsg

Retired Forum Moderator / Retired Recognized Devel
Apr 11, 2009
5,171
6,903
0
Dallas, TX
oh sorry i was mistaken. you can do it in launcher pro activities i thought it shows in shortcuts but i was wrong. im not sure if tasker can use launcher pro activities. let me see if there is an alternate way. did you try putting su in the script and see if that works?
When I tried launcher pro activities, it force closed anyway. And I tried su once, but ill try again.

Edit: yeah, su doesnt work. And tasker doesn't return errors when something fails. I have to check voltage control to see if it worked.

Sent from my CM7 powered captivate
 
Last edited:

Dani897

Senior Member
Aug 16, 2010
3,613
670
0
sorry. about that, search google for sl4a. that is what tasker expects you to have when you launch scripts anyway. that is why it wants you to have the script in /sdcard/sl4a/scripts

i would assume sl4a would work better in combinations with tasker. hope that it works! ill try to find it.

running the script from the stock file manager or some other meathods will run scripter and ask for su permissions but i have been trying it as well to see what trouble you are having and for some reason when the script is started by tasker scripter doesn't get launched. i assumed it would work because in most situations scripter acts just like sl4a but in this case i was wrong.

edit: here is sl4a http://code.google.com/p/android-scripting/

trying it now
 
Last edited:

sixstringsg

Retired Forum Moderator / Retired Recognized Devel
Apr 11, 2009
5,171
6,903
0
Dallas, TX
sorry. about that, search google for sl4a. that is what tasker expects you to have when you launch scripts anyway. that is why it wants you to have the script in /sdcard/sl4a/scripts

i would assume sl4a would work better in combinations with tasker. hope that it works! ill try to find it.

running the script from the stock file manager or some other meathods will run scripter and ask for su permissions but i have been trying it as well to see what trouble you are having and for some reason when the script is started by tasker scripter doesn't get launched. i assumed it would work because in most situations scripter acts just like sl4a but in this case i was wrong.
Yeah, I found that app. Thanks for all the help! We'll get it eventually.

Sent from my CM7 powered captivate
 

Dani897

Senior Member
Aug 16, 2010
3,613
670
0
not working for me. sl4a force closes. i dont know how to get it to use super user, it may need something in the script or maybe there is a super user version, or maybe it is just out dated and doesn't work in froyo. im not really sure. im about to talk to my brother who knows all about bash scripts in linux and sh scripts are similar. maybe he has an idea. unfortunately he doesn't have an android phone but if he did he would be the person to ask.
 

TheNewGuy

Senior Member
Sep 29, 2009
512
124
0
It is working for me. I had to wait a while at first for a permission request for anonymous user data... also it could be that you already have a folder made. it gave me an error saying that it could not gain permission to add the folder to my sdcard. I think this might be because I have sdext and a2ext... maybe...

Sent from my HTC Vision using XDA Premium App
 

sixstringsg

Retired Forum Moderator / Retired Recognized Devel
Apr 11, 2009
5,171
6,903
0
Dallas, TX
It is working for me. I had to wait a while at first for a permission request for anonymous user data... also it could be that you already have a folder made. it gave me an error saying that it could not gain permission to add the folder to my sdcard. I think this might be because I have sdext and a2ext... maybe...

Sent from my HTC Vision using XDA Premium App
Is it working for you with tasker? And I already accepted the anonymous user data prompt.

Sent from my CM7 powered captivate