[Android Software Development] eraste:
Here I will explain some other "common" uses for the one click tool.

Using the same principals above:

The one command that should always be in your script file:

adb wait-for-device – remember this tells the program to wait until the device as been connected and detected.

You can use your one click tool to do many things: *WARNING The following procedures are dangerous and can potentially brick your device. Please experiment with easier things before trying your hand at boot.img’s, etc!

1.	Flash a kernel/boot.img for HTC devices or those that use a bootloader. This will not work on Samsung devices or devices that

take “tricks” to get into fastboot or the bootloader. In addition to root, Also this requires your device's bootloader to be unlocked!

You will need to have your kernel/boot.img file in the folder just like the

bootanimation.zip file as before. Anything you want to flash needs to be in this

folder. Not in any subfolders just inside the root folder!

A.	While writing the script in your bootani.bat ( or whatever you named it) file from above. You will leave out the bootanimation stuff

and add this:

B.	Script the bat file as normal then use these commands instead of the others from above to flash: so the script should look

something like this:

ECHO.
ECHO Press any key to continue
ECHO.
PAUSE.
adb wait-for-device
adb reboot bootloader - this command will get you into fastboot. Make sure by looking at your phones screen it says fastboot usb or
something similar indicating you are in fastboot.
ECHO Rebooting to fastboot please wait and do not touch device!
ECHO.
fastboot flash boot boot.img - this is the command that will actually flash the kernel/ boot.img file
ECHO.
ECHO.
ECHO Finished you can now exit this tool and reboot the phone to recovery or the os
ECHO.
ECHO.
EXIT

If a dev has named this kernel/boot.img file to something else ending in .img, .elf, etc make sure you type in the correct name. Such as elekernel.img you would type in the command line the elekernel.img name instead of boot.img so it should look like this:

fastboot flash boot elekernel.img

your kernel can also be named kernel.elf, etc depending on what type of phone you are using. Just make sure to change boot.img to whatever the name of the file is you want to flash.

Then you can continue scripting your bat file to your liking!

2.	This is my favorite! This procedure is harmless if done right but I must say it is still dangerous and you accept the risk if you

decide to do it. This only requires your phone to be rooted!

I have a set of ringtones, alarm sounds, ui, sounds, and notification tones that I use on every phone. So instead of putting them in folders on my sd card or phone storage, I use my one click tool to install them to the system directories so that they show up in the stock ringtone, notification, alarm, etc selection methods.

A.	Take your bat file from above name it whatever you like I use: mysounds.bat

B.	Take the sounds you would like to flash and put them in your folder containing the adb files, bat file, etc.

C.	Script your bat file as normal but leave out the bootanimation stuff. Instead add the following commands: so that it looks something

like this:

ECHO.
ECHO Press any key to continue
ECHO.
PAUSE
adb wait-for-device
ECHO sending your media files please wait and do not touch the phone!
ECHO.
adb push yoursoundsname.mp3 /system/media/audio/ringtones/yoursoundsname.mp3

Now remember the path to your system ringtones etc, may be different depending on the type of phone you have. The above location will work for samsung note 2 and the HTC one X This path is the most common path but still it depends on your phone. Simply use your file explorer and navigate your system folder until you find the path you need and type it in the command line instead of what I have above.

Repeat the above command line until you have all the tones you are flashing added into your bat file

adb push yoursoundsname.mp3 /system/media/audio/ringtones/yoursoundsname.mp3
adb push yoursoundsname1.mp3 /system/media/audio/ringtones/yoursoundsname1.mp3

adb push yoursoundsname2.mp3 /system/media/audio/notifications/yoursoundsname2.mp3
the above one will go into the notification folder for say your favorite SMS tone instead of the ringtone folder

adb push yoursoundsname.ogg /system/media/audio/ui/Lock.ogg <-- AH you see something new! This command will change your screen lock sound to whatever file you want it! This file must be in .ogg format! Make sure its no longer than about 1 second. Or you can get a terrible AudioOut_02 wakelock or similar that will drain your battery!
ECHO finished. Rebooting so changes take effect. After phone reboots you may unplug it
ECHO.
adb reboot
ECHO.
ECHO Thanks
ECHO.
EXIT

As you can see the combinations are endless with the one click tool!

Enjoy

Creating a multi tool with a menu and selectable options!!!!!

Now I will expand the above guides and show you how to make your very on multi tool with a menu and options!

You can download this multitool.zip to use as a guide.

It contains this bat file as well as a bootanimation.zip and an mp3 in the ringtones folder. Simply extract it as before and open it up.

So lets begin.

What are we going to do? We will make a multi tool that will open a few webpages, flash a new bootanimation, or send some ringtones to your sdcard.

First we create a bat file as before. You can name it whatever you like.

Then we use this script to make the new tool: Ill explain the script below

ECHO OFF
color 9f
CLS
:MENU
CLS
ECHO.
ECHO Before you start make sure your phone has USB Debugging enabled!
ECHO.
ECHO.
ECHO .... One CLick Multi Tool ....
ECHO Make your selection below
ECHO ..............................
ECHO.
ECHO 1 - Visit XDA
ECHO 2 - Visit Scotts ROMS
ECHO 3 - Visit EMBLWPDesign
ECHO.
ECHO 4 - Flash a new bootanimation: make sure your custom bootanimation
ECHO is in the bootani folder and named bootanimation.zip!
ECHO 5 - Flash New Ringtones
ECHO 6 - Exit this tool
ECHO.
ECHO 7 - Reboot Device
ECHO.
ECHo.
SET /P M=Type your choice then press ENTER:
IF %M%==1 GOTO XDA
IF %M%==2 GOTO SROMS
IF %M%==3 GOTO EMB
IF %M%==4 GOTO BA
IF %M%==5 GOTO RT
IF %M%==6 GOTO EOF
IF %M%==7 GOTO RD
:XDA
START "" "http://www.xda-developers.com"
GOTO MENU
:SROMS
START "" "http://www.scottsroms.com"
GOTO MENU
:EMB
START "" "http://www.emblwpdesign.com"
GOTO MENU
:BA
adb wait-for-device
adb push bootani/bootanimation.zip /system/media
GOTO MENU
:RT
adb wait-for-device
adb push ringtones /storage/extSdCard/ringtones
GOTO MENU
:RD
adb wait-for-device
adb reboot
GOTO MENU

This will give us a multi tool with a menu were you can select what to do!

:MENU starts the menu making process as an anchor.

ECHO 1 - Visit XDA this will be option one on the menu simple coding! Followed by options 2 and 3 then a space with ECHO. then option 4 through 6 followed by another space using ECHO. finally option 7.

The next bit of menu code that will be different than the regular batch file is the variables!

SET /P M=Type your choice then press ENTER: - this line is were the user will input their selection

IF %M%==1 GOTO XDA - this line begins your variables, so if 1 is selected the script will jump to anchor :XDA and run from there. You can have as many variables as you would like.

Make sure your GOTO ??? command and the anchor later in the script :??? are the same for each variable as above in the script.

Now execution of the selection:

:XDA this line is an anchor for selection 1.

under your anchor you type what you want the script to do then you type GOTO MENU so that the user is taken back to the menu.

You can have the tool exit after any selection you would like. So for instance if I wanted the script to close after the user selected option 1 I would instead of typing GOTO MENU type EXIT

You would repeat this process using the above script as a guide until you had your multi tool the way you wanted it!

With the multi tool you can have things in folders inside the root folder as long as you add the correct path to the items as in the script above with the bootanimation.zip. You see it is located in /bootani within the root folder.

Your knew tool with a menu should look like this: Without option 8. Thats coming later!

Creating these tools with multiple menus!

Ok now you guys should pretty much have the basics of making these tools down. Creating multiple menu's in these tools is just as easy as anything else.

This tool I created will show you that function:

Download appbackup tool. This tool is complete and will work. You can use it, modify it how you want etc.

The code contained in the batch file from the backup tool is as follows with multiple menus:

ECHO OFF
color 9f
CLS
:MENU
CLS
ECHO.
ECHO ..................................
ECHO One click app backup
ECHO Make your selection below
ECHO ..................................
ECHO Developed by: XDA Eraste
ECHO ..................................
ECHO One click app backup
ECHO and restore
ECHO ..................................
ECHO.
ECHO.
ECHO.
ECHO Please review the readme file before continuing.
ECHO.
ECHO This tool is safe however I cannot take responsibility should
ECHO anything negative happen to your phone. Use this tool at your own risk.
ECHO.
ECHO 1 - Continue
ECHO 2 - Exit tool
ECHO 3 - Readme File
ECHO 4 - Credits/Share policy
ECHO.
SET /P M=Type your choice then press ENTER:
IF %M%==1 GOTO MENU1
IF %M%==2 GOTO EOF
IF %M%==3 GOTO RED
IF %M%==4 GOTO MENU2
:RED
ECHO.
START readme.txt
GOTO MENU
:MENU1
color 9f
CLS
ECHO.
ECHO ...............................
ECHO Main Menu
ECHO ...............................
ECHO.
ECHO.
ECHO.
ECHO 1 - Backup apps - This will only backup the apps not the
ECHO data. Use this for a "fresh" app install
ECHO after flashing a new rom, etc.
ECHO.
ECHO 2 - Restore apps - Remember no data will be restored these
ECHO will be "fresh" apps.
ECHO.
ECHO 3 - Exit tool
ECHO 4 - Reboot Device
ECHO 5 - Return to previous menu
ECHO.
SET /P M=Type your choice then press ENTER:
IF %M%==1 GOTO BUP
IF %M%==2 GOTO RES
IF %M%==3 GOTO EOF
IF %M%==4 GOTO REB
IF %M%==5 GOTO MENU
:BUP
ECHO Backing up apps to backup folder that will be created here.
ECHO.
ECHO This can take a while depending on how many apps you have
ECHO Press enter to continue
ECHO.
PAUSE
adb wait-for-device
adb pull /data/app ./backup
ECHO.
ECHO Backup finished Press Enter
ECHO.
PAUSE
GOTO MENU1
:RES
ECHO.
ECHO Restoring apps please wait this can take a while!
ECHO Hit enter to continue.
ECHO.
adb wait-for-device
adb install backup/*.apk
ECHO.
ECHO Finished Restoring apps. You can reboot now and apps should
ECHO show up in Google Play as installed.
PAUSE
GOTO MENU1
:REB
ECHO.
ECHO Are you sure you want to reboot device?
PAUSE
adb wait-for-device
adb reboot
ECHO.
ECHO Rebooting press any key to return to the menu.
PAUSE
GOTO MENU1
:MENU2
CLS
COLOR 04
ECHO.
ECHO ...........................................
ECHO Credits/Share policy please check them out!
ECHO ...........................................
ECHO.
ECHO 1 - Visit XDA
ECHO 2 - Visit ScottsROMS
ECHO 3 - Visit EMB LWP Design - My site
ECHO 4 - Return to main menu
ECHO.
ECHO .......................................
ECHO Share Policy
ECHO This tool created by eraste @ XDA
ECHO For all its users. Feel free to use this
ECHO tool at will. If you use portions of it
ECHO to make your own all I ask is that you
ECHO acknowlege myself a little.
ECHO Credits:
ECHO Developed by: Eraste
ECHO Backup script: Scott @scottsroms
ECHO Restore script: Eraste
ECHO Knowledge: XDA
ECHO ........................................
ECHO.
SET /P M=Type your choice then press ENTER:
IF %M%==1 GOTO XDA
IF %M%==2 GOTO SR
IF %M%==3 GOTO EMB
IF %M%==4 GOTO MENU1
:XDA
ECHO.
START "" "http://xdaforums.com/index.php"
GOTO MENU2
:SR
ECHO.
START "" "http://www.scottsroms.com/content.php"
GOTO MENU2
:EMB
START "" "http://www.emblwpdesign.com/"
GOTO MENU2

With this code sample and the knowledge you have gained from the previous two tutorials adding your own menus should be a breeze!

As you can see in the code the starting menu label is :MENU

The second menu or main menu is :MENU1

And the third or "credits" menu is :MENU2

In the code you can see the commands used to return users to whatever menu you choose, insert a option that the user can type to go to another menu, etc.

This command is just as before in the above tutorials.

GOTO ????

replacing the ? marks with whichever menu you want. So in example in this tool once a user backs up their apps they are returned to the same menu which is MENU1 after hitting enter.

Another cool thing you can do is have one menu different colors than the others. For instance in this tool the start menu and main menu are blue with white text. The credits menu is black with red text. You can see this command above in the script under :MENU2 as COLOR 04.

A link to the page with different color combinations is located in the OP.

Now for what it looks like:

Start menu:

Main menu:

Credit menu: Sorry my computer screen and cam didnt play nice with the dark theme of this one! Looks good on the pc though.

As usual good luck and if anyone needs help don't hesitate to ask. Also these codes, tools, etc are for everyone to use as they please simple credit is all I ask if you use a portion when designing your own.