Difference between revisions of "Scripting Syntax"

From Audacity Wiki
Jump to: navigation, search
(New page: Expanded Syntax for GetTrackInfo and SetTrackInfo: ===GetTrackInfo and SetTrackInfo, Expanded Syntax:=== '''GetTrackInfo:''' GetTrackInfo: Type=[Name, Selected, Solo, Mute, Linked, Fo...)
 
(Marked page for deletion)
 
(19 intermediate revisions by 5 users not shown)
Line 1: Line 1:
[[Expanded Syntax for GetTrackInfo and SetTrackInfo:]]
+
* See also [https://manual.audacityteam.org/man/scripting.html scripting] in the manual.
  
===GetTrackInfo and SetTrackInfo, Expanded Syntax:===
+
{{ednote|[[ToDo-2]]'''Steve 30Jun20:''' This page needs to be deleted,
'''GetTrackInfo:'''
+
* links to it updating,  
GetTrackInfo: Type=[Name, Selected, Solo, Mute, Linked, Focused, Pan, Gain] TrackIndex=n 
+
* discussion moving to a new page or meging with related content.
  
'''New Type Parameters:'''
 
Pan
 
Gain
 
Solo
 
Mute
 
Selected
 
Linked
 
Focused
 
  
'''SetTrackInfo:'''
+
<pre>
SetTrackInfo: Type=[Name, Selected, Solo, Mute] TrackIndex=n Setting=[true, false, 1, 0, yes, no]
+
{{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.
 +
}}
  
where n is the number of the track, starting with 1 as the top audio track.
 
  
'''New Type Parameters:'''
+
{{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. }}
Solo
+
{{alert|When commands return a syntax error, the results may subsequently lag behind the requests, which can get confusing.}}
Mute
 
Selected
 
  
 +
=Overview=
 +
This page contains information about an expanded Syntax for GetTrackInfo and SetTrackInfo for the scripting feature in Audacity.
  
Note that Solo, Mute, Pan and Gain will not work on tracks other than tracks which are Audio tracks. 
 
There is no check, nor is there an error message, there is simply nothing done.
 
  
 +
==GetMenusPlus:==
  
===New Commands GetProjectInfo and SetProjectInfo:===
+
Gets a list of all the menu items in JSON format
<div class="editornote"> ''Not yet implemented in Audacity 1.3.8'' </div>
+
* [[WIT_Audacity_Menus|Sample output]]
  
  
'''GetProjectInfo:'''
+
'''Parameters:'''
GetProjectInfo: Type=[Name, SoloTracks, MuteTracks, SelectedTracks, FocusedTrackID]
+
{{Param|1=''Dummy''|2=This parameter does not exist.}}
              //  and possible future parameters: [SampleRate, NumberOfTracks, etc.]
 
  
Allows information about all project's tracks to be returned to the script.
 
  
'''Parameters:'''
+
'''Examples:'''
 +
{{Send_Receive_Title}}
 +
{{Send_Receive|1=GetMenusPlus|2=GetMenuPlus finished: OK}}
 +
 
 +
==GetBoxes:==
  
::;SelectedTracks
+
Gets a list of all the toolbars and buttons in JSON format
:::An integer (default: 0) identifying the track
 
  
::;Type
 
:::Info to get. One of: Name, SelectedTracks, SoloTracks, MuteTracks, FocusedTrackID (default: Name)
 
  
'''Examples:'''
+
'''Parameters:'''
{|
+
{{Param|1=''Dummy''|2=This parameter does not exist.}}
|'''Send'''
 
|'''Receive'''
 
|-
 
|
 
GetProjectInfo: Type=SoloTracks
 
|
 
001010000
 
GetProjectInfo finished: OK
 
|-
 
|
 
GetProjectInfo: Type=FocusedTrackID
 
|
 
4
 
GetProjectInfo finished: OK
 
|}
 
  
  
'''SetProjectInfo:'''
+
'''Examples:'''
SetProjectInfo: Type=[Name, SoloTracks, MuteTracks, SelectedTracks] TrackSet=10110100xxx
+
{{Send_Receive_Title}}
 +
{{Send_Receive|1=GetBoxes|2=GetBoxes finished: OK}}
  
Allows the state of one parameter on all project's tracks to be set to a particular value.
 
  
The TrackSet parameter represents the setting for tracks numbering left to right, starting with 1, as in 12345...
+
==GetClips:==
  
The characters in the string represent enabling (1) disabling (0), or leaving alone (x) the parameter indicated by Type=ParamTracks for each channel.
+
Gets a list of all the clips in JSON format
 
'1' means that parameter is asserted in that track, for example, for MuteTracks, a 1 will mute that track.
 
  
'0' de-asserts it, i.e. unmutes it.
 
  
'x' will leave the indicated track in its current state.
+
'''Parameters:'''
 +
{{Param|1=''Dummy''|2=This parameter does not exist.}}
  
  
 +
'''Examples:'''
 +
{{Send_Receive_Title}}
 +
{{Send_Receive|1=GetClips|2=GetClips finished: OK}}
  
Note that 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.
 
  
Note also that there is 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.
+
==GetLabels:==
  
 +
Gets a list of all the labels in JSON format
  
  
 
'''Parameters:'''
 
'''Parameters:'''
 +
{{Param|1=''Dummy''|2=This parameter does not exist.}}
 +
  
::;Type
+
'''Examples:'''
:::Info to get. One of: Name, SelectedTracks, SoloTracks, MuteTracks, FocusedTrackID (default: Name)
+
{{Send_Receive_Title}}
 +
{{Send_Receive|1=GetLabels|2=GetLabels finished: OK}}
 +
</pre>
 +
}}
  
::;SelectedTracks
 
:::A string of characters: {1,0,x} indicating Assert, Deassert or leave alone, respectively
 
  
'''Examples:'''
+
[[Category:For Developers]]
{|
 
|'''Send'''
 
|'''Receive'''
 
|-
 
|
 
SetProjectInfo: Type=SoloTracks
 
|
 
001010000
 
|-
 
|
 
SetProjectInfo: Type=FocusedTrackID
 
|
 
4
 
|}
 

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}}