Skip to content

What are autoexec.ash scripts and how to get them work!

Pawel Janisio edited this page Jan 11, 2016 · 3 revisions

Definition

Autoexec.ash scripts are files that can be used with the Xiaomi Yi camera to alter the behavior of the camera to suit the user's preference in some, but not all cases. Scripts are not unique to the Yi camera, being used also on GoPro equipment, though GoPro scripts are not necessarily useable with the Yi camera and conversely.


How autoexec.ash works?

Autoexec scripts may contain a command or sequence of commands that the camera understands. When the camera is powered on, it reads the autoexec.ash script as part of it's startup sequence and executes the commands in the script from beginning to end, without interruption. The commands that are executed are effective only during the immediate session in use and are not permanently installed in the camera. So, when he camera is powered off, all commands are forgotten and the settings in the camera revert to whatever firmware setup is present. In special cases, scripts can be 'installed' in internal memory of camera and stay forever. Example of such behaviour can be seen in lost_camera script.


Usage

To use an autoexec.ash script, copy it to the root level (not in any folders) of a microSD card that you intend to use in the camera at startup. Only the name, "autoexec.ash" will be recognized by the camera, and there can be only one such file on the card, since duplicate file names are not allowed. Some users like having several microSD cards each containing a different script, so a different behavior from the camera with each card.

Or which is better solution - use special scripts like ash.booter to switch autoexec scripts with power button, without connecting to an app, or Yiplus script which also allows you to parse json commands to the camera and change the same settings as the official app can do.


Important formating rules!

Autoexec.ash files are created on a computer, using a text editor that produces Unix line endings (\n for "Newline" in Unix), a requirement for the scripts to be recognized by the camera. Without the proper line endings, the script will be ignored. Also, the last line in the script must be blank or empty. Just type a Return or Enter. For editing scripts in Windows, Notepad is not adequate because it does not produce the necessary Unix line endings. Suggested text editors are the free Notepad ++ (https://notepad-plus-plus.org) or the freeware, PSPad (http://www.pspad.com) for Windows users and Textedit (included) for Mac users or the cross-platform Sublime Text (http://www.sublimetext.com) for all users. Any comments in the script must be preceded by the # symbol and are ignored by the camera. Each command is entered on a single line that ends with a Unix line ending. There can be only one command per line. The last line in the script must be a blank or empty line. If the empty last line is missing or if there is an improper line ending anywhere in the script, it will cause the entire script to fail.


Thanks to Squeamish from daschcamtalk.com forum for this detailed exaplnation!