Creating scripts with Excel

A few people have asked, how Excel could be used to create scripts or at least how to build simple patterns. I will use Handy and the app HandyControl to show you how it can be done as it supports an easy to use Excel import/export feature through the clipboard.

In the download folder of the app you can also find a script collection that is solely build with Excel.

Notice: You should have a basic understanding on how Excel works and how to use formulas or you will have a hard time to get things running. You might need to convert the shown formulas from german to the language that your excel is using.


Basic Script

A script needs two information. A timestamp in milliseconds and a position in percent where 0 is the bottom where the device needs to move down and 100 where the device moves up. The device will try to reach the position for the given timestamp. You can use any full number position within the 0-100 range.

In the example I have build two columns on the left which I use for input. The two right columns are calculated and are used to export the data.

Used formula: Add the time difference to the last timestamp.
grafik

Now export this to the clipboard by selecting the two right columns and press Ctrl + C
grafik

Import in HandyControl through the context menu.
grafik

You will get a simple script with top/down strokes.
Clipboard958431

Make sure that SmartJitter is disabled or it will modifie the script data on import.
grafik

You can now export the script to a .funscript or .csv file or copy if back to the excel clipboard.
grafik


Speed Modifications

In this script I increase the speed by reducing the time difference by 5% on each step.
Make sure that the decimals are rounded as we need integer numbers.
grafik
The result is clearly visible.
Clipboard1020492


Position Modifications

We add some new columns in the table.
‘#’ is just a number that counts the rows.
‘P’ marks a Top or Bottom stroke.
‘Offset’ is a position modification.
grafik

The position of the left side is now build with a formula that used 0 for letter ‘B’ and 100 for everything else.
grafik

The offset uses the row number as factor to calculate a sine value.
grafik

This factor is then multiplied with the left position to create the final position.
grafik

Final script in HandyControl.
Clipboard1035460


Using Scroll Bars

You can use scroll bars to chnage a value in a formula by pointing to a named range.
grafik

To use the scroll bar you have to enable the developer tab in excel first.
Now you can insert the scroll bar.
grafik

Right click the control and enter min and max values and the target cell.
grafik

Click your target cell and give it a name.

Use the given name in the formula.
grafik

Now you can scroll the slider and your script is updated automatically.
5 5
15 15
35 35

If the speed increase is removed and the script is expanded then it looks like this.


You also have to make sure that offset values cant go negative.
grafik


Diagramms

If you want to use diagramms in Excel for a preview you should go for XY diagramms.

The diagramm will also update on scroll bar changes.



As of HandyControl 0.12.0 beta1 you can also use a spreadsheet app together with HandyControl to create scripts. View the following link to get started.

8 Likes

Thanks for this helpful post. I just tried a very simple script, but used Google Sheets, since I don’t have Excel. I got an error from the Handy Controller “The data in the clipboard is not supported”
Do you know if the problem is that I didn’t use Excel?

This is really awesome. Who knew Excel had this function?

Out of curiosity, when would you be using Excel to script rather than using one of the scripting tools offered on this site?

I wanted to try Excel so that I can create very simple actions on my Handy that aren’t necessarily timed to a video or audio file. Basically, I want to program my Handy to do what I know feels great, but without me needing to play a video or push buttons on the Handy.
I figured Excel would be easier than learning all the options on the HandyControl program.

1 Like

Oh I didn’t realize this was a response to a specific request. That makes sense now it’s defintely alot more convenient this way.

Thanks for letting me know

HandyControl expects clipboard data format from Excel. Anything else will show the message you have seen.

Try this for Google Sheets:
Export the table as .csv file with comma separator.
You need a header line at the top as the first data row is ignored in the script.
grafik

It will look like this in an editor.
grafik

Drag & Drop the file to HandyControl.
aa