AutoHotkey script to open video files using timestamp information with PotPlayer

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
wretina
Posts: 1
Joined: 25 Mar 2023, 14:48

AutoHotkey script to open video files using timestamp information with PotPlayer

Post by wretina » 25 Mar 2023, 15:02

I'm hoping a AutoHotkey script can do the following:

1.Ask me to input the name of a video file (including file extension) and a timestamp (in seconds).
2.Open the specified video file in PotPlayer.
3.Jump to the specified timestamp in the video.

I'm a liberal arts student who is new to AutoHotkey and don't have much experience writing scripts.English is not my native language. I think if this function could be achieved, it would be enormously helpful when it comes to language learning. You can do something like sentence mining with much more detailed context. Much thanks!

User avatar
mikeyww
Posts: 26883
Joined: 09 Sep 2014, 18:38

Re: AutoHotkey script to open video files using timestamp information with PotPlayer

Post by mikeyww » 26 Mar 2023, 05:58

Welcome to this AutoHotkey forum!

Wow. Thanks for that clear notification about liberal arts. We are now forewarned! :) :( :shock:

Code: Select all

; This script uses PotPlayer to play a video from a specific timestamp
#Requires AutoHotkey v2.0
MsgBox 'Press F3 to start.', 'Instructions', 64

F3::playMedia

playMedia() {
 Static app    := A_ProgramFiles '\DAUM\PotPlayer\PotPlayerMini64.exe'
 playBtn_Click := (*) => (gui1.Submit(), Run(app ' "' media.Value '" /seek=' startSeconds.Value))
 vidBtn_Click  := (*) => (media.Value := FileSelect(3)) && (startSeconds.Focus(), playBtn.Opt('+Default'))
 gui1          := Gui(, 'Play video'), gui1.SetFont('s10')
 vidBtn        := gui1.AddButton('w100 Default', 'Media file:'), vidBtn.OnEvent('Click', vidBtn_Click)
 gui1.AddText('wp', 'Start (seconds):')
 media         := gui1.AddEdit('w365 ym+2')
 startSeconds  := gui1.AddEdit('w50')
 playBtn       := gui1.AddButton('xm w500', 'Play'), playBtn.OnEvent('Click', playBtn_Click)
 gui1.Show
}
PotPlayer command line:

Post Reply

Return to “Ask for Help (v2)”