PotPlayer x64 Function Library

Post your working scripts, libraries and tools for AHK v1.1 and older
jly
Posts: 89
Joined: 30 Sep 2020, 06:06

Re: PotPlayer x64 Function Library

Post by jly » 21 Oct 2020, 08:34

There are several opened potplayer windows on the desktop.
How to use shortcut keys to open the specified video file in the specified window?

Gh0sTG0
Posts: 55
Joined: 25 Jun 2018, 07:58

Re: PotPlayer x64 Function Library

Post by Gh0sTG0 » 19 Jul 2021, 13:51

Hi. Nice thing. But not works PotPlayer_JumpForward fot me at all... It is doing nothing.
Am I correct that there's no way to move 5 seconds forward (send {Right} somewhere?) except to winactivate->send?

x32
Posts: 177
Joined: 25 Nov 2016, 16:44

Re: PotPlayer x64 Function Library

Post by x32 » 19 Jul 2021, 19:06

Is Potplayer still around? I thought they had shut down. I haven't had it on my system for a while so the code for jump forward may have changed. I believe the codes were listed in the manual so check and see if it is different than it use to be (0x5005). If it is, change it in the library script.

Also make sure "ahk_class" is still the same. If Potplayer still uses SendMessage for controls then you should not need to activate it to control with this Autohotkey library.

Code: Select all

PotPlayer_JumpForward() ; Set for 5 seconds but seems to jump an arbitrary amount.
		{
		ppct := ppctm()
		newtime := ppct+5000 ; Add 5 seconds to current time.
		SendMessage, 0x0400, 0x5005,newtime,, ahk_class PotPlayer64
		}

Gh0sTG0
Posts: 55
Joined: 25 Jun 2018, 07:58

Re: PotPlayer x64 Function Library

Post by Gh0sTG0 » 20 Jul 2021, 02:06

x32 wrote:
19 Jul 2021, 19:06
Is Potplayer still around? I thought they had shut down. I haven't had it on my system for a while so the code for jump forward may have changed. I believe the codes were listed in the manual so check and see if it is different than it use to be (0x5005). If it is, change it in the library script.

Also make sure "ahk_class" is still the same. If Potplayer still uses SendMessage for controls then you should not need to activate it to control with this Autohotkey library.

Code: Select all

PotPlayer_JumpForward() ; Set for 5 seconds but seems to jump an arbitrary amount.
		{
		ppct := ppctm()
		newtime := ppct+5000 ; Add 5 seconds to current time.
		SendMessage, 0x0400, 0x5005,newtime,, ahk_class PotPlayer64
		}
Hi. I checked class name, it's "ahk_class PotPlayer64" for me.
Where and how can I check that control names?
Btw I added messagebox, looks like ppctm() gets correct number, next adds them correct number and then just can't send it correct.

I tried playing with "newtime := ppct+5000", changing it to +30000, and looks like it starts working... but it adds =20 seconds to video... That's really strange, but it works, hope it will help someone else if they use this thing.
I played a bit more and find, that for:
- 10000 and less - it moves for 0 seconds
- 10001 - 20000 - adds 10 seconds ~99% of times, some times adds 7 seconds.
- 20001 - adds 10 seconds once if it is on start of video (0 seconds), then adds 20 seconds. Sometimes can add 17 seconds.
- near 30000 it adds 20 seconds, sometimes 27 seconds (maybe it's because some keyframes in video)
- near 35000 it adds 30 seconds.

malcev
Posts: 1769
Joined: 12 Aug 2014, 12:37

Re: PotPlayer x64 Function Library

Post by malcev » 20 Jul 2021, 05:29

Uncheck
Playback->Jump (to)->Use keyframe to jump to a time.

Gh0sTG0
Posts: 55
Joined: 25 Jun 2018, 07:58

Re: PotPlayer x64 Function Library

Post by Gh0sTG0 » 20 Jul 2021, 06:16

malcev wrote:
20 Jul 2021, 05:29
Uncheck
Playback->Jump (to)->Use keyframe to jump to a time.
Yep, now works correct. TY.

ilw
Posts: 4
Joined: 13 Aug 2018, 13:45

Re: PotPlayer x64 Function Library

Post by ilw » 08 Sep 2022, 08:54

Hello guys:
is it possible to send message to PotPlayer for:
- showing progress bar. like at screen;
Image
- to get bookmark timecodes (for viewing bookmarks, press the `h` in potplayer)

Thanks!
Attachments
image.png
image.png (3.1 KiB) Viewed 871 times

vrbest
Posts: 2
Joined: 16 May 2023, 07:45

Re: PotPlayer x64 Function Library

Post by vrbest » 19 Feb 2024, 22:15

x32 wrote:
09 Mar 2018, 23:27
Function library for the short list of available commands for the new(ish) PotPlayer media player. Updated with new functions 3/12/18.
https://potplayer.daum.net/

I prefer using SendMessage over Hotkeys because the player does not need to have focus or even be showing to receive the messages. This library is for the 64 bit version of the player. It can be modified for the 32 bit version by changing the AHK Class (ahk_class PotPlayer64) to however Window Spy detects it.

Basic messages are called with no other info needed.
Example:


Other functions and functions added in the future can be called by passing the correct value. A chart at the bottom of the library list the value for each known function.
Example:


Save script as PotPlayer.ahk and add to your function library folder.
hi x32, I cann't find the download link, how can I download the whole library code? Thanks for your help!

x32
Posts: 177
Joined: 25 Nov 2016, 16:44

Re: PotPlayer x64 Function Library

Post by x32 » 20 Feb 2024, 16:46

Here's the library. I haven't looked at it since the day I first posted it so it likely needs updating. Fyi, my username was Specter333. When this forum started going to hell it would not let me re-register with the same user name. Now that it has fully gone to hell I have pulled all my post down but missed this one I guess.

Code: Select all

; PotPlayer Function Library by Specter333

; A complete list of functions can be found at the bottom of the page.
; Use Send functions to control PotPlayer with out it being active.


PotPlayer(msg) 
	{
	; For "msg" use a number from the list of commands at the bottom of the page.
	SendMessage,0x0111,msg,,,ahk_class PotPlayer64
	}
PotPlayer_Play()
	{
	SendMessage,0x0111,20001,,,ahk_class PotPlayer64
	}
PotPlayer_Pause()
	{
	SendMessage,0x0111,20000,,,ahk_class PotPlayer64
	}
PotPlayer_PlayPause()
	{
	SendMessage,0x0111,10014,,,ahk_class PotPlayer64
	}
PotPlayer_Stop()
	{
	SendMessage,0x0111,20002,,,ahk_class PotPlayer64
	}
PotPlayer_Previous()
	{
	SendMessage,0x0111,10123,,,ahk_class PotPlayer64
	}
PotPlayer_Next()
	{
	SendMessage,0x0111,10124,,,ahk_class PotPlayer64
	}
PotPlayer_VolumeUp()
	{
	SendMessage,0x0111,10035,,,ahk_class PotPlayer64
	}
PotPlayer_VolumeDown()
	{
	SendMessage,0x0111,10036,,,ahk_class PotPlayer64
	}
PotPlayer_Mute()
	{
	SendMessage,0x0111,10037,,,ahk_class PotPlayer64
	}
PotPlayer_Close()
	{
	WinClose, ahk_class PotPlayer64
	}
PotPlayer_Current()
	{
	SendMessage, 0x0400, 0x5004,,, ahk_class PotPlayer64
	PotPlayerConvert := PotPlayerConvertMillisecToTime(ErrorLevel)
	Return, %PotPlayerConvert%
	}
	
;;;;;;;;;;;;;   This function provided by Odlanir 	
PotPlayerConvertMillisecToTime(msec) 
	{
	secs := floor(mod((msec / 1000),60))
	mins := floor(mod((msec / (1000 * 60)), 60) )
	hour := floor(mod((msec / (1000 * 60 * 60)) , 24))
	return Format("{:02}:{:02}:{:02}",hour,mins,secs)
	}
	
PotPlayer_GetVol()
		{
		SendMessage, 0x0400, 0x5000,,, ahk_class PotPlayer64
		Return, %ErrorLevel%
		}
PotPlayer_SetVol(newvol)
		{
		SendMessage, 0x0400, 0x5001,newvol,, ahk_class PotPlayer64
		}		
PotPlayer_GetTotalTime()
		{
		SendMessage, 0x0400, 0x5002,,, ahk_class PotPlayer64
		PotPlayerTotalTime := PotPlayerConvertMillisecToTime(ErrorLevel)
		Return, %PotPlayerTotalTime%
		}		
PotPlayer_SetTime(newtime) ; Value in milliseconds
		{
		SendMessage, 0x0400, 0x5005,newtime,, ahk_class PotPlayer64
		}

PotPlayer_JumpForward() ; Set for 5 seconds but seems to jump an arbitrary amount.
		{
		ppct := ppctm()
		newtime := ppct+5000 ; Add 5 seconds to current time.
		SendMessage, 0x0400, 0x5005,newtime,, ahk_class PotPlayer64
		}
PotPlayer_JumpBackward() ; Set for -5 seconds but seems to jump an arbitrary amount.
		{
		ppct := ppctm()
		newtime := ppct-5000 ; Subract 5 seconds from current time. 
		SendMessage, 0x0400, 0x5005,newtime,, ahk_class PotPlayer64
		}
ppctm() ; Retrives the current possition in milliseconds
		{
		SendMessage, 0x0400, 0x5004,,, ahk_class PotPlayer64
		Return, %ErrorLevel%	
		}
PotPlayer_Status() 
		{
		SendMessage, 0x0400, 0x5006,,, ahk_class PotPlayer64
		Return, %ErrorLevel%
		}	

PotPlayer_AOT() 
		{
		WinSet, AlwaysOnTop, Toggle, ahk_class PotPlayer64
		}		
	
/*	
Use one of the numbers from the commands below with the PotPlayer(msg)
function to call commands not included in this library.  

Use only the number, example: the Open File function = PotPlayer(10158)

These commands use 0x0111 as the Msg parameter.
local CMD_PLAY              = 20001;
local CMD_PAUSE             = 20000;
local CMD_STOP              = 20002;
local CMD_PREVIOUS          = 10123;
local CMD_NEXT              = 10124;
local CMD_PLAY_PAUSE        = 10014;
local CMD_VOLUME_UP         = 10035;
local CMD_VOLUME_DOWN       = 10036;
local CMD_TOGGLE_MUTE       = 10037;
local CMD_TOGGLE_PLAYLIST   = 10011;
local CMD_TOGGLE_CONTROL    = 10383;
local CMD_OPEN_FILE         = 10158;
local CMD_TOGGLE_SUBS       = 10126;
local CMD_TOGGLE_OSD        = 10351;
local CMD_CAPTURE           = 10224;


These commands use 0x0400 as the Msg parameter
POT_GET_VOLUME   0x5000 // 0 ~ 100
POT_SET_VOLUME   0x5001 // 0 ~ 100
POT_GET_TOTAL_TIME  0x5002 // ms unit
POT_GET_PROGRESS_TIME 0x5003 // ms unit
POT_GET_CURRENT_TIME 0x5004 // ms unit
POT_SET_CURRENT_TIME 0x5005 // ms unit
POT_GET_PLAY_STATUS  0x5006 // -1:Stopped, 1:Paused, 2:Running
POT_SET_PLAY_STATUS  0x5007 // 0:Toggle, 1:Paused, 2:Running
POT_SET_PLAY_ORDER  0x5008 // 0:Prev, 1:Next
POT_SET_PLAY_CLOSE  0x5009
POT_SEND_VIRTUAL_KEY 0x5010 // Virtual Key(VK_UP, VK_DOWN....)
*/

vrbest
Posts: 2
Joined: 16 May 2023, 07:45

Re: PotPlayer x64 Function Library

Post by vrbest » 24 Feb 2024, 00:19

Thanks Specter333. The library really helps me a lot.

Post Reply

Return to “Scripts and Functions (v1)”