I do a lot of 3D modelling and stuff in Blender - and use a lot of video tutorials. A real pain is having to switch between VLC and Blender to pause, skip back 5 seconds and so on during the videos. So I have had a go at using AHK to remedy this. My script allows me to uses the keys Ctrl=Windows+left/right/space to skip forwards, backwards or pause/start in VLC whilst ensuring the Blender window remains in focus after th VLC action. This is my first AHK script so it may not be elegant in any shape of form but seems to work. Posting in case useful top others - easily adapted to other apps. Also if there are better ways of achieving the same results I'd be interested to hear if you have the time to post the info.
Best
Steve
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
#SingleInstance force
; VLC Short Skip Backwards - ctrl+windows+left trigger
^#left::
if WinExist("ahk_exe vlc.exe")
WinActivate, ahk_exe vlc.exe
Send, +{left}
WinActivate, ahk_exe blender.exe
return
; VLC Short Skip Forwards - ctrl+windows+right trigger
^#right::
if WinExist("ahk_exe vlc.exe")
WinActivate, ahk_exe vlc.exe
Send, +{right}
WinActivate, ahk_exe blender.exe
return
; VLC Pause - ctrl+windows+space trigger
^#space::
if WinExist("ahk_exe vlc.exe")
WinActivate, ahk_exe vlc.exe
Send, {space}
WinActivate, ahk_exe blender.exe
return
VLC and Blender Script
Re: VLC and Blender Script
different way, not necessarily better per se, but different:
Code: Select all
#NoEnv
#SingleInstance force
SendMode Input
SetWorkingDir %A_ScriptDir%
fn := Func("mySendFunc")
for key, modifier in {"left": "+", "right": "+", "space": ""}
{
bf := fn.Bind(modifier "{" key "}")
Hotkey % "^#" key, % bf
}
mySendFunc(arg) {
static VLC_EXE := "ahk_exe vlc.exe"
, BLENDER_EXE := "ahk_exe blender.exe"
if WinExist(VLC_EXE) ; is this check even necessary
WinActivate % VLC_EXE
Send % arg
WinActivate % BLENDER_EXE
}
Re: VLC and Blender Script
Hi Swag, thank you for this - this is useful and helps me to understand AHK. I can reverse engineer this with the help file. The advantage of your approach is that it is easier to add more controls to it whilst keeping the code short - thank you for taking the time to post Appreciate it
Re: VLC and Blender Script
Hello,
it is possible to make this script working with Media Player Classic instead of VLC?
it is possible to make this script working with Media Player Classic instead of VLC?
Re: VLC and Blender Script
Sure, if you know the window properties and the keyboard shortcuts for MPC
ciao
toralf
toralf
Return to “Scripts and Functions (v1)”
Who is online
Users browsing this forum: No registered users and 113 guests