Sandro joined the OldGames.sk from: 28.05.2012
last logged in: 19.11.2012
Comments in Discussion by code120
Results: 1 [ 1-1/1 ] |
|
«previous
|
0
|
next»
|
[b]DosBox and Autohotkey - A short guide[/b]
Autohotkey is a program that can intercept inputs (from keyboard, mouse or even
joystick) and send to the OS a different input, on the base of instructions
coded in a script. This is useful for a lot of programs, like word processors,
and it also allows to create keyboard shortcuts, or the use of mouse/joystick
buttons and the mouse wheel, in programs that don't support them, like DosBox.
Ahk can recognize the active window and the script can be made to affect a
single program. You can therefore create a script that binds the mouse wheel or
extra buttons to certain keys if DosBox is the active window. Even better, you
can have different instructions (and different bindings) for most programs that
are executed in DosBox, since Ahk can recognize a window also from its title bar
(where the name of the .EXE launched in DosBox appears).
Once the script has been created, if Ahk is installed and the script is
executed, it will run in the background and it will affect only the kind of
window (that is, the program) that has been secified in the script, without
affecting the rest of the OS.
You can create a script with the notepad, then save it with the .ahk extension
and launch it with Autohotkey installed.
*********************************************
An hotkey has the following syntax:
[hotkey]::
[instruction]
return
Example:
^s::
Send hello
Will write 'hello' if you press Ctrl+s
^s::
Send, {Enter}{Right}{Right}{Enter}
Ctrl+s will correspond to the keys Enter, 2 x right arrow, Enter pressed in
sequence.
In the [b][hotkey][/b] part you can use these symbols:
! Alt
^ Control
+ Shift
~ When the hotkey fires, its key's native function will not be blocked.
* Wildcard: Fire the hotkey even if extra modifiers are being held down.
Other symbols can be found here:
http://www.autohotkey.com/docs/Hotkeys.htm#combo
Here you find a comprehensive list of keys, mouse and joystick buttons that can
be used in Ahk.
http://www.autohotkey.com/docs/KeyList.htm
The [b][instruction][/b] part consists mostly in SendEvent (or Send) commands.
Here special keys must be enclosed in brackets.
Here is a list of special keys used with SendEvent:
http://www.autohotkey.com/docs/commands/Send.htm
*************************************
An example of script that can be useful for DosBox:
*************************************
; The script is organized in blocks. Every block that starts with a #ifWinActive
; command will run independently form the others. More than 1 block (even all of
; them, if conditions are met) can run at the same time.
SetTitleMatchMode, 2
;/// this will make Ahk search the string stated in the #ifWinActive lines in
;/// the whole length of the title bar, allowing you to create shortcuts
;/// for nearly all DosBox programs you could want to create them for.
#ifWinActive, ahk_class SDL_app
;/// this block will be active for every program run in DosBox, since it's the
;/// simple identifier for the DosBox window. I bound the key [,] and [.]
;/// to mouse wheel up and down. You can choose the key you want.
;/// It is better to bind keys that aren't commonly used, though, otherwise
;/// they could conflict with keys used by some programs.
;/// After you've bound the keys in the script, you'll have to bind them in
;/// DosBox, with Ctrl+F1 you can launch the keymapper, just choose the key
;/// you want to bind to the wheel, then press 'Add' and move the wheel
;/// when asked to press a key.
*WheelUp::
SendEvent {, Down}
Sleep 200
SendEvent {, Up}
Return
*WheelDown::
SendEvent {. Down}
Sleep 200
SendEvent {. Up}
Return
;\\\ XButton1 and XButton2 are two extra mouse buttons (Web back/forward) that
;\\\ can be found on certain mice. Here they're bound to Ins and Del keys.
XButton1::
SendEvent {Ins Down}
Sleep 200
SendEvent {Ins Up}
Return
XButton2::
SendEvent {Del Down}
Sleep 200
SendEvent {Del Up}
Return
;***********************************************
; this block is active with Elders Scrolls: Daggerfall.
#ifWinActive, Program: FALL
~*WheelUp::
SendEvent {v Down}
Sleep 200
SendEvent {v Up}
Return
~*WheelDown::
SendEvent {NumpadSub Down}
Sleep 200
SendEvent {NumpadSub Up}
Return
;***********************************************
; this block is active with Wrath of Earth. It allows to change weapon with the
; mouse wheel.
#ifWinActive, WOE
~*1::
Weapon := 1
~*WheelUp::
Weapon := ++Weapon
if Weapon = 8
{
Weapon := 1
}
SendEvent {%Weapon% Down}
Sleep 200
SendEvent {%Weapon% Up}
Return
~*WheelDown::
Weapon := --Weapon
if Weapon = 0
{
Weapon := 7
}
SendEvent {%Weapon% Down}
Sleep 200
SendEvent {%Weapon% Up}
Return
;***********************************************
; this block is active with Wizardry VI.
#ifWinActive, WROOT
WinWaitActive, WROOT
ifWinActive, WROOT
{
XButton2::
Send, {Enter}{Enter}
return
RButton::
Send, {Enter}
return
z::
Send, {Enter}{Right}{Right}{Enter}
return
1::
Send, {Enter}{Down}{Enter}{Down}{Enter}
return
2::
Send, {Enter}{Down}{Enter}{Down}{Right}{Enter}
return
3::
Send, {Enter}{Down}{Enter}{Down}{Down}{Enter}
return
4::
Send, {Enter}{Down}{Enter}{Down}{Down}{Right}{Enter}
return
5::
Send, {Enter}{Down}{Enter}{Down}{Down}{Down}{Enter}
return
6::
Send, {Enter}{Down}{Enter}{Down}{Down}{Down}{Right}{Enter}
return
^s::
{
Send, {Enter}
Sleep 50
Send, {Right}
;Sleep 50
Send, {Right}
;Sleep 50
Send, {Down}
;Sleep 50
Send, {Enter}
Sleep 100
Send, {Enter}
}
return
^r::
{
Send, {Enter}
Sleep 100
Send, {Right}{Right}{Down}{Enter}
Sleep 100
Send, {Down}{Down}{Enter}
Sleep 100
Send, {Down}{Enter}
}
return
}
return
;***********************************************
; this block is active with F117 Stealth Fighter II.
#ifWinActive, VGAME ; F117
Joy17::Send {F1}
Joy18::Send {Shift Down},{Shift Up}
Joy19::Send {Shift Down}-{Shift Up}
Joy20::Send {Shift Down}m{Shift Up}
Results: 1 [ 1-1/1 ] |
|
«previous
|
0
|
next»
|
|
last added games |
Tomb Raider II, 22.02.2024 |
Joust, 24.11.2023 |
Fortress of Dr. Radiaki, The, 01.10.2023 |
Rampage, 23.09.2023 |
Lost Vikings 2: Norse by Norsewest, 03.07.2023 |
Falcon, 03.05.2023 |
Metal Gear, 18.10.2022 |
Clock Tower, 26.09.2022 |
RoboCop 2, 09.05.2022 |
Ztracený ostrov, 01.05.2022 |
[ more games ] |
stats |
Games |
:: 1271 |
Extras |
:: 8235 |
Comments |
:: 7768 |
|