ScriptPlayer Command Line Interface

The latest beta version of ScriptPlayer contains a small command line interface that allows you to control an already running instance of ScriptPlayer.

Why would I want to use that?
With this new feature you can control ScriptPlayer from another program, custom input device or whatever.
E.g. you could control SP from your programmable keyboard keys, stream deck, selfmade arduino input device, build a custom webinterface or alexa skill etc.

Which commands are available?
Currently most of the commands that are available are the ones that you can find in the “Input Mappings” settings. You will need the “Command ID” which will show up in a tooltip when you hover a row (right click on a command to copy it to your clipboard)

image

All others will be documented here when I add them.

How do I use it?
The latest beta version contains two programs called “spcli.exe” (Script Player Command Line Interface) and “spcon” (ScriptPlayer Console). These two programs are mostly identical, I’ll highlight the differences a bit later. You can start the programs with the parameters -c <CommandId> to execute a single command. If ScriptPlayer is already running, it will execute the command. To start an interactive session and send multiple commands, simply start the program with -i.

spcli will run “invisible” and will not create a console window. If you do not specify -c or -i it will assume the single command mode -c by default.

spcon will start a new console or use the existing one (e.g. when started from the windows command line) and assume the interactive mode -i by default.

You can run both programs in both modes, but spcli is meant for single commands and spcon for interactive mode.

If you want to toggle playback for example:

image

"C:\Program Files (x86)\ScriptPlayer\spcli.exe" -c TogglePlayback

"C:\Program Files (x86)\ScriptPlayer\spcli.exe" TogglePlayback

or in interactive mode

"C:\Program Files (x86)\ScriptPlayer\spcon.exe" -i 
TogglePlayback

"C:\Program Files (x86)\ScriptPlayer\spcli.exe" 
TogglePlayback

How does it work?
spcli.exe and spcon are tiny little programs that take every argument you give it (except for -h and -c) and pass it on to ScriptPlayer via local named pipes. If ScriptPlayer is not running, nothing will happen.

What’s next?
If you have any suggestions, feedback or would like to see certain commands added, let me know.


Wishlist so far:

  • Reload Script done
  • Seek done
  • OpenFile done
  • SetRange done
  • SetPatternSpeed done
  • SetRangeExtender done
  • Help option that lists available commands
9 Likes

Woah! That’s a super cool feature! I was thinking about building my own little Pi based e-stim player, and this is precisely what I was missing!

2 Likes

pretty dope. this will be useful for automating some stuff with python scripts.

1 Like

If you would add a “seek” command where you can pass a timestamp or a relative position as well as a command to hot reload the funscript, I could write a little Lua extension for OFS to enable live testing through ScriptPlayer. :thinking:

Not sure if there’s demand for such a thing. :eyes:
Still could be interesting.

1 Like

There is now :wink:

Hey, just a quick heads up. Seems like command for connecting the handy is misspelled. It’s “ConenctHandyDirectly” currently.

1 Like

Thanks, I’ll fix that

A couple of new commands in the new version:
(btw. spcli always returns “OK”, that’s not done yet)

(Filenames and other parameters have to be formatted/quoted properly when they contain spaces)

OpenFile

OpenFile <FilePath>
OpenFile C:\Videos\Porn.mp4
OpenFile "D:\Complicated path\with spaces\script.funscript"

Opens the specified file (script or media)

Seek

Seek [+/-]<TimeStamp>
Seek 10000
Seek +01:00
Seek -00:05
Seek 01:23:45.678

Seeks to a timestamp (anything from mm:ss to hh:mm:ss.fff) or simply a number in ms.
If you put a + or - in front of it, it will seek relative of the current timestamp.

ReloadScript

ReloadScript

Reloads the current script

SetRange

SetRange <Min> <Max>
SetRange 0 100
SetRange 20 99
SetRange 70 70

Sets the Min/Max Range (99 is considered the same as 100 for Launch legacy reasons)

2 Likes

Oh, this is perfect!

Everything I do is voice automated and I had to figure out a janky macro to send mouse/kb commands in order to have scriptplayer connect to the launch. A command interface is a much better solution for automation. Thank you for doing this!

Is direct launch connect/disconnect one of the supported commands?

Connect - Yes, disconnect - No (can’t disconnect BLE with the windows API, no idea why …

That’s fine, I can always restart scriptplayer via command line instead. Thanks again!

This could be pretty cool for automating Fap Land, though we’d need scripts for all 100 scenes.

What’s that?

Since I couldn’t get all use-cases working with a simple command switch, I’ve added a second program spcon.

spcli and spcon are mostly identical, but spcli will not launch a visible console anymore and spcon can be used for interactive sessions.

Some examples/use-cases:

  • When you want to execute single commands by pressing hotkeys, shortcuts, etc. without having a console window flash on screen - use spcli
  • When you just want to play with the commands use spcon - it can be launched by simply starting the exe from your explorer
  • When you want to send commands from your own program use either of them depending on what works best with your architecture

ScriptPlayer will now send slightly better feedback than just “OK” by waiting for the command to be processed.
(Not neccessarily finished executing, e.g. when loading files, but at least you know the command was received and the syntax was correct)
If the command isn’t processed within 2 seconds, you will receive a “FAIL:Timeout”.

examples:

OK:Loading File
OK:Executed
FAIL:Expected 2 parameters, got 1
FAIL:Timeout
FAIL:Unknown Command

100 rounds that you randomly traverse though with a dice until you get to the end, not sure if it’s just a 4chan thing but all of their Fap Hero threads have it in the info.

https://boards.4chan.org/h/thread/6375102/fap-hero-general-50#p6375108

It works :raised_hands:
Going to need to do another OFS release though before I can release this because I had to add some functionality to the Lua api, like funscript saving to facilitate this.

1 Like

Nice,

btw. there is a built-in “Auto Reload” debug option in ScriptPlayer that reloads the script whenever the file is changed:

image

If you get this working on a Pi or another linux device, please make a post about it.

1 Like

SetPatternSpeed
Sets the pattern speed in ms, supports absolute and relative values

SetPatternSpeed 1500
SetPatternSpeed -200
SetPatternSpeed +25

SetRangeExtender
Sets the range extender setting, supports absolute and relative values

SetRangeExtender 50
SetRangeExtender -5
SetRangeExtender +10
1 Like