Macros consisting of existing Audacity shortcuts

This read-only archive contains discussions from the Adding Feature forum.
New feature request may be posted to the Adding Feature forum.
Technical support is available via the Help forum.
StevenJayCohen
Posts: 12
Joined: Mon Dec 16, 2013 7:15 pm
Operating System: Please select

Macros consisting of existing Audacity shortcuts

Post by StevenJayCohen » Sun Jan 19, 2014 2:29 pm

Moderator Note: Moved to "Adding Features"

Over time, quite a few people have tried various ways to script Audacity.

For me, the need was Punch and Roll editing. Someone posted a way to do this with a 3rd party program in Windows, but I am on a Mac.

So, I wrote my own using AppleScript http://www.stevenjaycohen.com/2014/01/1 ... n-mac-osx/

But, I got thinking about this...

My script relies almost entirely on shortcuts already built into Audacity (see below);

Code: Select all

    keystroke "k" using {shift down} -- Select to end of VO Track
    keystroke "z" -- find Zero Crossing Cut
    keystroke "x" using {command down} -- Cut the Audio
    keystroke return -- Disarms VO Track
    keystroke "b" using {command down} -- Add Label to Label Track
    keystroke "?" -- Name Label
    keystroke return -- Saves Label
    keystroke return -- Disarms LABEL Track
    keystroke (ASCII character 30) -- Up Arrow selects EDIT Track
    keystroke return -- Arms EDIT Track
    keystroke "v" using {command down} -- Pastes to EDIT Track
    keystroke return -- Disarms EDIT Track
    keystroke (ASCII character 30) -- Up Arrow selects VO Track
    keystroke return -- Arms VO Track
    keystroke ",,,,," -- back up 5 seconds
    keystroke " " -- Start playback
    delay 5 -- wait 5 seconds until end of playback
    keystroke "a" using {shift down} -- stop Playback & set cursor 
    delay 1 -- needed or the following command does not work
    keystroke "r" using {shift down} -- Record from end of track
So, if Audacity would allow macros consisting of the following:
-Stringing built-in Audacity shortcuts together
-Access to Cut/Copy/Paste from the host operating system
-Some kind of pause/wait command

Then, people like me could write/share Macros that would work in a way similar to Chains.

What do you think?
Last edited by StevenJayCohen on Fri Apr 24, 2015 4:28 pm, edited 4 times in total.
Reason: unparse link

Paul L
Posts: 1788
Joined: Mon Mar 11, 2013 7:37 pm
Operating System: Please select

Re: Macros consisting of existing Audacity shortcuts

Post by Paul L » Sat Jul 12, 2014 3:36 pm

I second the idea of easy platform neutral scripting. I am aware of the experimental Perl scripting pipe which requires one to rebuild Audacity from source. I have not tried it.

A nuisance using AutoHotKeys or AppleScript is the need to insert appropriate Sleep or delay commands to make scripts work more reliably with the discarding of typeahead during long operations. Maybe a smaller wish would be a means to turn that behavior on and off.

StevenJayCohen
Posts: 12
Joined: Mon Dec 16, 2013 7:15 pm
Operating System: Please select

Re: Macros consisting of existing Audacity shortcuts

Post by StevenJayCohen » Sat Jul 12, 2014 4:11 pm

Thanks for the bump, Paul. Does anyone else think the ability to make a Chain of Shortcuts (Macros) is a good idea?

Gale Andrews
Quality Assurance
Posts: 41761
Joined: Fri Jul 27, 2007 12:02 am
Operating System: Windows 10

Re: Macros consisting of existing Audacity shortcuts

Post by Gale Andrews » Sun Jul 13, 2014 10:08 am

StevenJayCohen wrote:Access to Cut/Copy/Paste from the host operating system
Please explain how that differs from what happens now.

Gale
________________________________________FOR INSTANT HELP: (Click on Link below)
* * * * * Tips * * * * * Tutorials * * * * * Quick Start Guide * * * * * Audacity Manual

Paul L
Posts: 1788
Joined: Mon Mar 11, 2013 7:37 pm
Operating System: Please select

Re: Macros consisting of existing Audacity shortcuts

Post by Paul L » Sun Jul 13, 2014 12:02 pm

Gale Andrews wrote:
StevenJayCohen wrote:Access to Cut/Copy/Paste from the host operating system
Please explain how that differs from what happens now.

Gale
I don't understand that part either. It easy enough to send ctrl (or cmd) -c or -v. You must mean more.

StevenJayCohen
Posts: 12
Joined: Mon Dec 16, 2013 7:15 pm
Operating System: Please select

Re: Macros consisting of existing Audacity shortcuts

Post by StevenJayCohen » Sun Jul 13, 2014 12:07 pm

In order to build a script like the one I show in the original post, not only would the "Macros" need to be able to be comprised of Audacity's own shortcuts, but they would also need to be able to send ones native to the operating system (like the Cut/Copy/Paste).

Since actual keys differ (CTRL+X on Windows and CMD + X on OSX), the "Macros" would be most useful if they included the ability to leverage things like Cut/Copy/Paste WITHOUT using platform specific key commands.

That way, scripts would run universally in Audacity without needing to be tweaked between platforms.

waxcylinder
Forum Staff
Posts: 14684
Joined: Tue Jul 31, 2007 11:03 am
Operating System: Windows 10

Re: Macros consisting of existing Audacity shortcuts

Post by waxcylinder » Tue Sep 23, 2014 4:43 pm

BUMP

does this need transferring to Wiki>PFR

Peter
________________________________________FOR INSTANT HELP: (Click on Link below)
* * * * * FAQ * * * * * Tutorials * * * * * Audacity Manual * * * * *

Paul L
Posts: 1788
Joined: Mon Mar 11, 2013 7:37 pm
Operating System: Please select

Re: Macros consisting of existing Audacity shortcuts

Post by Paul L » Tue Sep 23, 2014 6:18 pm

Don't know, but I do know the developers' board has debated the right approach to scripting quite a bit, and I have not followed it closely.

Gale Andrews
Quality Assurance
Posts: 41761
Joined: Fri Jul 27, 2007 12:02 am
Operating System: Windows 10

Re: Macros consisting of existing Audacity shortcuts

Post by Gale Andrews » Tue Sep 23, 2014 9:22 pm

waxcylinder wrote:BUMP

does this need transferring to Wiki>PFR
Thanks, Peter. Yes, please transfer it. Copy across the script too. StevenJayCohen, do we have your permission to post the script on Audacity Wiki, for example on http://wiki.audacityteam.org/wiki/Scripts ?


Gale
________________________________________FOR INSTANT HELP: (Click on Link below)
* * * * * Tips * * * * * Tutorials * * * * * Quick Start Guide * * * * * Audacity Manual

waxcylinder
Forum Staff
Posts: 14684
Joined: Tue Jul 31, 2007 11:03 am
Operating System: Windows 10

Re: Macros consisting of existing Audacity shortcuts

Post by waxcylinder » Wed Sep 24, 2014 8:39 am

Thanks, I'll keep the transfer on hold until StevenJayCohen replies.

Peter
________________________________________FOR INSTANT HELP: (Click on Link below)
* * * * * FAQ * * * * * Tutorials * * * * * Audacity Manual * * * * *

Locked