Autohotkeys: Difference between revisions

From Librivox wiki
Jump to navigationJump to search
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)
 
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.
 


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 on your computer.


click the link Installer for Autohotkey Basic it looks like this
2) Add a script for Autohotkeys to follow.  Start Notepad, copy the script below and save it as a simple text file with the extension .ahk at any place you want, 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.
''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.
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".






These are some of the scripts that can be used :
These are some of the scripts that can be used :


Delete a selection (find Z crossings, delete selection,back up 2 seconds, zoom back to normal and begin playback)
 
'''Delete a selection''' 
(find Z crossings, delete selection,back up 2 seconds, zoom back to normal and begin playback)
 
---copy from below this line to the next line ---------------- paste this into your text document.


;delete a marked range:
;delete a marked range:
SC03A & d::
SC03A & d::<br />
{
{<br />
Send, z
Send, z<br />
Send, {Delete}
Send, {Delete}<br />
Send, {Left 15}
Send, {Left 15}<br />
Send, ^2
Send, ^2<br />
Send, {Space}
Send, {Space}<br />
}
}<br />
Return
Return


Line 40: Line 55:
;deamplify x3
;deamplify x3
{
{
SC03A & 3::
SC03A & 3::<br />
Send, !c
Send, !c<br />
Send, A
Send, A<br />
Send, {Enter}
Send, {Enter}<br />
Send, -3
Send, -3<br />
Send, {Enter}
Send, {Enter}<br />
Send, {Left 40}
Send, {Left 40}<br />
Send, ^2
Send, ^2<br />
Send, {space}
Send, {space}<br />
Return
Return<br />
}
}<br />
Return
Return<br />


Deamplify the current selection by 4
Deamplify the current selection by 4


;deamplify x 4
;deamplify x 4<br />
{
{<br />
SC03A & 4::
SC03A & 4::<br />
Send, !c
Send, !c<br />
Send, A
Send, A<br />
Send, {Enter}
Send, {Enter}<br />
Send, -4
Send, -4<br />
Send, {Enter}
Send, {Enter}<br />
Send, {Left 40}
Send, {Left 40}
Send, ^2
Send, ^2<br />
Send, {space}
Send, {space}<br />
Return
Return<br />




Amplify the current selection by 2
Amplify the current selection by 2


;amplify x2
;amplify x2<br />
SC03A & 2::
SC03A & 2::<br />
{
{<br />
Send, !c
Send, !c<br />
Send, A
Send, A<br />
Send, {Enter}
Send, {Enter}<br />
Send, 2
Send, 2<br />
Send, {Enter}
Send, {Enter}<br />
Send, {Left 40}
Send, {Left 40}<br />
Send, ^2
Send, ^2<br />
Send, {space}
Send, {space}<br />
}
}<br />
Return
Return<br />


---Stop copying here ---------


3) rename the text document Autohotkey script.ahk


        Use virtually any key, button, or combination as a hotkey for your keyboard, mouse, joystick, and handheld remote controls.
4) double click on that document and you can use autohotkeys!!!
        Expand abbreviations as you type them using hotstrings.
        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.

Revision as of 01:23, 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)

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.


To download and install:

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

2) Add a script for Autohotkeys to follow. Start Notepad, copy the script below and save it as a simple text file with the extension .ahk at any place you want, 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".



These are some of the scripts that can be used :


Delete a selection

(find Z crossings, delete selection,back up 2 seconds, zoom back to normal and begin playback)

---copy from below this line to the next line ---------------- paste this into your text document.

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

SC03A & 2::
{
Send, !c
Send, A
Send, {Enter}
Send, 2
Send, {Enter}
Send, {Left 40}
Send, ^2
Send, {space}
}
Return

---Stop copying here ---------

3) rename the text document Autohotkey script.ahk

4) double click on that document and you can use autohotkeys!!!