Difference between revisions of "Scripting Syntax"

From Audacity Wiki
Jump to: navigation, search
m (Text replace - "http://manual.audacityteam.org" to "https://manual.audacityteam.org")
(Marked page for deletion)
 
(8 intermediate revisions by 2 users not shown)
Line 1: Line 1:
* See also [https://manual.audacityteam.org/index.php?title=Scripting scripting] on the manual wiki.
+
* See also [https://manual.audacityteam.org/man/scripting.html scripting] in the manual.
  
__NOTOC__
+
{{ednote|[[ToDo-2]]'''Steve 30Jun20:''' This page needs to be deleted,
 +
* links to it updating,
 +
* discussion moving to a new page or meging with related content.
 +
 
 +
 
 +
<pre>
 +
{{ednote|1= &nbsp;
 +
'''James:''' The old content of this page has now been corrected, updated and transferred to the alphamanual. 
 +
* I've implemented missing/incomplete commands.
 +
* We need a rethink of presentation of commands.
 +
** The current format is much too verbose.
 +
** Something like the [https://alphamanual.audacityteam.org/man/Keyboard_Shortcut_Reference Shortcuts page] in the manual might be more use.
 +
}}
 +
 
 +
 
 +
{{alert|This page is work in progress.  The commands here are currently only available in some alpha builds, and the documentation may not quite match the commands implemented.  That is why this is in the wiki rather than in the alphamanual. }}
 +
{{alert|When commands return a syntax error, the results may subsequently lag behind the requests, which can get confusing.}}
  
 
=Overview=
 
=Overview=
 
This page contains information about an expanded Syntax for GetTrackInfo and SetTrackInfo for the scripting feature in Audacity.
 
This page contains information about an expanded Syntax for GetTrackInfo and SetTrackInfo for the scripting feature in Audacity.
  
==GetTrackInfo and SetTrackInfo, Expanded Syntax:==
 
  
===GetTrackInfo:===
+
==GetMenusPlus:==
  
Returns information about one track.
+
Gets a list of all the menu items in JSON format
 +
* [[WIT_Audacity_Menus|Sample output]]
  
In each of the following commands the value is returned if the setting exists.  Not clear what is returned if the setting does not.
 
  
 
'''Parameters:'''
 
'''Parameters:'''
{{Param|1=Type|2=Info to get. One of:
+
{{Param|1=''Dummy''|2=This parameter does not exist.}}
*Pan
 
*Gain
 
*Solo
 
*Mute
 
*Selected
 
*Linked
 
*Focused
 
Pan and gain return decimal values, the others boolean values.
 
}}
 
{{Param|1=TrackIndex|2=The number of the track to get info from}}
 
  
  
 
'''Examples:'''
 
'''Examples:'''
 
{{Send_Receive_Title}}
 
{{Send_Receive_Title}}
{{Send_Receive|1=GetTrackInfo: Type=Selected TrackIndex=2|2=false}}
+
{{Send_Receive|1=GetMenusPlus|2=GetMenuPlus finished: OK}}
{{Send_Receive|1=GetTrackInfo: Type=Gain TrackIndex=3|2=0.5}}
 
  
 +
==GetBoxes:==
  
===SetTrackInfo:===
+
Gets a list of all the toolbars and buttons in JSON format
  
Sets information for one track.
 
  
 
'''Parameters:'''
 
'''Parameters:'''
{{Param|1=Type|2=Info to set. One of:
+
{{Param|1=''Dummy''|2=This parameter does not exist.}}
*Selected
 
*Solo
 
*Mute
 
N.B. 'Name' is not yet supported.
 
}}
 
{{Param|1=TrackIndex|2=The number of the track to set.<br>
 
1 is the top audio track.}}
 
{{Param|1=Setting|2=The value to set. One of
 
*true, 1 or yes (all three are treated the same)
 
*false, 0 or no (all three are treated the same)}}
 
 
 
 
 
  
Note that Solo and Mute only work on Audio Tracks. On tracks other than Audio Tracks, nothing is changed, there is no check, nor is there an error message, there is simply nothing done.
 
  
 
'''Examples:'''
 
'''Examples:'''
 
{{Send_Receive_Title}}
 
{{Send_Receive_Title}}
{{Send_Receive|1=SetTrackInfo: Type=Selected TrackIndex=2 Setting=true|2=SetTrackInfo finished: OK}}
+
{{Send_Receive|1=GetBoxes|2=GetBoxes finished: OK}}
{{Send_Receive|1= SetTrackInfo: Type=Solo TrackIndex=3 Setting=false|2=SetTrackInfo finished: OK}}
 
  
If the track index is out of range, or otherwise invalid, the following occurs:
 
{{Send_Receive_Title}}
 
{{Send_Receive|1=SetTrackInfo: Type=Selected TrackIndex=2 Setting=true|2=SetTrackInfo: Failed! Invalid TrackIndex}}
 
  
 +
==GetClips:==
  
==New Commands GetProjectInfo and SetProjectInfo:==
+
Gets a list of all the clips in JSON format
  
Returns the chosen information about the tracks in the current project.
 
  
 
'''Parameters:'''
 
'''Parameters:'''
{{Param|1=SelectedTracks|2=An integer (default: 0) identifying the track}}
+
{{Param|1=''Dummy''|2=This parameter does not exist.}}
{{Param|1=Type|2=Info to get. One of:
 
*Name
 
*SelectedTracks
 
*SoloTracks
 
*MuteTracks
 
*FocusedTrackID
 
(default: Name)}}
 
 
 
 
 
  
  
 
'''Examples:'''
 
'''Examples:'''
 
{{Send_Receive_Title}}
 
{{Send_Receive_Title}}
{{Send_Receive|1=GetProjectInfo: Type=SoloTracks|2=001010000}}
+
{{Send_Receive|1=GetClips|2=GetClips finished: OK}}
{{Send_Receive|1=GetProjectInfo: Type=FocusedTrackID|2=5}}
 
{{Send_Receive|1=GetProjectInfo: Type=NumberOfTracks|2=9}}
 
  
  
'''SetProjectInfo:'''
+
==GetLabels:==
 
 
Allows state of one parameter type on all of a project's tracks to be set.
 
 
 
The TrackSet parameter represents the setting for tracks numbering left to right, starting with 1, as in 12345...
 
 
 
The characters in the string represent enabling (1) disabling (0), or leaving alone (x) the parameter indicated by Type=ParamTracks for each channel.
 
 
* '1' means that parameter is asserted in that track, for example, for MuteTracks, a 1 will mute that track.
 
* '0' de-asserts it, for example for MuteTracks a 0 unmutes that track.
 
* 'x' will leave the indicated track in its current state.
 
 
 
 
 
 
 
The string length is not required to match the number of channels in a project.  If the string of 1s and 0s is shorter than the number of channels, then channels beyond the “reach” of the TrackSet string are untouched. 
 
 
 
If the TrackSet string is longer than the number of channels in the project, then those characters in the string beyond the last track in the project are ignored.
 
 
 
No checking done for any mismatch between the TrackSet string length and the actual number of tracks in a session project.  We could decide to return a condition flag indicating the mismatch as the TrackSet string being either too long or too short, if this is deemed important.
 
  
 +
Gets a list of all the labels in JSON format
  
  
 
'''Parameters:'''
 
'''Parameters:'''
{{Param|1=Type|2=Info to get. One of:
+
{{Param|1=''Dummy''|2=This parameter does not exist.}}
*SelectedTracks
 
*SoloTracks
 
*MuteTracks}}
 
{{Param|1=SelectedTracks|2=A string of characters: {1,0,x} indicating Assert, Deassert or leave alone, respectively}}
 
 
 
  
  
 
'''Examples:'''
 
'''Examples:'''
 
{{Send_Receive_Title}}
 
{{Send_Receive_Title}}
{{Send_Receive|1=SetProjectInfo: Type=SoloTracks TrackSet=10010xxx1|2=SetProjectInfo finished: OK}}
+
{{Send_Receive|1=GetLabels|2=GetLabels finished: OK}}
{{Send_Receive|1=SetProjectInfo: Type=MuteTracks TrackSet=101000xxx|2=SetProjectInfo finished: OK}}
+
</pre>
 
+
}}
  
  
 
[[Category:For Developers]]
 
[[Category:For Developers]]

Latest revision as of 20:27, 30 June 2020

ToDo-2Steve 30Jun20: This page needs to be deleted,
  • links to it updating,
  • discussion moving to a new page or meging with related content.


{{ednote|1=  
'''James:''' The old content of this page has now been corrected, updated and transferred to the alphamanual.  
* I've implemented missing/incomplete commands.
* We need a rethink of presentation of commands.
** The current format is much too verbose.
** Something like the [https://alphamanual.audacityteam.org/man/Keyboard_Shortcut_Reference Shortcuts page] in the manual might be more use.
}}


{{alert|This page is work in progress.  The commands here are currently only available in some alpha builds, and the documentation may not quite match the commands implemented.  That is why this is in the wiki rather than in the alphamanual. }}
{{alert|When commands return a syntax error, the results may subsequently lag behind the requests, which can get confusing.}}

=Overview=
This page contains information about an expanded Syntax for GetTrackInfo and SetTrackInfo for the scripting feature in Audacity.


==GetMenusPlus:==

Gets a list of all the menu items in JSON format
* [[WIT_Audacity_Menus|Sample output]]


'''Parameters:'''
{{Param|1=''Dummy''|2=This parameter does not exist.}}


'''Examples:'''
{{Send_Receive_Title}}
{{Send_Receive|1=GetMenusPlus|2=GetMenuPlus finished: OK}}

==GetBoxes:==

Gets a list of all the toolbars and buttons in JSON format


'''Parameters:'''
{{Param|1=''Dummy''|2=This parameter does not exist.}}


'''Examples:'''
{{Send_Receive_Title}}
{{Send_Receive|1=GetBoxes|2=GetBoxes finished: OK}}


==GetClips:==

Gets a list of all the clips in JSON format


'''Parameters:'''
{{Param|1=''Dummy''|2=This parameter does not exist.}}


'''Examples:'''
{{Send_Receive_Title}}
{{Send_Receive|1=GetClips|2=GetClips finished: OK}}


==GetLabels:==

Gets a list of all the labels in JSON format


'''Parameters:'''
{{Param|1=''Dummy''|2=This parameter does not exist.}}


'''Examples:'''
{{Send_Receive_Title}}
{{Send_Receive|1=GetLabels|2=GetLabels finished: OK}}