Autohotkeys: Difference between revisions

From Librivox wiki
Jump to navigationJump to search
 
(8 intermediate revisions by the same user not shown)
Line 5: Line 5:
AutoHotkey is an open source scripting language for Windows that can automate and customize almost any action on your PC.
AutoHotkey is an open source scripting language for Windows that can automate and customize almost any action on your PC.


In LibriVox, it is used with Audacity to make editing quicker and easier.  
In LibriVox, it is used with Audacity to make editing quicker and easier. (thanks to Karlsson for the following information)


To download and install:  
To download and install:  


go to [http://www.autohotkey.com/]
1) Install. go to [http://www.autohotkey.com/] click the first link Installer for Autohotkey.
 
follow the dialog boxes and install the program on your computer.
click the link Installer for Autohotkey Basic it looks like this
''Installer for AutoHotkey Basic (1.95 MB): This is the original AutoHotkey, suitable for those who don't need Unicode, objects/arrays, and other new features.''
 
install.


2) Add a script for Autohotkeys to follow.  Start Notepad, go to [http://philslibrivoxpage.wikispaces.com/]and copy the script in red, then  save it on your desktop as a simple text file with the extension .ahk  (e.g. as "audacity.ahk" on the desktop*).
When you double-click the script-file, it becomes active and you find it as a green and white symbol with an "H" in your tray. Now you can select a range in Audacity, hit CapsLock+d ad you hear your corrected recording.


Of course you can choose any other hotkey, and you can edit the script in any way; look at the Autohotkey documentation. You can automate almost anything by sending keystrokes and mouse clicks, and you can write a mouse or keyboard macro by hand or use the macro recorder.


*) Important: the file must have the file-extension .ahk, and NOT .txt! indows 2000 and XP, open Windows Explorer and choose Tools | Folder Options | View, and uncheck the box for "Hide file extensions for known file types".
   
   
The most frequent action I have to do when editing audio data with Audacity is deleting repeats, silence or messed up words/phrases. Usually these steps have to be made:
-'''Bold text''' selecting the range of data that I want to delete with the mouse
- hit "z" to find Zero Crossings
- hit "Delete"
- click some centimetres left into the audio track to listen to the corrected data
- hit "Space" to start playing.


These are some of the scripts that can be used :
I found this rather cumbersome; so now I use a single hotkey that I scripted with Autohotkey (http://www.autohotkey.com). So the only thing I have to do is to select the data and then hit "CapsLock + d", and I directly hear the corrected data.
 
Delete a selection (find Z crossings, delete selection,back up 2 seconds, zoom back to normal and begin playback)
 
;delete a marked range:
SC03A & d::
{
Send, z
Send, {Delete}
Send, {Left 15}
Send, ^2
Send, {Space}
}
Return
 
 
Deamplify the current selection by 3
 
;deamplify x3
{
SC03A & 3::
Send, !c
Send, A
Send, {Enter}
Send, -3
Send, {Enter}
Send, {Left 40}
Send, ^2
Send, {space}
Return
}
Return
 
Deamplify the current selection by 4
 
;deamplify x 4
{
SC03A & 4::
Send, !c
Send, A
Send, {Enter}
Send, -4
Send, {Enter}
Send, {Left 40}
Send, ^2
Send, {space}
Return
 


Amplify the current selection by 2


;amplify x2
The script that you are copying from philslibrivoxpage contains 4 different hot key combinations:
SC03A & 2::
{
Send, !c
Send, A
Send, {Enter}
Send, 2
Send, {Enter}
Send, {Left 40}
Send, ^2
Send, {space}
}
Return


CapsLock & D  =  will delete a selection after finding z crossings, then zoom out to normal, back up 2 seconds and start the playback.
CapsLock & 2  =  will amplify the selection X2
CapsLock & 3  =  will deamplify the selection X3
CapsLock & 4  =  will deamplify the selection X4.


You should hold down the CapsLock while pressing the other key at the same time.


        Use virtually any key, button, or combination as a hotkey for your keyboard, mouse, joystick, and handheld remote controls.
Other scripts can be written of course and can be added to this script or made into stand alone scripts. To see how to create your own scripts
        Expand abbreviations as you type them using hotstrings.
and edit the ones you have, go to [http://www.autohotkey.com/docs/].
        Easily create your own graphical user interfaces and custom menus.
        Convert any script into an EXE file that will run on computers without AutoHotkey.
        Manipulate files, text, and windows belonging to almost any program.
        Call functions inside a DLL, such as standard Windows API functions.
        All of this and more in a simplified syntax that makes learning easy for beginners while offering powerful features for advanced users.

Latest revision as of 03:34, 14 March 2012

AUTOHOTKEYS -

AutoHotkey is an open source scripting language for Windows that can automate and customize almost any action on your PC.

In LibriVox, it is used with Audacity to make editing quicker and easier. (thanks to Karlsson for the following information)

To download and install:

1) Install. go to [1] click the first link Installer for Autohotkey. follow the dialog boxes and install the program on your computer.

2) Add a script for Autohotkeys to follow. Start Notepad, go to [2]and copy the script in red, then save it on your desktop as a simple text file with the extension .ahk (e.g. as "audacity.ahk" on the desktop*). When you double-click the script-file, it becomes active and you find it as a green and white symbol with an "H" in your tray. Now you can select a range in Audacity, hit CapsLock+d ad you hear your corrected recording.

Of course you can choose any other hotkey, and you can edit the script in any way; look at the Autohotkey documentation. You can automate almost anything by sending keystrokes and mouse clicks, and you can write a mouse or keyboard macro by hand or use the macro recorder.

  • ) Important: the file must have the file-extension .ahk, and NOT .txt! indows 2000 and XP, open Windows Explorer and choose Tools | Folder Options | View, and uncheck the box for "Hide file extensions for known file types".

The most frequent action I have to do when editing audio data with Audacity is deleting repeats, silence or messed up words/phrases. Usually these steps have to be made: -Bold text selecting the range of data that I want to delete with the mouse - hit "z" to find Zero Crossings - hit "Delete" - click some centimetres left into the audio track to listen to the corrected data - hit "Space" to start playing.

I found this rather cumbersome; so now I use a single hotkey that I scripted with Autohotkey (http://www.autohotkey.com). So the only thing I have to do is to select the data and then hit "CapsLock + d", and I directly hear the corrected data.


The script that you are copying from philslibrivoxpage contains 4 different hot key combinations:

CapsLock & D = will delete a selection after finding z crossings, then zoom out to normal, back up 2 seconds and start the playback. CapsLock & 2 = will amplify the selection X2 CapsLock & 3 = will deamplify the selection X3 CapsLock & 4 = will deamplify the selection X4.

You should hold down the CapsLock while pressing the other key at the same time.

Other scripts can be written of course and can be added to this script or made into stand alone scripts. To see how to create your own scripts and edit the ones you have, go to [3].