Where can I find a scripting example?

Post Reply
MusikMan74
Posts: 34
Joined: 06 Jan 2018 23:03

Where can I find a scripting example?

Post by MusikMan74 »

I have looked around on the website and have not found anything.

Some simple examples to get us started would be great :)
kjetil
Site Admin
Posts: 582
Joined: 20 Jul 2017 20:45

Re: Where can I find a scripting example?

Post by kjetil »

Hi,

Large parts of radium itself is scripted, so you can look in the bin/scheme directory for examples. In bin/menus.conf and bin/keybindings.conf you can search for functions that are executed through "evalScheme".

In the manual, you'll find instructions how to bind scripts to keys: http://users.notam02.no/~kjetism/radium ... ramed.html

List of available functions: https://raw.githubusercontent.com/kmath ... rotos.conf
kjetil
Site Admin
Posts: 582
Joined: 20 Jul 2017 20:45

Re: Where can I find a scripting example?

Post by kjetil »

There's also a few discussion about scripting in the github issue tracker:
https://github.com/kmatheussen/radium/i ... evalScheme
MusikMan74
Posts: 34
Joined: 06 Jan 2018 23:03

Re: Where can I find a scripting example?

Post by MusikMan74 »

Thank you.
MusikMan74
Posts: 34
Joined: 06 Jan 2018 23:03

Re: Where can I find a scripting example?

Post by MusikMan74 »

I am finally getting around to reviewing the links from your previous replies.

My initial thoughts about Radium "scripting" would be the ability to control Radium externally, which does not seem to be the case (please correct me if I'm wrong.)

Is it correct to say that the only way to control Radium externally is to issue the supported keybindings, from some other program like AutoHotKey/AutoIt, OR is there another way to call the ra.functions from a script/command line external from the program itself?

Thanks again for your time.
kjetil
Site Admin
Posts: 582
Joined: 20 Jul 2017 20:45

Re: Where can I find a scripting example?

Post by kjetil »

Radium opens a public port you can send scheme code to (first instance uses 5080, if 5080 was not open, use 5081, and so forth). See Help -> About -> Control Port.

You can start a browser-based repl by opening bin/s7webserver/s7webserver_repl.html in a browser.

You can start repl in a terminal by running the bin/scheme/reply.py script.

To start playing from the command line, run this command:

Code: Select all

curl -i -X POST -H "Content-Type: text/plain" -d '(ra:play-song-from-start)' http://localhost:5080
MusikMan74
Posts: 34
Joined: 06 Jan 2018 23:03

Re: Where can I find a scripting example?

Post by MusikMan74 »

WOW.
Very cool powerful remote functionality baked-in!

FYI, sInce I am on Windows:

1. I needed CURL- Windows binaries can be downloaded from:
https://curl.haxx.se/windows/


2. The command-line example supplied needed a syntax modification to work from the Windows cmd prompt- the radium function call requires double-quotes (not single quotes), i.e.:

curl -i -X POST -H "Content-Type: text/plain" -d "(ra:play-song-from-start)" http://localhost:5080


Again, thanks for your time.
Lots more to learn and try out. :D
Post Reply