0% found this document useful (0 votes)
2 views21 pages

Scripts

Uploaded by

daniel.bonfim
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views21 pages

Scripts

Uploaded by

daniel.bonfim
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Script Commands

Reference Manual
Table of Content
Script Features ............................................................................................................................................................................... 3
To Run a Script ............................................................................................................................................................................... 4
Command Syntax ........................................................................................................................................................................... 5
SEND.............................................................................................................................................................................................. 7
SET................................................................................................................................................................................................. 9
EXIT.............................................................................................................................................................................................. 10
REBOOT ...................................................................................................................................................................................... 10
SHUTDOWN ................................................................................................................................................................................ 10
ENABLE, DISABLE ...................................................................................................................................................................... 11
REMOVE ...................................................................................................................................................................................... 11
OPEN ........................................................................................................................................................................................... 12
DIALOG ........................................................................................................................................................................................ 12
PRESETS ..................................................................................................................................................................................... 13
CONNECTION ............................................................................................................................................................................. 14
[Link] ........................................................................................................................................................................ 17
[Link] ...................................................................................................................................................................... 19
[Link], [Link] ............................................................................................................................. 19
[Link] ............................................................................................................................................................... 20
Script Features
Simple script structure
May contain single command as well as any number of commands
Can be launched by several methods, incl. HTTP URL or Task Scheduler
Only a few commands to learn
Commands for changing the application settings
Commands for sending data to the encoders (for example TA or text)
Commands for the audio recorder control

Based on feedback from the users, the script possibilities are continuously enhanced.
To Run a Script
The Magic RDS 4 provides several opportunities where its behaviour can be controlled by a user script:

 Task Scheduler – the script is launched upon specified events *)

 Text Conditions – the script is launched depending on a content of external text source *)

 Execute Script window – the script is launched any time by clicking on the Execute button.
 HTTP URL Query – the script is launched from URL, accessed via the Internal HTTP Web Server *)

*) Note: The script length is limited to 2K in those fields.

Examples:

1. In main menu, select Tools – Execute Script.


2. Type this simple script:
set [Link]
open "[Link]
3. Click on the Execute button to see the visual effect.
4. To show the Toolbar again, select View – Toolbar in the main menu.

1. In main menu, select Options – Preferences, enable the Web Server and fill the password.
2. Type and confirm this URL into your web browser address bar:
[Link] password here)
Such URL-encoded line forces the Magic RDS to launch following command: set [Link]
See the next sections for complete list of commands available.
3. To show the Toolbar again, select View – Toolbar in the main menu.
Command Syntax
Following set of rules defines the combinations of statements and symbols that are considered to be correctly structured:

script_command [parameter1[:value1] [parameter2[:value2] ... [parameterN[:valueN]]]] [hide]

script_command
The list of commands follows on next pages.

parameter
Optional. Specifies a parameter for the command call. Order of the parameters is arbitrary.

value
Optional. Assigns a value to the parameter. No space is allowed between the parameter and value.

hide
Optional. If specified, the command launches silently – without a notice in the Recent events. No value.

The script language is completely case insensitive. Each command must start on a new line or must be separated by ;

Examples:

  
script_command1
script_command1; script_command2 script_command1 script_command2
Script_Command2
Parameters are delimited by space characters. So if the value contains a space character, entire value must be double-
quoted. In other cases the quotes are optional.

Examples:

send connection:MyRDS command:TA=1 


send connection:"Connection 1" command:"TA=1" 
send connection:Connection 1 command:PS=KISS FM 
Note: For entering double-quotes inside the text, use escaping sequence ""

URL-encoding table (This table applies only to scripts entered via the HTTP URL.)

(space) %20
" %22
% %25
: %3A
; %3B
= %3D
SEND
Description To send a RDS encoder control command, string or a text, or a batch of commands, to specified
connection(s).

Examples send connection:"*" command:"TEXT=13:00 - Our Interview"


send connection:"*" command:"TA=1"
send connection:"Connection 1" adr:3 site:511 command:"PS=KISS FM" command:"PI=2231"
send connection:"%current%" batchfile:"D:\rdsConfig\[Link]"
send group:"North, South" command:"TA=1"
send connection:"*" exclude:"Connection 2" command:"TEXT=Our station promo" delay:default

Parameters connection
Connection name. May also contain %current% or a wildcard *.
Default is * (all connections excl. Bridges).
exclude
Exclude connection name(s). Optional parameter.
group
Group name. Optional parameter. Sends data only to encoders sharing the group name(s) specified.
command
A control command from the RDS encoder’s repertoire or a string, expressed in ASCII. More command
parameters may be specified. Where applicable, each command is automatically translated to default
communication protocol of each RDS encoder, for example to UECP.
batchfile
Path to the command batch file. In that file, each RDS control command occupies a separate line.
site, adr
Optional encoder Site number (0 to 1023) and/or encoder Address number (0 to 63). Applies to UECP
compatible encoders and UECP protocol.
dsn, psn
Optional Data Set number (0 to 255) and/or Program Service number (0 to 255). Applies to UECP
compatible encoders and UECP protocol.
delay
Optional delay in seconds or „default". The command is placed into queue and it is sent after specified
delay. The default delay is individual to each connection and can be set up in Overview – Extensions.
If not specified, the delay is 0.

Application For complete list of control commands, follow the RDS encoder’s documentation or go to Terminal and
Notes click on appropriate button on the left side. For checking real data sent to the RDS encoder, go to
Overview – Communication Monitor.
SET
Description To change the Magic RDS 4 configuration or to edit the Connection control form data.

Examples set Output1.SrcSequenceItem2Checked:"0"


set [Link]:"1"
set [Link]:"0"
set connection:"Connection 1" [Link]:"0"
set connection:"*" [Link]:"1"
set connection:"*" [Link]:"1"
set group:"East, North" [Link]:"20"

Parameters connection
Connection name (or group name) is required for all classes assigned to particular connection. The
connection name can contain wildcard * (all connections excl. Bridges).
group
Group name. Optional parameter. Sets the property only on connection(s) sharing the group name(s)
specified.
<class>.<property>
The property you want to change.
The parameters are case-insensitive.

Application For complete list of properties, go to the Task Scheduler or another tool which contains script editor
Notes and click on appropriate button on the left side.
EXIT
Description To close the Magic RDS 4 application.

Examples exit

Parameters none

REBOOT
Description To reboot the PC.

Examples reboot

Parameters none

SHUTDOWN
Description To shutdown the PC.

Examples shutdown

Parameters none
ENABLE, DISABLE
Description To enable or disable specified item in the Task Scheduler.

Examples enable itemname:"Item2"


disable itemname:"Item4"

Parameters itemname
Complete name of the item, as appears in the Task Scheduler, column ‘Name’.

Application
Notes

REMOVE
Description To remove current item from the Task Scheduler.

Examples remove

Parameters none

Application This command has effect only if the script was launched by the Task Scheduler. This command
Notes effectively enables the user to schedule a one-time task.
OPEN
Description To open a document in associated application or to launch a new application.

Examples open "C:\Program Files\MyApp\[Link]"


open "D:\text\[Link]"
open "[Link]

Parameters There’s only one parameter which is directly the path to the file or object.

Application
Notes

DIALOG
Description To show a modal dialogue box to the user.

Examples dialog type:confirm text:"Select Yes to continue, select No to abort."


dialog type:info text:"Done."

Parameters type
Can be either confirm or info. In the confirm type, clicking No will terminate the script.
text
The text showed to the user.

Application
Notes
PRESETS
Description To add single click script shortcuts to the application tool bar.

Examples presets clear


presets add:"D:\My Scripts\Config [Link]"

Parameters clear
Removes all presets from the tool bar.
add
Adds the preset – a shortcut to the script file specified.

Application In the application main menu, select Tools – ToolBar Presets. Finally confirm by Execute button.
Notes Resulting script file is named [Link] and it is placed in the application data folder. It is launched on
each application start-up and may contain any other commands.
CONNECTION
Description To add, edit, delete or reconnect a connection.

Examples connection action:add name:"Text 01" model:P164 type:2 nethost:[Link] netport:5000


connection action:delete name:"Test *"
connection action:reconnect name:"bw02"

Parameters action
The action must always be specified. It can be either add, edit, delete or reconnect.
name
The connection name must always be specified. For the delete action, the * wildcard is supported.

Following parameters apply only to the add and edit action:

groupname
Optional parameter. Several connections may share the same group name.
model
The model must be specified. For complete list of options, go to main menu: Connection – Add New
Connection – Connection Kind: RDS Encoder and expand the Device Model field.
type
A number which represents the connection type:
0: none (dummy), 1: Serial/USB, 2: TCP Client, 3: TCP Server, 4: UDP, 5: Internal channel.
comport
For Serial/USB connection type only. COM port number. Default is 1 (COM1).
comspeed
For Serial/USB connection type only. Baudrate value: 1200, 2400, 4800, 9600 or 19200.
parity
For Serial/USB connection type only. Parity: 0: even, 1: odd, 2: none, 3: mark, 4: space.
Default is 2 (none).
flowcontrol
For Serial/USB connection type only. Flow control: 0: none, 1: CTS, 2: DSR, 3: CTS+DSR,
4: Xon/Xoff. Default is 0 (none).
autobaud
For Serial/USB connection type only. Enables (1) or disables (0) speed autodetection. Must be
supported by the device. The bidirectional option must be enabled as well. Default is 1 (enabled).
netport
Network port for TCP or UDP. Allowed range is 1 to 65535.
nethost
Remote host name or IP address for TCP or UDP.
localport
Optional local port for UDP. Allowed range is 1 to 65535.
bidirectional
Enables (1) or disables (0) bidirectional communication. Default is 1 (enabled).
datamonitor
Enables (1) or disables (0) the Data Monitor. Default is 0 (disabled).
responsetimeout
Response timeout in milliseconds. Has no effect if bidirectional communication is disabled.
feedto
For Internal Channel connection type only. Equivalent to the Data Distribution field.
ipaccess
For TCP Server connection type only. Equivalent to the Access Control field.
maxclients
For TCP Server connection type only. Maximum number of clients connected. Default is 1.
keepalive
Reserved for future use. Do not mention nor specify.
connectiontimeout
Reserved for future use. Do not mention nor specify.
reconnectinterval
Reserved for future use. Do not mention nor specify.

Application This command currently supports only RDS Encoder connection kind.
Notes This command cannot be executed by Task Scheduler or Text Conditions.
[Link]
Description To control built-in MP3 audio recorder: To start new recording.

Examples [Link] name:"Recorder1" file:"D:\mp3rec\myrec.mp3"


[Link] name:"Recorder2" stopat:"23:00:00" device:"Line in (Realtek HD Audio)" bitrate:320
[Link] name:"Recorder3" file:"D:\mp3rec\%DATETIME:yy-mm-dd hh-nn%.mp3" maxlen:"01:00:05"
[Link] name:"Recorder1" file:"D:\mp3rec\myrec.mp3" onstop:"copy %file D:\podcasts\latest.mp3"

Parameters name
The recorder name can be any value but must be specified and must be unique. Since more recorders
can be active at the same time, the purpose of the recorder name is to create a reference for further
control of particular recorder.
If a recorder with same name already runs, nothing happens, excl. paused recorder which is resumed.
file
The output audio file name, incl. absolute path. The path must exist. If the .mp3 extension is not
specified, it is added automatically. If the file already exists, it is overwritten.
device
The recording device name, as present in the Windows audio system. If the device specified does not
match any device installed in the PC, or if the device is not specified, a default recording device is
used instead. For the list of devices, select Tools – Audio Recorder – List of Input Devices.
agc
Sets up the AGC (Automatic Gain Control). The AGC prevents audio level differences in the recorded
files. The peak level is kept around -1 dBFS. The AGC release time (speed) is configurable, slowest
value is 1. A value of 0 disables the AGC. Default value is 1.
bitrate
Sets up the MP3 bitrate in kbps. Default is 192.
Following bitrates are supported: 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320.
stopat
A time at which the recording stops automatically. Can be specified in format h:m:s or h:m. Default is
none (infinite recording / until stop).
maxlen
Maximum time of recording. Can be specified in format h:m:s or m:s or s. Default is none (infinite
recording / until stop).
The stopat and maxlen parameters can be both specified. In such case the recording stops at the
earlier event.
fadein
Specifies the sound fade-in effect length in seconds. Default is 0 (disabled).
fadeout
Specifies the sound fade-out effect length in seconds. Default is 0 (immediate stop). If the fadeout is
active, the recorder is still occupied until the fadeout time elapses.
delay
Specifies the recording start delay in seconds. Default is 0 (disabled).
onrun
Execute specified application or Windows batch command when start recording.
onstop
Execute specified application or Windows batch command after stop recording.

Application The audio format is 16-bit stereo 44.1 kHz FBR. See the file [Link] for details.
Notes The parameters name, file, onrun and onstop support dynamic element DATETIME. See the file
[Link] for details.
The parameter file supports dynamic element %name, which is replaced by associated value of the
name parameter. In such case, the name must not contain illegal characters.
The parameters onrun and onstop support dynamic elements %file and %name, which are replaced
by associated values of the file and name parameter.
[Link]
Description To control built-in MP3 audio recorder: To stop existing recording.

Examples [Link] name:"Recorder1"


[Link] name:"Recorder1" fadeout:2
[Link] name:"*"

Parameters name
A recorder name which you want to stop. Asterisk is supported which stops all active recorders.
If the recorder does not exist or is already stopped, nothing happens.
fadeout
Specifies the sound fade-out effect length in seconds. Default is 0 (immediate stop).
Overrides the parameter specified in the [Link] command.

[Link], [Link]
Description To control built-in MP3 audio recorder: To pause or resume existing recording.

Examples [Link] name:"Recorder1"


[Link] name:"Recorder1"

Parameters name
A recorder name which you want to pause or resume.
If the recorder does not exist or is already stopped, nothing happens.
[Link]
Description To delete records (files) which are outdated and no longer required. The files are firstly placed into the
Windows Recycle Bin. Please handle with care to prevent unwanted loss of your data!

Examples [Link] folder:"D:\mp3rec" maxdays:30

Parameters folder
Specifies the folder (absolute path) where the cleanup occurs. The root folder is not allowed due to
safety reasons. Subfolders are not included. Always make sure the specified folder does not
contain music files, jingles etc. as these may be deleted!
extension
Extension of the files being deleted. Default is mp3. Wildcard is supported. If you’re changing the
extension, always check the folder content to prevent unwanted loss of your data!
maxdays
Maximum number of days the files can remain in the folder. Older files are deleted.
One extra day is added for safety reasons.

Application See the file [Link] for details.


Notes
Some command is missing? Do you need to extend the command set? We accept feature requests at [Link]

You might also like